Q) The OOPs concept in C++, exposing only necessary information to users or
clients is known as
A. Abstraction
B. Encapsulation
C. Data hiding
D. Hiding complexity
Answer: A
Q) Which of the following is an abstract data type?
A. Class
B. Int
C. String
D. Double
Answer: A
Q) Hiding the complexity is known as
A. Abstraction
B. Encapsulation
C. Data hiding
D. Composition
Answer: B
Q) For Cat and Animal class, correct way of inheritance is
A. class Cat: public Animal
B. class Animal: public Cat
C. Both are correct way
D. None is correct way
Answer: A
) In a class, encapsulating an object of another class is called
A. Composition
B. Inheritance
C. Encapsulation
D. None
Answer: A
Q) Features not available in C++ object oriented programming is
A. Virtual destructor
B. Virtual constructor
C. Virtual function
D. All
Answer: B
Q) IS A relationship in C++ is
A. Inheritance
B. Encapsulation
C. Composition
D. None
Answer: A
Q) If you want to write multiple functions in a class with same name, then what
C++ feature will you use?
A. Function overriding
B. Encapsulation
C. Function overloading
D. None
Answer: C
Q) Polymorphism types is/are
A. Compile time
B. Run time
C. Both
D. None
Answer: C
Q) If I want to have common functions in a class and want to defer
implementations of some other functions to derived classes, then we need to use
A. An interface
B. An abstract class
C. A friend class
D. A static class
Answer: B
Q) Not using virtual destructor feature in a C++ object oriented programing can
cause
A. Memory leak
B. An Issue in creating object of the class
C. An issue in calling base class destructor
D. Nothing
Answer: A
Q) Which C++ oops feature is related to re-usability?
A. Encapsulation
B. Inheritance
C. Abstraction
D. None
Answer: A
A constructor that accepts __________ parameters is called the default constructor.
A. one
B. two
C. no
Three
D.
Option C
2. What happens when a class with parameterized constructors and having no default constructor
is used in a program and we create an object that needs a zero-argument constructor?
A. Compile-time error.
B. Preprocessing error.
C. Runtime error.
D. Runtime exception. Option A
3. Can a class have virtual destructor?
A. Yes
B. No Option A
4. Destructor has the same name as the constructor and it is preceded by ______ .
A. !
B. ?
C. ~
D. $
Option C
5. For automatic objects, constructors and destructors are called each time the objects
A. enter and leave scope
B. inherit parent class
C. are constructed
D. are destroyed
Option A