Explore topic-wise MCQs in C++ Programming.

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

1.

In how many ways we can handle errors in any class?

A. 1
B. 2
C. 3
D. 4
Answer» C. 3
2.

What is the use of reset() function?

A. Used to destroys the contained object in any variable
B. Used to change the object any container is holding
C. Used to empty any container value
D. Used to check the type of any variable
Answer» B. Used to change the object any container is holding
3.

What is the use of has_value() function in any container?

A. Used to destroys the contained object in any variable
B. Used to change the object any container is holding
C. Used to return the type information about the any container
D. Used to check whether any container is empty or not
Answer» E.
4.

What is the use of type() function in any container?

A. Used to destroys the contained object in any variable
B. Used to change the object any container is holding
C. Used to return the type information about the any container
D. Used to check whether a container is empty or not
Answer» D. Used to check whether a container is empty or not
5.

What is the use of emplace() function?

A. Used to change the object any container is holding
B. Used to add more item to the any list
C. Used to empty any container value
D. Used to check the type of any variable
Answer» B. Used to add more item to the any list
6.

Which exception is thrown if the typecasting is not done properly?

A. bad_type_cast
B. bad_any_cast
C. type_mismatched
D. bad_cast_mismatched
Answer» C. type_mismatched