MCQ Bank
Which class has at least one pure virtual function?
- A) Concrete class
- B) Template class
- C) Child class
- D) Abstract class
In case of public inheritance, protected members of base class will be _____________ in derived class.
- A) protected
- B) public
- C) hidden
- D) private
Which statement will be true for concrete class?
- A) None of given options.
- B) It can be instantiated.
- C) It cannot be inherited from an abstract class.
- D) It cannot be instantiated.
If a class is inherited using private inheritance, what happens to public members of the base class?
- A) Become inaccessible
- B) Become protected
- C) Remain public
- D) Become private
<p>Consider the code below:</p> <p>class class1</p> <p>{</p> <p> private: int i;</p> <p>};</p> <p>class class2 : protected class1</p> <p>{ };</p> <p>Then int member i of class1 is ______ in class2.</p>
- A) <p>static</p>
- B) <p>protected</p>
- C) <p>public</p>
- D) <p>private</p>
Which of the following operators operate on one operand?
- A) Unary Operators
- B) Binary Operators
- C) Ternary Operator
- D) Assignment Operator
Target class of a _______ function call is determined at run time.
- A) Virtual
- B) Non- Virtual
- C) Operator
- D) Instance
If we have not given any constructor for the class, compiler generates which of the following constructors?
- A) Implicit Default Constructor
- B) Implicit Parameterized Constructor
- C) Explicit Default Constructor
- D) Explicit Parameterized Constructor
Which of the following is correct code to instantiate the object of given template Vector class for int type? template <class T> class Vector { };
- A) Vector obj<>int;
- B) Vector <int> obj;
- C) Vector obj <int>;
- D) Vector int obj;