Question 1
Which part of an object exhibits its state?
A. Operations
B. Any public part
C. Any private part
D. Data
Correct Answer: D
Question 2
Inheritance is a way to
A. organize data
B. pass arguments to objects of classes
C. add features to existing classes without rewriting them
D. improve data-hiding and encapsulation
Correct Answer: C
Question 3
Suppose a class Person already contains name, age, address and sex. When designing a Patient class derived from Person, which should be included?
A. registration date and diagnosis
B. age and sex
C. sex and diagnosis
D. diagnosis and age
Correct Answer: A
Question 4
What problem(s) may occur when we copy objects without using a deep copy constructor?
A. Dangling pointer
B. Memory leakage
C. System crash
D. All of the given
Correct Answer: D
Question 5
This pointer is not accessible for static member functions.
A. True
B. False
Correct Answer: A
Question 6
A static member function cannot be declared:
A. Static
B. Implicit
C. Explicit
D. Virtual
Correct Answer: D
Question 7
Which remain in memory even when all objects of a class have been destroyed?
A. Static variables
B. Instance variables
C. Primitive variables
D. None of the given
Correct Answer: A
Question 8
Friend functions are ______ functions of a class.
A. Object member
B. Data member
C. Non-member
D. None of given
Correct Answer: C
Question 9
If class A declares B as its friend, it means B can access A’s private data but not vice versa. This concept is called:
A. Friendship is one way only
B. Friendship is two way only
C. No friendship between classes
D. Any kind of friendship
Correct Answer: A
Question 10
The statement objA = objB; will cause a compiler error if objects belong to different classes.
A. True
B. False
Correct Answer: A
Question 11
Which overloaded operator function declaration is correct for the call:
Rational_number_1 + 2.325
A. Rational_number operator+(Rational_number &obj)
B. Rational_number operator+(double& obj)
C. Rational_number operator+(Rational_number &obj, double& num)
D. operator+(double& obj)
Correct Answer: B
Question 12
Which operator cannot be overloaded?
A. >=
B. =
C. []
D. ?: (Conditional operator)
Correct Answer: D
Question 13
To convert from a user-defined class to a basic type, we use:
A. Built-in conversion operator
B. One argument constructor
C. Overloaded = operator
D. Conversion operator that is member of class
Correct Answer: D
Question 14
The technique in which we visualize programming problems according to real-life problems is called:
A. Structured programming
B. Object Oriented Programming
C. Procedural programming
D. None of the given
Correct Answer: B
Question 15
In object-oriented programming, a class of objects can ______ properties from another class.
A. Utilize
B. Borrow
C. Inherit
D. Adopt
Correct Answer: C
Question 16
A C++ class is similar to:
A. Structure
B. Header File
C. Library File
D. None of the given
Correct Answer: A