215
92.6k

200+ Object Oriented Programming with C++ (OOP in C++) Solved MCQs

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Bachelor of Computer Applications (BCA) , Programming Languages .

151.

A __________ is a constructor that either has no parameters, or if it has parameters, all the parameters have default values.

A. default constructor
B. copy constructor
C. Both A and B
D. None of these
Answer» A. default constructor
152.

How many default constructors per class are possible?

A. Only one
B. Two
C. Three
D. Unlimited
Answer» A. Only one
153.

Which of the following statement is correct?

A. A constructor has the same name as the class in which it is present.
B. A constructor has a different name than the class in which it is present.
C. A constructor always returns an integer.
D. A constructor cannot be overloaded.
Answer» A. A constructor has the same name as the class in which it is present.
154.

A destructor takes __________ arguments.

A. one
B. two
C. three
D. no
Answer» D. no
155.

Destructor calls are made in which order of the corresponding constructor calls?

A. Reverse order
B. Forward order
C. Depends on how the object is constructed
D. Depends on how many objects are constructed
Answer» A. Reverse order
156.

Which of the following never requires any arguments?

A. Member function
B. Friend function
C. Default constructor
D. const function
Answer» C. Default constructor
157.

A class's __________ is called when an object is destroyed.

A. constructor
B. destructor
C. assignment function
D. copy constructor
Answer» B. destructor
158.

How many times a constructor is called in the life‐time of an object?

A. Only once
B. Twice
C. Thrice
D. Depends on the way of creation of object
Answer» A. Only once
159.

To ensure that every object in the array receives a destructor call, always delete memory allocated as an array with operator __________ .

A. destructor
B. New[]
C. delete[]
D. Free()
Answer» C. delete[]
160.

Which of the following statement is correct whenever an object goes out of scope?

A. The default constructor of the object is called.
B. The parameterized destructor is called.
C. The default destructor of the object is called.
D. None of the above.
Answer» C. The default destructor of the object is called.
161.

Which allows you to create a derived class that inherits properties from more than one base class?

A. Multilevel inheritance
B. Multiple inheritance
C. Hybrid Inheritance
D. Hierarchical Inheritanc
Answer» B. Multiple inheritance
162.

Which feature in OOP allows reusing code?

A. Polymorphism
B. Inheritance
C. Encapsulation
D. Data hiding
Answer» B. Inheritance
163.

The mechanism of deriving a new class from another class

A. Polymorphism
B. Inheritance
C. Encapsulation
D. Data hiding
Answer» B. Inheritance
164.

A derived class with only one base class

A. Multilevel inheritance
B. Multiple inheritance
C. Single inheritance
D. Hierarchical Inheritance
Answer» C. Single inheritance
165.

The mechanism of deriving one base class with more than one derived classes

A. Multilevel inheritance
B. Multiple inheritance
C. Hybrid Inheritance
D. Hierarchical Inheritance
Answer» D. Hierarchical Inheritance
166.

The duplication of inherited members due to the multiple paths can be avoided by making a common base class is called

A. Abstract class
B. Virtual base class
C. Multiple inheritance
D. Nesting of classes
Answer» B. Virtual base class
167.

The class that is not used to create object

A. Abstract class
B. Virtual base class
C. Multiple inheritance
D. Nesting of classes
Answer» A. Abstract class
168.

The mechanism of giving special meaning to an operator

A. Operator overloading
B. Function overloading
C. Constructor overloading
D. Virtual function
Answer» A. Operator overloading
169.

The operators can’t be overloaded

A. Binary operators
B. Unary operators
C. Ternary operator
D. None
Answer» C. Ternary operator
170.

Which of the following is not correct

A. Only existing operator can be overloaded
B. The overloaded operator must have at least one operand
C. We can change the basic meaning of the operator
D. Overloaded operators follow the syntax rule of original operator
Answer» C. We can change the basic meaning of the operator
171.

The operator we cannot use friend function

A. ?
B. Sizeof
C. ::
D. []
Answer» D. []
172.

A friend function for unary operator overloading takes ‐‐‐‐ ‐arguments.

A. Zero
B. One
C. Two
D. None
Answer» B. One
173.

A member function for unary operator overloading takes‐‐‐‐ ‐arguments.

A. Zero
B. One
C. Two
D. None
Answer» A. Zero
174.

A friend function for binary operator overloading takes‐‐‐‐ ‐arguments.

A. Zero
B. One
C. Two
D. None
Answer» C. Two
175.

The variable that contains the address of constant or variable

A. Function
B. Array
C. pointer
D. structure
Answer» C. pointer
176.

The indirect operator is

A. &
B. *
C. ::
D. :?
Answer» B. *
177.

The memory management operator in c++

A. new &delete
B. malloc
C. calloc
D. free
Answer» A. new &delete
178.

The pointer refers to an object that has called the member function currently

A. this
B. address
C. virtual function
D. none
Answer» A. this
179.

Conversion of data type is called

A. self referencing
B. type casting
C. virtual function
D. abstract class
Answer» B. type casting
180.

The function that act as an interface to base & derived class

A. function overloading
B. virtual function
C. constructor
D. friend
Answer» B. virtual function
181.

The keyword to convert constant into variable

A. Const_cast
B. reinterpret_cast
C. static_cast
D. implicit
Answer» A. Const_cast
182.

The keyword to convert pointer into non pointer & non pointer into pointer

A. Const_cast
B. reinterpret_cast
C. static_cast
D. implicit
Answer» B. reinterpret_cast
183.

Treating the address of the object of the derived class as the address of the base class means

A. Up casting
B. down casting
C. early binding
D. late binding
Answer» A. Up casting
184.

The empty virtual function are called

A. pure /donothing
B. virtual table
C. polymorphism
D. virtual base class
Answer» A. pure /donothing
185.

A stream of byte that is the interface between IO and IO devices

A. Streams
B. class
C. object
D. file
Answer» A. Streams
186.

The class that derived from standard library ios contain input functions

A. Ios
B. iostream
C. istream
D. ostream
Answer» C. istream
187.

The class that derived from standard library ios contain output functions

A. Ios
B. iostream
C. istream
D. ostream
Answer» D. ostream
188.

Which function is in the ostream class

A. get()
B. read()
C. write
D. cin
Answer» C. write
189.

Which function is in the istream class

A. get()
B. put()
C. write
D. cout
Answer» A. get()
190.

The standard library inherited from istream & ostream

A. Ios
B. iostream
C. ifstream
D. ofstream
Answer» B. iostream
191.

The function used to receive one character at a time

A. get()
B. put()
C. getline()
D. write()
Answer» A. get()
192.

The function used to disply one character at a time

A. get()
B. put()
C. getline()
D. write()
Answer» B. put()
193.

The function used to receive one line at a time

A. get()
B. put()
C. getline()
D. write()
Answer» C. getline()
194.

The function used to display one line at a time

A. get()
B. put()
C. getline()
D. write()
Answer» D. write()
195.

The function contain in the ios class to set width

A. width()
B. precision()
C. fill()
D. setf()
Answer» A. width()
196.

The function contain in the class iomanip to set width

A. setw()
B. set precision()
C. set fill()
D. setiosflags()
Answer» A. setw()
197.

The function contain in the class iomanip to fill characters in the un used space

A. setw()
B. set precision()
C. set fill()
D. setiosflags()
Answer» C. set fill()
198.

The function contain in the ios class to fill characters in the blank space

A. width()
B. precision()
C. fill()
D. setf()
Answer» C. fill()
199.

The function contain in the ios class to specify number of decimal places

A. width()
B. precision()
C. fill()
D. setf()
Answer» B. precision()
200.

The function contain in the ios class to set flags

A. width()
B. precision()
C. fill()
D. setf()
Answer» D. setf()

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.