You are on page 1of 3

1.

Reusability is a desirable feature of a language as it

A. decreases the testing time

B. lowers the maintenance cost

C. reduces the compilation time

D. Both (a) and (b)

E. None of the above

2. Which of the following operators cannot be overloaded?


A. >>
B. ?:
C. . (dot)
D. Both (b) and (c)
E. All of the above

3. The fields in a structure of a C program are by default


A. protected
B. public
C. private
D. none of the above

4. Forgetting to include a file (like math.h, conio.h) that is necessary will result in
A. compilation error
B. warning when the program is run
C. error at link time
D. warning when the program is compiled

5. Which of the following cannot be declared static?


A. Class
B. Object
C. Functions
D. Both (a) & (b)
E. None of these

6. A default catch block catches


A. all thrown objects
B. no thrown objects
C. any thrown object that has not been caught by an earlier catch block
D. all thrown objects that have been caught by an earlier catch block

7. The use of the break statement in a switch statement is


A. optional
B. compulsory
C. not allowed. It gives an error message
D. to check an error
E. None of the above
8. Which is private member functions access scope?
a) Member functions which can only be used within the class
b) Member functions which can used outside the class
c) Member functions which are accessible in derived class
d) Member functions which can’t be accessed inside the class

9. Which among the following is true?


a) The private members can’t be accessed by public members of the class
b) The private members can be accessed by public members of the class
c) The private members can be accessed only by the private members of the class
d) The private members can’t be accessed by the protected members of the class

10. Which member can never be accessed by inherited classes?


a) Private member function
b) Public member function
c) Protected member function
d) All can be accessed

11. How many private member functions are allowed in a class?


a) Only 1
b) Only 7
c) Only 255
d) As many as required

12. How to access a private member function of a class?


a) Using object of class
b) Using object pointer
c) Using address of member function
d) Using class address

13. Features not available in C++ object oriented programming is


a) Virtual destructor
b) Virtual constructor
c) Virtual function
d) All

14. A static data member is given a value


A. within the class definition
B. outside the class definition
C. when the program is executed
D. never

15. If a derived class uses the public access specifier, then _____
A. public base class members remain public in the derived class
B. protected base class members become public in the derived class
C. both (a) and (b)
D. neither (a) nor (b)

16. Which of the following while clause will stop the loop when the value in the age variable is less than
the number 0?
A. while age < 0
B. while (age < 0)
C. while age >= 0;
D. while (age >= 0);
E. while (age >= 0)

17. You separate a derived class name from its access specifier with
A. a colon
B. two colons
C. at least one space
D. a semicolon

18. Virtual function is ______ class function which expected to be redefined in ______ class, so that
when reference is made to derived class object using pointer then we can call virtual function to
execute ________ class definition version.
a) Base, derived, derived
b) Derived, Derived, Derived
c) Base, derived, base
d) Base, base, derived

19. Virtual functions are mainly used to achieve _____________


a) Compile time polymorphism
b) Interpreter polymorphism
c) Runtime polymorphism
d) Functions code polymorphism

20. Which among the following is true?


a) A class may have virtual destructor but not virtual constructor
b) A class may have virtual constructor but not virtual destructor
c) A class may have virtual constructor and virtual constructor
d) A class may have either virtual destructor or virtual constructor

You might also like