1. Which of the following class allows to declare only one object of it?
A. Abstract class
B. Virtual class
C. Singleton class
D. Friend class
Explanation:
Singleton class allows the programmer to declare only one object of it, If one tries to declare more than one object the program results into error.
2. Which of the following approach is used by C++?
A. Top-down
B. Bottom-up
C. Left-right
D. Right-left
Explanation:
C++ is an object-oriented language and OOL uses a bottom-up approach to solve/view a problem.
3. Which of the following is not a type of Constructor?
A. Friend constructor
B. Copy constructor
C. Default constructor
D. Parameterized constructor
Explanation:
Friend function is not a constructor whereas others are a type of constructor used for object initialization.
4. Which of the following explains the overloading of functions?
A. Virtual polymorphism
B. Transient polymorphism
C. Ad-hoc polymorphism
D. Pseudo polymorphism
Explanation:
Ad-hoc polymorphism is a type of polymorphism in which a function denotes heterogeneous implementation depending upon the types of argument.
5. Which of the following is correct?
A. Base class pointer object cannot point to a derived class object
B. Derived class pointer object cannot point to a base class object
C. A derived class cannot have pointer objects
D. A base class cannot have pointer objects
Explanation:
C++ does not allow a derived class pointer to point a base class pointer whereas Base class can point to a derived class object. Both base class and derived class can have pointer objects.
6. Which concept means the addition of new components to a program as it runs?
A. Which concept means the addition of new components to a program as it runs?
B. Dynamic binding
C. Dynamic loading
D. Dynamic typing
Explanation:
Dynamic loading is the concept of adding new components to a program as it runs.
7. Out of the following, which is not a member of the class?
A. Static function
B. Friend function
C. Constant function
D. Virtual function
Explanation:
Friend function is not a member of the class. They are given the same access rights as the class member function have but they are not actual members of the class.
8. Which of the following is an abstract data type?
A. int
B. float
C. class
D. string
Explanation:
Class is used as an abstract data type as it can be used to give implementation independent view whereas no other data type can be used to provide this.
9. What is the other name used for functions inside a class?
A. Member variables
B. Member functions
C. Class functions
D. Class variables
Explanation:
Functions of a class are also known as member functions of a class.
10. How compile-time polymorphisms are implemented in C++?
A. Using Inheritance
B. Using Virtual functions
C. Using Templates
D. Using Inheritance and Virtual functions
Explanation:
Compile-time polymorphism is implemented using templates in which the types(which can be checked during compile-time) are used decides which function to be called.
11. Which of the following cannot be a friend?
A. Function
B. Class
C. Object
D. Operator function
Explanation:
Objects of any class cannot be made a friend of any other or same class whereas functions, classes and operator functions can be made a friend.
12. How run-time polymorphisms are implemented in C++?
A. Using Inheritance
B. Using Virtual functions
C. Using Templates
D. Using Inheritance and Virtual functions
Explanation:
Run-time polymorphism is implemented using Inheritance and virtual in which object decides which function to call.