set-3
101. Why do we use a destructor in C++?
To destroy an object when the lifetime of the object ends
To create an object when the object needs to be created
To initialize the data members of an object when it is created
None of the Above
102. A destructor is preceded by:
/
|
?
~
103. Which of the following statements is correct?
A constructor has the same name as that of the class
A destructor has the same name as that of the class with a tilde symbol at the beginning.
A constructor is a member function of the class
All of the Above
104. When an object goes out of scope, which of the following gets called?
Constructor
Destructor
Main
Void
105. Which of the following can be declared as virtual?
Destructor
Constructor
Data Members
All of the Above
106. The constructor that either has no parameters, or if it has parameters, all the parameters have default values:
Default
Copy
Parameterized
Friend function
107. Per class, how many default constructors are possible?
1
2
3
4
108. A destructor takes how many arguments?
0
1
2
3
109. How many times is a constructor called in the lifetime of an object?
Only once
3
2
None of the Above
110. The area where the local variables are stored is called:
Heap
Stack
Free Memory
Cache
111. What is the return type of malloc()?
Char*
Int *
Void *
Void **
112. Which of the following obtains a block of memory dynamically?
Malloc
Calloc
Free
Both A & B
113. Which of the following operators is used to release the dynamically allocated memory in C++?
New
Delete
Free
Remove
114. Which of the following is used to free the allocated memory for an object in C++?
Free
Delete
Release
Either delete or free
115. Which of the following is correct?
The 'this' pointer is accessible within all the member functions of the class
The 'this' pointer is accessible only within functions returning void
The 'this' pointer is accessible only within non-static functions
The 'this' pointer is accessible within the member functions with zero arguments
116. The 'this' pointer can be used to:
Guard against any kind of reference
Guard against self-reference
Guard from other pointers
Guard from parameter referencing
117. The 'this' pointer is:
Modifiable
Non-Modifiable
Are made variables
None of the Above
118. Which of the following are types of 'this' pointer?
Const
Volatile
Both A & B
Int
119. The static member functions have access to:
All the members of a class
Only constant members of a class
Only the static members of a class
All other class members also
120. The static members are:
Created and initialized only once
Created and initialized twice
Created when necessary
All of the Above
121. Which of the following is correct?
The static data member can’t be mutable
If static data members are made inline, those can be initialized within the class
We can use the static member functions and static data members even if the class object is not created
All of the Above
122. The keyword 'friend' is placed only in the:
Function Declaration
Function Definition
Main Function
Void Function
123. Which of the following is correct?
Friend functions can be invoked as a normal function
Friend functions cannot access the members of the class directly
Friend functions can be private or public
All of the Above
124. The syntax of a friend function is:
Friend class;
Friend class
Friend class1, class2
All of the Above
125. A binary operator performs its action on:
A single operand
Two operands
Three operands
Any number of operands
126. Which of the following is a unary operator?
&
==
/
127. Which of the following is a binary operator?
&
==
/
All of the Above
128. Which is called the ternary operator?
?:
&&
||
===
129. C-style type casting is also known as:
Cast notation
Type casting
Function notation
C notation
130. There are three major ways in which we can use explicit conversion in C++:
2
3
4
5
131. How many parameters does a conversion operator may take?
0
1
2
3
132. What type of operator is a cast operator?
Unary
Binary
Ternary
None of the Above
133. The compiler carries out which type of casting?
Implicit
Explicit
Ex-Implicit
All of the Above
134. The programmer initiates which type of casting?
Implicit
Explicit
Ex-Implicit
All of the Above
135. How many types of inheritance are there in C++?
3
4
5
6
136. Single-level inheritance is:
A class inheriting a derived class
A class inheriting a base class
A class inheriting a nested class
A class which gets inherited by 2 classes
137. Multiple Inheritance is not supported by:
JAVA
C++
C
JAVA and Smalltalk
138. The feature of multiple inheritance in JAVA is done through:
Interfaces Concept
Diamond Problem
Reusability concept
None of the Above
139. The diamond problem is associated with:
Single
Multiple
Multi-Level
Hierarchical
140. Which constructor is called first if a derived class object is created?
Base Class Constructor
Copy Constructor
Default
Not possible
141. In a single program, how many types of inheritance can be used?
2
3
4
Any type, any number of times
142. If we use single inheritance, then the program will contain how many classes?
At least 2
3
4
At most 4
143. Which constructor will be called first from the classes involved in single inheritance from the object of the derived class?
Base class constructor
Derived class constructor
Both class constructors at a time
Runtime error
144. Multilevel inheritance is:
A class derived from another derived class
Classes being derived from other derived classes
Continuing single-level inheritance
A class which has more than one parent
145. The minimum number of levels for implementing multilevel inheritance is:
1
2
3
4
146. In multilevel inheritance, one class inherits:
1 class
2 classes
3 classes
4 classes
147. In multilevel inheritance, which is the most significant feature of OOP used?
Code readability
Flexibility
Code reusability
All of the Above
148. Multiple inheritance is defined as:
A class is derived from another class
A class is derived from two or more classes
When a class is derived from other two derived classes
When a class is derived from exactly one class
149. To implement multiple inheritance, at least how many classes should a program contain?
1
2
3
4
Last updated