1.
Which operator is overloaded for a cout object?
a) >>
b) <<
c) <
d) >
Answer: b
Explanation:
cout in C++ uses << operator to print anything so << operator is overloaded for a cout object.
2.
Which of the following cannot be used with the virtual keyword?
a) Class
b) Member functions
c) Constructors
d) Destructors
Answer: c
Explanation:
Virtual keyword cannot be used with constructors as constructors are defined to initialized an object of particular class hence no other class needs constructor of other class.
3.
Which concept is used to implement late binding?
a) Virtual functions
b) Operator functions
c) Constant functions
d) Static functions
Answer: a
Explanation:
Virtual functions are used to implement the concept of late binding i.e. binding actual functions to their calls.
4.
Which of the following is correct?
a) C++ allows static type checking
b) C++ allows dynamic type checking.
c) C++ allows static member function to be of type const.
d) C++ allows both static and dynamic type checking
Answer: d
Explanation:
C++ allows both static and dynamic type checking i.e. types are checked by the compiler.
5.
Which of the following supports the concept that reusability is a desirable feature of a language?
a) It reduces the testing time
b) It reduces maintenance cost
c) It decreases the compilation time
d) It reduced both testing and maintenance time
Answer: d
Explanation:
As we will be using the existing code therefore we don’t need to check the code again and again so testing and maintenance time decreases but the compiler time may increase or remains same because though we are reusing the code but every part needs to be compiled and extra include statement needs to be executed therefore compilation time may remain same or increases.