Monday 10 March 2014

OBJECT ORIENTED PROGRAMMING MCQS

1) ONE SUB CLASS IS DRIVED BY TWO BASE CLASS CALLED:
 A.    SIMPLE INHERITANCE
 B.    MULTIPLE INHERITANCE
 C.     MULTILEVEL INHERITANCE
 D.     HYBRID INHERITANCE
 Ans:-C


2) Runtime polymorphism is achieved by
 A.    Friend function
 B.    Virtual function
 C.     Operator overloading
 D.     Function overloading
Ans:-B

3) The polymorphism can be characterized by the phrase
 A.    One interface,multiple methods
 B.    Multiple interfaces,one method
 C.     One interface,one method
 D.     None of the above
Ans:- A

4) The operator that cannot be overloaded is
 A.    ++
 B.    : :
 C.     ~
 D.     ( )
Ans:-B

5) If an array is declared as int a[4] = {3, 0, 1, 2}, then values assigned to a[0] & a[4] will be
 A.    3, 2
 B.    0, 2
 C.     3, 0
 D.     0, 4
Ans:-C

6) When a sub class is inherited from only one super class .It is known as
 A.    Single inheritance
 B.    Multiple inheritance
 C.     Hierarchical inheritance
 D.     Multilevel inheritance
Ans:- A

7) The address of a variable temp of type float is
 A.    *temp
 B.    &temp
 C.     float& temp
 D.     float temp&
Ans:-B

8) Data members which are static
 A.    Cannot be assigned a value
 B.    Can only be used in static functions
 C.     Cannot be defined in a Union
 D.     Can be accessed outside the class
Ans:- B

9) Usually a pure virtual function
 A.    Has complete function body
 B.    Will never be called
 C.     Will be called only to delete an object
 D.     Is defined only in derived class
Ans:- D

10) A friend function has access to all private and protected members of the class for which it is a friend
 A.    Only private
 B.    Private and protected
 C.     Only protected
 D.     None of the above
Ans:-  B

11) The members of a class, by default, are
 A.    Public
 B.    Protected
 C.     Private
 D.     Mandatory to specify
Ans:-   C

12) A template class
 A.    Is designed to be stored in different containers
 B.    Works with different data types
 C.     Generates objects which must be identical
 D.     Generates classes with different numbers of member functions
Ans:-  B

13) In C++, dynamic memory allocation is accomplished with the operator ____
 A.    new
 B.    this
 C.     malloc( )
 D.     delete
Ans:- A

14) The process of building new classes from existing one is called ______.
 A.    Polymorphism
 B.    Structure
 C.     Inheritance
 D.     Cascading
Ans:- C

15) Which of the following operator can be overloaded through friend function?
 A.    ->
 B.    =
 C.     ( )
 D.     *
Ans:- D

16) A pointer to the base class can hold address of
 A.    Only base class object
 B.    Only derived class object
 C.     Base class object as well as derived class object
 D.     None of the above
Ans:-   C

17) A static data member is given a value
 A.    Within the class definition
 B.    Outside the class definition
 C.     When the program is exeuted
 D.     Never
Ans:-D

18) Which of the following is false for cin?
 A.    It represents standard input
 B.    It is an object of istream class.
 C.     It is a class of which stream is an object
 D.     Using cin the data can be read from user’s terminal
Ans:-C

19) Pure virtual functions
 A.    Have to be redefined in the inherited class
 B.    Cannot have public access specification
 C.     Are mandatory for a virtual class
 D.     None of the above
Ans:- A

20) Exception handling is targeted at
 A.    Run-time error
 B.    Compile time error
 C.     Logical error
 D.     All of the above
Ans:-A

No comments:

Post a Comment