A. 0.
B. 1.
C. 2.
D. 4.
The modulus operator returns the remainder, when 22 is divided by 5, which is 2.
A. is false.
B. depends on implementation.
C. depends on operating system.
D. is true.
C++ is case sensitive, as the code is written in C++ turbo compiler. The syntax makes the language case sensitive.
A. unsigned int.
B. float .
C. char.
D. signed int.
The data type float represents a class of objects that are real numbers, or numbers having decimal. For example -4.56.
In the above expression, first && operators executes, followed by ||. Thus, the result 1 is obtained which corresponds to true.
A. Bjarne Stroustrop.
B. Dennis Ritchie.
C. James Gosling.
D. Bill Gates.
C++ was developed by Bjarne Stroustrop. It is Originally designed for system programming, it enables programmers to write efficient code and provided close access to the machine.
A. 1981.
B. 1983.
C. 1980.
D. 1985.
In 1980, Bjarne Stroustrup, from Bell labs, began the development of the C++ language, which received formally this name at the end of 1983, when its first manual was published. In October 1985, the first release of the language appeared.
A. @.
B. /n.
C. !.
D. _.
Blank space, horizontal tab, carriage return, newline, form feed all come under whitespace, used in a C++ program.
A. tokens.
B. keywords.
C. identifiers.
D. literals.
Lexical units are the tokens that are combined together to form the translation unit.
A. num.
B. real.
C. dowhile.
D. switch.
switch is a valid keyword in C++, and is used in place of many if statements.
A. 1class.
B. _student.
C. 23y7
D. 89ER
Variable names in C++ cannot start with a number.
A. enum.
B. enumerate.
C. enums.
D. enumeration.
Enumeration is used in an ordered list context, which is declared using the keyword enum in C++.
A. question mark.
B. conditional operator.
C. literal question mark.
D. literal conditional operator.
A ? denotes a question mark but when / is used along with it, its meaning changes and it becomes a character constant , that is a literal.
A. structure.
B. name of the function.
C. class.
D. memory location.
A union is a memory location that is shared by two or more different variables, generally of different types at different times. The keyword union is used for declaring and creating a union.
A. logical error.
B. type error.
C. syntax error.
D. semantic error.
Syntax error occurs when rules of a programming language are misused. Syntax refers to formal rules governing the construction of valid statements in a language.
A. cout>> "the sum of 3+2 =5;
B. cout<< "the sum of 3+2 = " <<3+2;
C. cin<<3+2=5;
D. cin<< "3+2=5";
cout<< "the sum of 3+2 = " <<3+2; is correct way for output.
A. + ,* and -.
B. << and >>.
C. II and &&.
D. & , ^,I.
Bitwise operators return bitwise combinations of their operands. The bitwise operators are: Bitwise AND (&) Bitwise exclusive OR (^) Bitwise inclusive OR (|)
A. ellipsis.
B. asterisk.
C. brace.
D. pound sign.
The pound sign( # ) is used for preprocessor directive.
A. treated as an array of char.
B. treated like an structure.
C. is not automatically added with ''.
D. can be written in OXC form.
String literal is treated as array of char which has special character'0' which makes the end of string.
A. String literals in single quotes.
B. Literal constants.
C. are not added with double quotes" ".
D. treated as integers.
Multicharacter constants are integer type and they are implementation dependent.
A. integer constants.
B. real constants.
C. char constants.
D. string constants.
A floating point constant are also called real constant, as it is used to represent decimal values as well as fractional form.
A. -0.006.25
B. 35.66
C. + 5.0
D. 15,356.30
A real constant does not allow comma in between digits.
A. mantissa and exponent in exponent form.
B. decimal point.
C. one digit after decimal point.
D. underscore.
A real constant in fractional form must have at least one digit before a decimal point and at least one digit after the decimal point.
A. int.
B. char.
C. float.
D. void.
A multi-character constant are treated as integers and their values are implementation dependent.
A. escape sequence for backspace.
B. escape sequence for end.
C. escape sequence for null.
D. escape sequence for newline.
An escape sequence for newline is represented by backslash followed by'n'.
A. Integer.
B. Character constant.
C. Hexadecimal integer constant.
D. String Literal.
A sequence of digits preceded by 0x or 0X is taken to be an hexadecimal integer thus 0XC is a Hexadecimal integer constant.
A. Hexadecimal constant.
B. octal integer constant.
C. decimal integer constant.
D. multi-character constant.
An integer constant consisting of a sequence of digits is taken as decimal integer constants.
A. implement dependent.
B. not implement dependent.
C. array independent.
D. literals.
Character constant is implementation dependent. Example:Multi-character constants have int data type.
A. variables.
B. constants.
C. Identifier names.
D. keywords.
Identifiers are fundamental building blocks of a program and used as naming different parts of the program.
A. Keyword.
B. Identifier.
C. Literal.
D. Operator.
The asm keyword invokes the inline assembler. It must be followed by an assembly instruction, a group of instructions enclosed in braces.
A. keywords.
B. constants.
C. variables.
D. operators.
Literals are often referred as constants as their value never change during runtime.
A. array.
B. pointer.
C. reference.
D. object.
An identifier is a sequence of characters used to denote object or variable name.
A. class.
B. structure.
C. union and enumeration
D. all of the above
User defined data types are derived from fundamental data types(int, char, float, double, void).
A. 2 types.
B. 5 types.
C. 4 types.
D. 10 types.
Literals means constants, C++ allows four types of literals,i.e., integer, character, floating point and string literals.
A. increment the value of b, before assignment.
B. increment the value of b, after assignment.
C. assign b to a and then, increment their sum.
D. calculate the sum of a and b two times.
++ is a pre-increment operator. Therefore, it would increment the value of b and assign it to a.
A. 3.
B. 4.
C. 5.
D. 7.
7==5 ? 4 : 3 returns 3, since 7 is not equal to 5.
A. 2.
B. 3.
C. 4.
D. 5.
7==5+2 ? 4 : 3 returns 4, since 7 is equal to 5+2.
A. within square brackets.
B. within angular bracket.
C. within curly braces.
D. no bracket used etc.
Every function in C++ has its code within curly braces. { }
A. >> should be used instead of <<.
B. double quotes are not used.
C. there should be a space between < and <.
D. semicolon should not be used.
Correct sentence is cout << " computers can b fun ";
A. same as 'n'.
B. to send a newline character 'n' and then, flush the output buffer.
C. it flushes the output buffer.
D. to send a newline character 'n' but, does not flush the output buffer.
'n' and endl manipulator sends a new line character 'n' but endl also flushes the output buffer whereas, 'n' does not flush the output buffer.
A. setw, setiosflags, setfill, setprecision.
B. cout, cin.
C. 'n'.
D. setw, endl and scope resolution operator.
setw, setiosflags, setfill, setprecision, endl are manipulators. Manipulators are used to change formatting parameters on streams, and to insert or extract certain special characters.
A. a group of different objects.
B. a group of similar objects.
C. a structure.
D. a data type.
The class represents a group of similar objects. It describes all the properties of a data type, and an object is an entity created according to that description.
A. enclosed in double quotes .
B. enclosed in single quotes.
C. enclosed in brackets.
D. enclosed in parenthesis.
Text enclosed in single quotes is treated as character constant. The type of character constant is int. Its value is the ASCII code for the character.
A. one operand.
B. two operands.
C. three operands.
D. four operands.
The word unary means one. Post increment operator is an example of unary operator. It takes one operand as input and processes it to give the output.
A. character type.
B. assignment type.
C. arithmetic or pointer type.
D. modulus type.
The operator unary + must have arithmetic or pointer type; since, it returns values of arithmetic type.
A. constants.
B. varying float numbers.
C. varying integers.
D. string.
Literals are data items, which never change their value during a program run. They are integer constant, character-constant, floating constant and string-literal.
A. assigns the l value to the r value (left to right rule).
B. assigns the r value to the l value (right to left rule).
C. can be in either way.
D. compare two values.
The assignment operation always takes place from right to left, and never the other way. Example: a=b; this statement assigns to variable a (the l value) the value contained in variable b (the r value).
A. conio.h is not included.
B. sum should be float.
C. 9var and sum-3 are invalid identifiers.
D. There should be a semicolon after}.
A variable name can never start with a number. A variable name cannot include any special characters except, _ and $.
A. sqrs1 cannot be a variable name.
B. >> should be used in place of <<.
C. variables are not declared before use.
D. main can not have int as its data type.
Since, variables are not declared before their use, a syntax error occurs.
A. run time error occurs.
B. type casting occurs.
C. semantic error occurs.
D. type error occurs.
If non-integer data like a string is entered for integer data type, then type error occurs. It can be rectified by retyping the data in an integer form or by converting the non-integer data into integer form.
A. .
B. ?.
C. >
D. ,
When the set of expressions has to be evaluated for a value, only the rightmost expression is considered. These expressions are separated with the help of a comma operator.
A. a keyword.
B. an identifier.
C. a character literal.
D. a literal constant.
An identifier is a sequence of characters, used to denote a label name.
A. perform token replacement.
B. perform preprocessor operations.
C. include two header files at the same time.
D. include a library function.
# is used for preprocessor directives and ## is used to perform token replacement and merging, during the preprocessor scanning phase.
A. exe( ).
B. main( ).
C. void( ).
D. start( ).
main() indicates the start of any program. A program cannot execute without a main() in C++.
A. class of an organization.
B. subclass.
C. base class
D. derived class.
The superclass inherits the properties of a subclass or derived class.
A. is called inheritance.
B. is an essential principal of system design.
C. is called abstraction.
D. is called ploymorphism.
Abstraction refers to the act of representing essential features without including the background details or explanation.
A. module.
B. abstraction.
C. polymorphism.
D. data.
A module is a separate unit of software or hardware.
A. reuse feasibility.
B. data.
C. user.
D. information.
Object oriented programming is based on objects and classes.
A. data abstraction.
B. data encapsulation
C. reusability.
D. polymorphism.
In order to overload a function, a different signature should be used for each overloaded version.
It refers to a different way of looking at a problem.
High Level Language (HLL) is a technical language close to human understanding in English. Cobol, Fortran, C++ are some examples of HLLs.
Assembly language is a language in which instructions are written using symbolic names for machine operations. For example, READ, ADD, STORE.
OOP stands for Object Oriented Programming.
As we enter in our drawing room, we look for different things kept around i.e., a sofa, a chair, carpet, curtains etc. All these are the objects kept there.
The advantages are as follows:
i) Can use the same codes used in the base class.
ii) Since the code has already been tested in the base class, you do not have to do many dry runs.
Under enscapsulation, the functions working on the data are referred to as member functions.
A car driver is concerned with driving. He need not go into the details about wires, engine, brakes etc. It is termed as abstraction.
Abstraction refers to the act of representing essential features without including the background details or explanation. It refers to the concept of
In modular progmming, many modules share the same data. The arrangement of data can’t be changed without modifying all the modules.
Module is a property of a system that has been decomposed into a set of cohesive and loosely coupled modules.
The transitive nature of inheritance states that if a class A inherits properties from its base class B then all its subclasses will also be inheriting the properties of base class of A i.e., B.
The programming approach that focuses on the procedures for the solution of a problem is known as procedural programming paradigm. This approach emphasizes on the 'doing' rather than the 'data'.
Low level languages (machine language and assembly language) are machine-oriented and require extensive knowledge of machine circuitry. In machine language, the instructions are given in binary codes whereas in assembly language, instructions are given in symbolic names (mnemonics).
A class is defined as a group of objects that share common properties and relationships. A class is a group of objects. Object is an identifiable entity with some characteristics and behaviour.
Dog is a class. This class consists of many dogs. Let us name them as dog x, dog y and dog z. Here, dog x, dog y and dog z are the objects of class Dog.
Polymorphism is a combination of two words viz. poly(=many) and morphs(=forms). Thus, polymorphism means many forms. OOPs shows the features of polymorphism in the form of function overloading. It is the feature of OOP that enables a user to deal with more than one object considering them as the same type.
In modular programming, a set of related procedures with the data they manipulate is combined under a unit called module. Where there is no grouping of procedures with related data, the procedural programming approach still applies.
A derived class is a class that inherits properties from some other class. A base class is a class whose properties are inherited by derived class. A derived class has nearly all properties of base class but the reverse of it is not true.
Suppose a class A inherits from class B. Class C and D inherit from A. If there is a bug in B then correction is required only in B as it will be automatically reflected to all subclasses A, C and D if class B has been inherited without changes.
Inheritance creates new objects by expanding existing ones. It is important for the following reasons:
1. It ensures closeness with the real world.
2. It allows addition of additional features to an existing class without modifying it.
Abstraction focuses upon the observable behaviour of an object, whereas encapsulation focuses upon the implementation that gives rise to this behaviour. Encapsulation is often achieved through information hiding, which is the process of hiding all the secrets of an object that do not contribute to its essential characteristics, the structure of an object is hidden, as well as the implementation of its methods. Only the essential characteristics of object are visible.
Modularity is the property of a system that has been decomposed into a set of cohesive and loosely coupled modules. In other words, the act of partitioning a program into individual components is called modularity.
For example, a music band. It comprises of a piano, guitar etc. These are complete units in themselves, yet they are a subpart of the music band.
Paradigm is the organising principle of a program. It is an approach to programming so as to reduce complexities of programming in the rapidly changing world. Procedural progamming, object oriented programming and structural programming are all examples of paradigm.
Following are the concepts of OOPs:
i) Data Abstraction: It is a concept in which one focuses on some specific things rather than going into the details of other associated things.
ii) Data Encapsulation: It is also known as data hiding. It is the features or a concept of OOP that enables to keep the implemented details of a class hidden from the user.
iii) Inheritance: It is another important concept of OOP in which a new class is formed using already defined classes. The new class is termed, as derived class while the classes whose features are inherited is known as base class.
iv) Polymorphism: Polymorphism is a combination of two words viz. poly(=many) and morphs(=forms). Thus, polymorphism means many forms. OOPs shows the features of polymorphism in the form of function overloading. It is the feature of OOP that enables a user to deal with more than one object considering them as the same type.
v) Modularity: It means dividing the program into sub modules. It is a feature of OOP. It enables a user to reuse the program with ease.
A. defined by the user.
B. performed by the compiler.
C. is an automatic conversion.
D. a conversion without programmer intervention.
An explicit conversion is user-defined that forces an expression to be of a specific type.
A. user intervention.
B. programmer.
C. operating system.
D. compiler.
An implicit conversion is applied whenever different data types are intermixed in an expression, so as not to lose information.
A. uninitialized variable.
B. assignment statement.
C. relational operator.
D. typedef.
In dynamic initialization, assignment is a part of declaration; otherwise an uninitialized variable is declared and initialized in separate statements.
A. increment, decrement operators.
B. arithmetic operators.
C. relational operators.
D. conditional operators.
Relational refers to the relationships that values (or operands) can have with one another. Thus, the relational operators determine the relation among different operands.
A. character type.
B. assignment type.
C. arithmetic or pointer type.
D. modulus type.
The operator unary + must have arithmetic or pointer type, since it returns values of arithmetic type.
A. one operand.
B. two operands.
C. three operands.
D. four operands.
The word unary means one. Post increment operator is an example of unary operator. It takes one operand as input and processes it to give the output.
A. an uninitialized variable.
B. an assignment statement.
C. a relational operator.
D. a typedef.
In dynamic initialization, assignment is a part of declaration; otherwise an uninitialized variable is declared and initialized in separate statements using assignment operator.
A. defined by the user.
B. performed by the compiler.
C. is an automatic conversion.
D. a conversion without programmer intervention.
An explicit conversion is user-defined that forces an expression to be of a specific type.
A. user intervention.
B. a programmer.
C. an operating system.
D. a compiler.
An implicit conversion is applied whenever different data types are intermixed in an expression, so as not to lose information. This conversion is performed by compiler.
A. increment, decrement operators.
B. arithmetic operators.
C. relational operators.
D. conditional operators.
Relational operators refers to the relationships that values (or operands) can have with one another. Thus, the relational operators determine the relation among different operands.
A. "get from " operator.
B. variable.
C. stream extraction operator.
D. "put to" operator.
The output operator"<<" is also called "put to" or stream insertion operator.
A. arrays.
B. bytes.
C. octal numbers.
D. hexadecimal numbers.
At the lowest implementation level files are treated as streams of bytes. I/O library manages transfer of these bytes.
A. class.
B. stream.
C. header file.
D. Function.
C++ use header files denoted with extention (.h). These files allow programmers to separate certain elements of a program's source code into reusable files.
A. compiler.
B. preprocessor.
C. interpreter.
D. classes.
Statements that begin with # are processed before compilation takes place.
A. last.
B. first.
C. after multiplication and division.
D. before addition and subtraction.
The operators in parenthesis are performed first because there precedence is higher.
A. two operands.
B. no operand.
C. one operand.
D. none of the above.
Unary means one. These operators require one operand to operate.
A. enclosed in double quotes.
B. enclosed in single quotes.
C. enclosed in brackets.
D. none of the above.