Tuesday, January 12, 2010

c++part8

Two mark Questions

1. Which of the following operators cannot be overloaded:
i) ++ ii) :: iii) ?: iv) . v) + vi) >>
a. ii, iii, iv b. ii, iii, iv, vi c. All d. None

2. When converting class to class we need _____ in destination class and ______ in source class
a. conversion function, constructor b. constructor, conversion function
c. nothing, conversion function d. constructor, nothing

3. Which of the following are the precautions while overloading:
i)use similar syntax
ii) Avoid ambiguity
iii) Not all operators can be overloaded
a. I only b. ii , iii c. All d. None

4. Which of the following is advantages of Inheritance:
i) Code reusability
ii) The protection is decreased
iii) We can add data and functions to class without affecting the base class.
a. I, iii b. ii, iii c. All d. None

5. The accessibility can be done by :
i) calling the base class functions in derived class
ii) substituting base class constructors
iii) substituting base class member functions
iv) Hiding the base class members
a. I,ii,iii b. ii, iii c. All d. None

6. Which of the following statements are true for method overriding:
i)Functions must have same name
ii) Functions may be in same class
iii) Functions must have same parameters
iv) Functions must be in base and derived class
a. I, iii, iv b. I, iii c. I,iv d. All

7. Which of the following statements are true for method overloading:
i)Functions must have same name
ii) Functions may be in same class
iii) Functions must have same parameters
iv) Functions must be in base and derived class
a. I, iii, iv b. I, ii c. I,iv d. All

8. Which of the following are true to prevent objects of the derived class calling the base class
function.
i) Make a dummy function in derived class of the same name and structure and give an error
message whenever called
ii) Make the derived class private
a. only I b. only ii c. Both I,ii d. None

9. Which of the following are true about abstract classes:
i) We can create an instance of this class.
ii) We cannot create an instance of this class
iii) They must contain atleast one virtual function
iv) They must contain atleast one pure virtual function
v) They are used only for deriving other classes
vi) The derived class must override all the pure virtual functions
a. ii, iv v, vi b. ii, iii, iv, v, vi c. All d. I, iii,iv,v


two marks
1. a
2. b
3. c
4.a
5.b
6.a
7.b
8.c
9.a