Explore topic-wise MCQs in C++ Programming.

This section includes 77 Mcqs, each offering curated multiple-choice questions to sharpen your C++ Programming knowledge and support exam preparation. Choose a topic below to get started.

51.

What do you mean by No exception specification ?

A. It can catch anything
B. It throws nothing
C. It can throw anything
D. All of above
E. None of these
Answer» D. All of above
52.

What will happen if an exception that is thrown may cause a whole load of objects to go out of scope?

A. Produce a runtime error
B. It will be added to the overhead
C. Terminate the program
D. All of above
E. None of these
Answer» C. Terminate the program
53.

What will happen when we move to try block far away from catch block?

A. Increases the amount of code in cache
B. Don t alter anything
C. Reduces the amount of code in cache
D. All of above
E. None of these
Answer» D. All of above
54.

Why is it expensive to use objects for the exception?

A. Because of execution time
B. Memory space involved in creating an exception object
C. Exception object is created only if an error actually happens
D. All of above
E. None of these
Answer» D. All of above
55.

What are the disadvantages if use return keyword to return error codes?

A. The code becomes more difficult to read
B. Your code size increases dramatically
C. You have to handle all exceptional cases explicitly
D. All of above
E. None of these
Answer» E. None of these
56.

Which alternative can replace the throw statement?

A. exit
B. break
C. for
D. return
E. None of these
Answer» E. None of these
57.

How many levels are there in exception safety?

A. 4
B. 3
C. 2
D. 1
E. None of these
Answer» C. 2
58.

How many types of standard exception are there in c++?

A. 5
B. 6
C. 7
D. 8
E. 9
Answer» F.
59.

Where are standard exception classes grouped?

A. catch
B. error
C. namespace std
D. All of above
E. None of these
Answer» D. All of above
60.

Which header file is used to declare the standard exception?

A. #include <error>
B. #include <exception>
C. #include <except>
D. All of above
E. None of these
Answer» C. #include <except>
61.

Pick out the correct statement for error handling alternatives.

A. Exit from the block
B. Terminate the program
C. Use the stack
D. All of above
E. None of these
Answer» D. All of above
62.

What is the main purpose of the constructor?

A. Include the macros for the program
B. Establish the class invariant
C. Begin the execution of class
D. All of above
E. None of these
Answer» C. Begin the execution of class
63.

Which block should be placed after try block?

A. Throws
B. catch
C. throw
D. either catch or throw
E. None of these
Answer» C. throw
64.

What will not be called when the terminate() is raised in the constructor?

A. destructor
B. main()
C. class
D. All of above
E. None of these
Answer» B. main()
65.

What function will be called when we have an uncaught exception?

A. throw
B. terminate
C. catch
D. All of above
E. None of these
Answer» C. catch
66.

What kind of exceptions are available in c++?

A. dynamic
B. handled
C. unhandled
D. static
E. None of these
Answer» D. static
67.

How many runtime error messages associated with exception?

A. infinite
B. 5
C. 4
D. 2
E. None of these
Answer» D. 2
68.

How many types of exception handling are there in c++?

A. 4
B. 3
C. 2
D. 1
E. None of these
Answer» C. 2
69.

Which exception is thrown by dynamic_cast?

A. bad_alloc
B. bad_exception
C. bad_typeid
D. bad_cast
E. None of these
Answer» E. None of these
70.

What is the use of the finally keyword?

A. It will be executed at the starting of the program even if the exception arised
B. It used to execute at the starting of the program
C. It will be executed at the end of the program even if the exception arised
D. All of above
E. None of these
Answer» D. All of above
71.

Which is used to throw a exception?

A. try
B. catch
C. throw
D. All of above
E. None of these
Answer» D. All of above
72.

Which keyword is used to handle the expection?

A. catch
B. try
C. throw
D. All of above
E. None of these
Answer» B. try
73.

What will happen when the handler is not found for an exception?

A. raise an error
B. executes the remaining block
C. calls the standard library function terminate()
D. All of above
E. None of these
Answer» D. All of above
74.

What will happen when the exception is not caught in the program?

A. block of that code will not execute
B. program will execute
C. error
D. All of above
E. None of these
Answer» D. All of above
75.

Which keyword is used to check exception in the block of code?

A. throw
B. try
C. catch
D. All of above
E. None of these
Answer» C. catch
76.

To where does the program control transfers when the exception is arisen?

A. handlers
B. throw
C. catch
D. All of above
E. None of these
Answer» B. throw
77.

What are the predefined exceptions in c++?

A. Error
B. Memory allocation errors
C. I/O errors
D. Both Memory allocation errors & I/O errors
E. None of these
Answer» E. None of these