Monday 10 March 2014

OBJECT ORIENTED PROGRAMMING MCQS

1) Which of the following is not the characteristic of constructor?
 A.    They should be declared in the public section.
 B.    They do not have return type.
 C.     They can not be inherited.
 D.     They can be virtual.
 Ans:- D


2) The concept of hierarchical classification is related to
 A.    Abstraction
 B.    Inheritance
 C.     Function overloading
 D.     None
Ans:-  B

3) RunTime polymorphism is achieved by ___________
 A.    Friend function
 B.    Virtual function
 C.     Operator overloading
 D.     Function overloading
Ans:-B

4) When the compiler cannot differentiate between two overloaded constructors, they are called
 A.    Overloaded
 B.    Destructed
 C.     Ambiguous
 D.     Dubious
Ans:-C

5) If we create a file by ‘ifstream’, then the default mode of the file is _________
 A.    ios :: out
 B.    ios :: in
 C.     ios :: app
 D.     ios :: binary
Ans:- B

6) The actual source code for implementing a template function is created when
 A.    The declaration of function appears.
 B.    The function is invoked.
 C.     The definition of the function appears.
 D.     None of the above.
Ans:- B

7) 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
Ans:-C

8) An exception is caused by
 A.    A hardware problem
 B.    A problem in the operating system
 C.     A syntax error
 D.     A run-time error
Ans:-D

9) You separated a derived class name from its access specifier with
 A.    A colon
 B.    Two colons
 C.     Atleast one space
 D.     A semi colon
Ans:- B

10) When a child class function is called,the compiler looks first for a matching function name in the
 A.    Class of the object using the function name
 B.    Immediate ancestor class
 C.     Base class
 D.     Descendant class
Ans:- A

11) The process of extracting the relevant attributes of an object is known as
 A.    Polymorphism
 B.    Inheritence
 C.     Abstraction
 D.     Data hiding
Ans:-  B

12) You may override the class access specifiers
 A.    Public members
 B.    Public and protected members
 C.     Any specific class members you choose
 D.     No class members
Ans:-  C

13) The following can be declared as friend in a class
 A.    An object
 B.    A class
 C.     A public data member
 D.     A private data member
Ans:-B

14) for (; ;)
 A.    means the test which is done using some expression is always true
 B.    is not valid
 C.     will loop forever
 D.     should be written as for( )
Ans:- C

15) Which of the following will produce a value 10 if x = 9.7?
 A.    floor(x)
 B.    abs(x)
 C.     log(x)
 D.     ceil(x)
Ans:-  D

16) An object is
 A.    One instance of a class
 B.    Another word for a class
 C.     A class with static method
 D.     A method that accesses class
Ans:-  A

17) If a base class destructor is not virtual, then
 A.    It can not have a function body
 B.    It can not be called
 C.     It can not be called when accessed from pointer
 D.     Destructor in derived class can not be called when accessed through a pointer to the base class
Ans:-  D

18) Which of the statements is true in a protected derivation of a derived class from a base class?
 A.    Private members of the base class become protected members of the derived class
 B.    Protected members of the base class become public members of the derived class
 C.     Public members of the base class become protected members of the derived class
 D.     Protected derivation does not affect private and protected members of the derived class
Ans:-  C

19) If the variable count exceeds 100, a single statement that prints “Too many” is
 A.    if (count<100) cout << “Too many”;
 B.    if (count>100) cout >> “Too many”;
 C.     if (count>100) cout << “Too many”;
 D.     None of these.
Ans:-  C

20) If you wanted to sort many large objects or structures, it would be most efficient to
 A.    Place them in an array and sort the array.
 B.    Place pointers to them in an array and sort the array.
 C.     Place them in a linked list and sort the linked list.
 D.     Place references to them in an array and sort the array.
Ans:- C

No comments:

Post a Comment