Explore topic-wise MCQs in Object Oriented Programming.

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

1.

Which condition among the following might result in memory exception?

A. False if conditions
B. Nested if conditions that are all false
C. Infinite loops
D. Loop that runs exactly 99 times
Answer» D. Loop that runs exactly 99 times
2.

Only the base class catch box can handle more than one exception in single block.

A. True
B. False
Answer» C.
3.

Which is the necessary condition to define the base and derived class catch blocks?

A. Base class catch should be defined first
B. Derived class catch should be defined first
C. Catch block for both the classes must not be defined
D. Catch block must be defined inside main function
Answer» C. Catch block for both the classes must not be defined
4.

If classes produce some exceptions, then ______________________

A. Their respective catch block must be defined
B. Their respective catch blocks are not mandatory
C. Their catch blocks should be defined inside main function
D. Their catch blocks must be defined at the end of program
Answer» B. Their respective catch blocks are not mandatory
5.

Which among the following handles the undefined class in program?

A. ClassNotFound
B. NoClassException
C. ClassFoundException
D. ClassNotFoundException
Answer» E.
6.

If a catch block accepts more than one exceptions then __________________

A. The catch parameters are not final
B. The catch parameters are final
C. The catch parameters are not defined
D. The catch parameters are not used
Answer» C. The catch parameters are not defined
7.

To catch more than one exception in one catch block, how are the exceptions separated in the syntax?

A. Vertical bar
B. Hyphen
C. Plus
D. Modulus
Answer» B. Hyphen
8.

Since which version of java is multiple exception catch was made possible?

A. Java 4
B. Java 5
C. Java 6
D. Java 7
Answer» E.
9.

How many catch blocks can a class have?

A. Only 1
B. 2
C. 3
D. As many as required
Answer» E.
10.

If catching of base class exception is done before derived class in C++ ________________

A. It gives compile time error
B. It doesn’t run the program
C. It may give warning but not error
D. It always gives compile time error
Answer» D. It always gives compile time error
11.

The catching of base class exception ___________________________ in java.

A. After derived class is not allowed by compiler
B. Before derived class is not allowed by compiler
C. Before derived class is allowed
D. After derived class can’t be done
Answer» C. Before derived class is allowed
12.

If both base and derived class caught exceptions ______________

A. Then catch block of derived class must be defined before base class
B. Then catch block of base class must be defined before the derived class
C. Then catch block of base and derived classes doesn’t matter
D. Then catch block of base and derived classes are not mandatory to be defined
Answer» B. Then catch block of base class must be defined before the derived class
13.

Which among the following is true for class exceptions?

A. Only base class can give rise to exceptions
B. Only derived class can give rise to exceptions
C. Either base class or derived class may produce exceptions
D. Both base class and derived class may produce exceptions
Answer» E.
14.

WHICH_AMONG_THE_FOLLOWING_HANDLES_THE_UNDEFINED_CLASS_IN_PROGRAM??$

A. ClassNotFound
B. NoClassException
C. ClassFoundException
D. ClassNotFoundException
Answer» E.
15.

If classes produce some exceptions, then ______________________$

A. Their respective catch block must be defined
B. Their respective catch blocks are not mandatory
C. Their catch blocks should be defined inside main function
D. Their catch blocks must be defined at the end of program
Answer» B. Their respective catch blocks are not mandatory
16.

If a catch block accepts more than one exceptions then _________________?

A. The catch parameters are not final
B. The catch parameters are final
C. The catch parameters are not defined
D. The catch parameters are not used
Answer» C. The catch parameters are not defined