Tuesday, January 12, 2010

c++ Operator Overloading and Inheritance

 Operator Overloading and Inheritance

One mark questions:

1) ________ are those that have been redefined within a C++ class.
a) Method Overloading b) Operator Overloading c) Both a & b d) None

2) The internal call to an object ss++ will be made as _______
a) ss. operator++( ) b) ss. operator++(0) c) ss. operator++(1) d) None

3) _______ is a special pointer that points to the current object.
a) This b) new c) Both d) None

4) To prevent the member wise copy, it is necessary to provide the ______.
a) Copy Constructor b) Constructor c) Operator Constructor d) None

5) ______ provides explicit conversion between datatypes.
a) Conversion b) Casting c) Both d) None

6) Operator int( ) is said to be ___________.
a) Conversion Function b) Casting Function c) Both d) None

7) To convert from basic to Object we use ______ in the class.
a) Conversion Function b) Constructor c) Both d) None

8) To convert from Object to basic we use ______ in the class.
a) Conversion Function b) Constructor c) Both d) None

9) Functions with same name but differing in their signatures is said to be ____.
a) Operator Overloading b) Function Overloading c) Both d) None

10) The process of creating new classes from already existing classes is said to be ____.
a) Inheritance b) Polymorphism c) Exceptions d) None

11) The access specifiers used while inheriting is used for ________.
determining availability of base class members to derived class
determining availability of derived class members to base class
determining availability of base class members to subclass class
determining availability of super class members to derived class

12. A member function in the base class can be used by the objects of the derived class ,this is
said to be __________.
a. Accessibility b. Reusability c. Both a & b d. None

13. ___ member can be accessed by the classes derived from the base class.
a. private b. public c. protected d. None

14. ______ inheritance does not change the specifiers of base class members.
a. private b. public c. protected d. None

15. ______ inheritance changes the specifiers of base class members to private of derived class.
a. private b. public c. protected d. None

16. ______ inheritance changes the specifiers of base class members to protected of derived class.
a. private b. public c. protected d. None

17. We cannot create an instance of _________ classes
a. virtual b. abstract c. protected d. None

18. A class derived from more than one class is said to be _______.
a. Multilevel b. Hierarchical c. multiple d. Both b & c

19.Inheritance is ________ relationship.
a. kind- of b. has a c. Both d. None

20.containership is ________ relationship.
a. kind- of b. has a c. Both d. None



Answers
One mark
1. b 11.a
2. b 12.a
3. a 13.c .
4.a 14.b
5.b 15.a
6.a 16.c
7.b 17.b
8.a 18.c
9.b 19.a
10.a 20.b