1. << operator is
a) stream insertion operator
b) stream extraction operator
c) left shift operator
d) None of the above
2. “H” is an example of
a) character literal
b) string literal
c) variable
d) None of the above
3. Which of the following statements regarding comments is false?
a) /*..*/
b) Comment beginning with // extends to the end of the line
c) Comments may be nested
d) Comments are used to describe a program
4. C++ is
a) Procedural programming language
b) Structural programming language
c) Object oriented programming language
d) None of the above
5. y=x=2; in C++ will result in
a) compilation error
b) runtime error
c) assignment of value to x then to y
d) None of the above
6. In C++, ………. is the statement terminator
a) semicolon
b) colon
c) new line
d) None of the above
7. Modules operator (%) has higher precedence than
a) Divide (/) operator
b) Multiply (*) operator
c) Negation (unary minus)
d) Bitwise left shift operator
8. The result of the following statement is
int y = 7;
int ans = ++y;
cout<<”ans=”<<ans;
cout<<”y”<<y;
a) ans=7, y=7
b) ans=8,y=7
c) ans=8,y=8;
d) none of the above
9. Consider the following if construct
If(x=0)
cout<<”Inside loop!”;
cout<<”Outside loop”;
The result of the above code segment is.
a) inside loop
b) outside loop
c) both (a) & (b)
d) none of the above
10. The result of 2 & 3 is
a) 2
b) 3
c) 5
d) none of the above
11. Which of the following statements regarding enumerators is false?
a) Enumeration is an alternative method for naming integer constants/
b) An enumerator value can’t be changed in a program
c) An integer value may be assigned to an enumerated variable
d) An enum defined within a structure is local to the structure
12. Which of the following statements is false?
a) typedef defines new data types
b) Using typedef does not replace the standard C++ data type name with the new name
c) The new name defined by typedef, can be used as a type for another typedef
d) None of the above
13. Data members and member functions are enclosed within
a) class
b) structure
c) union
d) None of the above
14. Inline functions are
a) Declared in the class defined outside the class
b) Defined outside the class using keyword intime
c) Defined inside the class using keyword inline
d) None of the above
15. The default class access scope is
a) Private
b) Public
c) Protected
d) None of the above
16. The default scope for a structure is
a) Private
b) Public
c) Protected
d) None of the above
17. The private data members of a class are accessible
a) Directly to objects of that class
b) Only to the member functions
c) To any function defined outside a class
d) None of the above
18. The objects can directly access
a) Public members
b) Private members
c) Both (a) & (b)
d) None of the above
19. The following is a valid statement in C++
a) int x=(int)2.50;
b) int x=int(2.50);
c) Both (a) & (b)
d) None of the above
20. Which of the following operator can be overloaded
a) Member access operator ( . & .*)
b) Conditional operator (?:)
c) Scope resolution operator (::)
d) None of the above
21. Using same function name to perform different tasks is
a) Function polymorphism
b) Runtime polymorphism
c) Function prototype
d) None of the above
22. Default argument is
a) Specified in function definition
b) Specified in function declaration
c) Specified from left to right
d) None of the above
23. What is wrong with the following statement?
float s_interest (float principal, int rate=0.25, int time);
a) variables must not be specified in function prototype
b) arguments may only be defaulted from right to left
c) the default value must be specified when making a function call
d) none of the above
24. Which of the following statements regarding function overloading is not true.
a) If is used to handle different data types at one place
b) When making a function call, if no exact match is found, promotion is the only criteria to find a match.
c) The default arguments can not be used instead of overloading
d) Unrelated functions should not be overloaded
25. The private members of a class implement the OOP concept of
a) Data abstraction
b) Data hiding
c) Message passing
d) None of the above
Post A Comment:
0 comments: