set-4
150. Why does the diamond problem arise due to multiple inheritance?
Methods with the same name create ambiguity and conflict
Methods with the same name create ambiguity
The derived class gets overloaded with more than two class methods
None of the Above
151. We can overcome the diamond problem by:
Using Alias Name
Using the Virtual Keyword with the same name function
Both A & B
None of the Above
152. Which members can’t be accessed in the derived class in multiple inheritance?
Private members of the base
Public members of the base
Protected members of the base
All of the Above
153. To implement hierarchical inheritance, at least how many classes must be there?
1
2
3
4
154. Hierarchical inheritance can be a subset of:
Single
Multiple
Multi-level
Hybrid
155. Hybrid Inheritance is the:
Combination of two or more inheritance types
Combination of the same type of inheritance
Inheritance of more than 5 classes
None of the Above
156. In hybrid inheritance, which is true?
Constructor calls are in reverse
Constructor calls are priority-based
The constructor of only the derived class is called
Constructor calls are usual
157. Which of the following is correct?
Virtual functions must be members of some class, and the virtual function must be defined in the base class
Virtual functions cannot be static members.
Virtual Functions are accessed through object pointers.
All of the Above
158. Which of the following is true about pure virtual functions?
A class is abstract if it has at least one pure virtual function.
We can have pointers and references of abstract class type.
Abstract classes cannot be instantiated.
All of the Above
159. Static Binding is also called as:
Early Binding
Compile-Time Binding
Late Binding
Both A & B
160. Static Binding Happens:
At compile time
At run time
When all information needed to call a function is available at compile-time
Both A & C
161. To implement late binding, which concept is used?
Static Functions
Virtual Functions
Non-Static Functions
None of the Above
162. For achieving file handling, we need:
Naming and opening a file
Writing data and reading data into/from the file
Closing a file
All of the Above
163. Default open modes in a file are:
Ifstream, ofstream, and fstream
IfStream, ofstream, and fstream
Ifstream and ofstream
Ofstream and fstream
164. Which class is derived from the class ios?
Istream
Ostream
Streambuf
Fstreambase
165. Which class declares input functions such as get(), getline(), and read()?
Ios
Istream
Ostream
Streambuf
166. Which class inherits the functions get(), getline(), read(), seekg(), and tellg()?
Ofstream
Fstreambase
Ifstream
None of the Above
167. How many types of output stream classes are there in C++?
1
2
3
4
168. Which of the following are built-in functions to handle file errors?
Int bad()
Int fail()
Int good()
All of the Above
169. Which of the following returns a non-zero (true) value when an input or output operation has failed?
Int bad()
Int fail()
Int good()
Int eof()
170. Which of the following returns a non-zero (true) value when no error has occurred?
Int bad()
Int fail()
Int good()
Int eof()
171. Which of the following returns a non-zero (true) value if an invalid operation is attempted or an unrecoverable error has occurred?
Int bad()
Int fail()
Int good()
Int eof()
172. Which of the following returns a non-zero (true) value when the end-of-file is encountered while reading?
Int bad()
Int fail()
Int good()
Int eof()
173. Which of the following is true?
All the built-in functions return either non-zero to indicate true or zero to indicate false.
eof() returns true if eofbit is set
The good() returns true if there are no errors
All of the Above
174. Which of the following is true about manipulators?
Used to make up the program structure
Are special stream functions that change certain formats and characteristics of the input and output
To carry out the operations of the manipulators, <iomanip.h> must be included.
All of the Above
175. Which of the following are Integer Manipulators?
Hex, oct, dec
Fixed, scientific
Hex, Fixed, and Scientific
Dec, Fixed, and Scientific
176. Which of the following are float manipulators?
Hex, oct, dec
Fixed, scientific
Hex, Fixed, and Scientific
Dec, Fixed, and Scientific
177. Which of the following is not a manipulator?
Base
Ends
Oct
Skipws
178. Which of the following header files is used for manipulators?
Iomanipulator.h
Sidiomanip.h
iomanip.h
None of the Above
179. ______ functions allow supplying input or displaying output in the user's desired format.
Formatted I/O
Unformatted I/O
Scattered I/O
None of the Above
180. ______ functions are the most basic form of input and output, and they do not allow supplying input or displaying output in the user's desired format.
Formatted I/O
Unformatted I/O
Scattered I/O
None of the Above
181. Printf() and scanf() are examples of ______.
Formatted I/O
Unformatted I/O
Scattered I/O
None of the Above
182. Getch(), getche(), getchar(), gets(), puts(), putchar(), etc. are examples of ______.
Formatted I/O
Unformatted I/O
Scattered I/O
None of the Above
183. ______ contain format specifiers in their syntax.
Formatted I/O
Unformatted I/O
Scattered I/O
None of the Above
184. ______ do not contain format specifiers in their syntax.
Formatted I/O
Unformatted I/O
Scattered I/O
None of the Above
185. Consider an example and determine which Input/Output function this example belongs to:
Formatted I/O
Unformatted I/O
Scattered I/O
None of the Above
186. The iomanip.h and iostream.h header files are used to perform the ______ operations in C++.
A. Formatted I/O B. Unformatted I/O C. Scattered I/O D. None of the Above
187. In C++, ______ is one of the ways to perform the formatted I/O operations.
A. Using the member functions of the ios class. B. Using the special functions called manipulators defined in iomanip.h. C. Both A and B D. None of the Above
188. Width(int), fill(char), precision(int) provides the details of the functions of the ios class used to perform ______ in C++.
A. Formatted I/O B. Unformatted I/O C. Scattered I/O D. None of the Above
189. The functions width(int), fill(char), precision(int) are called using the built-in object ______ in formatted I/O in OOP.
A. Cin() B. Cout() C. Printf() D. Scanf()
190. A template can be represented in how many ways?
A. 2 B. 3 C. 4 D. 5
191. The ways in which the template can be represented are:
A. Function and Class Templates B. Function and Structure Templates C. Class and Structure Templates D. None of the Above
192. Which of the following is true?
A. A generic function is created by using the keyword template B. Generic functions use the concept of a function template C. The type of the data that the function will operate on depends on the type of the data passed as a parameter D. All of the Above
193. Which of the following is correct?
A. Template classes and functions eliminate the code duplication of different data types B. Multiple parameters can be used in both class and function templates. C. Template functions can also be overloaded. D. All of the Above
194. We can restrict a function to throw certain exceptions by:
A. Defining the function with a throw clause B. Defining multiple try and catch blocks inside a function C. Both A & B D. Not possible in C++
195. What is the return type of an uncaught exception?
A. String B. Char C. Bool D. None of the Above
196. STL stands for:
A. SQL Template Library B. Standard Template Library C. Standardized Template Library D. None of the Above
197. The Standard Template Library is:
A. A set of C++ template classes to provide common programming data structures and functions B. A set of Functions C. A set of programming data structures only D. All of the Above
198. Which of the following provides a different interface for sequential containers?
A. Associative Container B. Container Adaptors C. Unordered Associative Containers D. None of the Above
199. The number of components that STL has:
A. 2 B. 3 C. 4 D. 5
200. What are containers?
A. That stores all the algorithms B. That contain overloaded functions C. That stores objects and data D. All of the Above
Last updated