Java Exceptions MCQs with answers Page - 2

You will find multiple-choice questions (MCQs) related to #Java Exceptions here. Go through these questions to prepare effectively for your upcoming exams and interviews.

To view the correct answer for any question, simply click the "Show Answer" button.

Have a question to share? Click on "Add Question" to contribute!

A

Admin • 831.35K Points
Coach

Q. Which exception is thrown when accessing an array with invalid index?

  • (A) ArrayIndexOutOfBoundsException
  • (B) NullPointerException
  • (C) IOException
  • (D) IndexMismatchException

A

Admin • 831.35K Points
Coach

Q. Can a try block exist without a catch block?

  • (A) Yes, if there is a finally block
  • (B) No
  • (C) Yes, always
  • (D) Only in Java 11+

A

Admin • 831.35K Points
Coach

Q. What will happen?
int a = 10 / 0;

  • (A) 0
  • (B) Infinity
  • (C) ArithmeticException
  • (D) No output

A

Admin • 831.35K Points
Coach

Q. Which of the following is true about exception propagation?

  • (A) Java handles exceptions automatically
  • (B) Exceptions must be caught in the same method
  • (C) Unhandled exceptions propagate up the call stack
  • (D) Only checked exceptions propagate

A

Admin • 831.35K Points
Coach

Q. Which exception is thrown when an object reference is null?

  • (A) NullReferenceException
  • (B) NullPointerException
  • (C) NoSuchObjectException
  • (D) ReferenceError

A

Admin • 831.35K Points
Coach

Q. Can multiple catch blocks be used with one try block?

  • (A) No
  • (B) Yes
  • (C) Only two
  • (D) Only for checked exceptions

A

Admin • 831.35K Points
Coach

Q. What is the type of all exceptions that are not checked?

  • (A) Compile-time
  • (B) RuntimeException
  • (C) IOException
  • (D) Throwable

A

Admin • 831.35K Points
Coach

Q. What is the output?
try {
int x = 5 / 0;
} catch (Exception e) {
System.out.print("Caught");
}

  • (A) Caught
  • (B) Exception
  • (C) Runtime Error
  • (D) Nothing

A

Admin • 831.35K Points
Coach

Q. Which class is the parent of RuntimeException?

  • (A) Throwable
  • (B) Exception
  • (C) Object
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. What is the correct order of catch blocks?

  • (A) From general to specific
  • (B) From specific to general
  • (C) Any order
  • (D) Only one catch allowed
What's Tag

As you may know, questions are organized under broad categories. Each category can include various types of questions. For example, the "History" category might contain questions about the Revolt of 1857, Shivaji Maharaj, Ancient History, Buddhism, and more.

To further refine this organization, we've introduced tags, which act as sub-categories to group questions more specifically.

Verified users can add tags to any question. If you have any suggestions regarding this system, we'd love to hear from you. Contact Us

Learn More