Java Exceptions MCQs with answers Page - 7

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 of the following exceptions is a subclass of RuntimeException?

  • (A) FileNotFoundException
  • (B) IOException
  • (C) ArrayIndexOutOfBoundsException
  • (D) SQLException

A

Admin • 831.35K Points
Coach

Q. What does the `throws` keyword indicate in a method declaration?

  • (A) It handles the exception
  • (B) It generates an exception
  • (C) It declares that a method may throw an exception
  • (D) It prevents exception

A

Admin • 831.35K Points
Coach

Q. Can a catch block catch multiple exceptions using multi-catch in Java 6?

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

A

Admin • 831.35K Points
Coach

Q. Which block in Java ensures execution whether an exception occurs or not?

  • (A) try
  • (B) catch
  • (C) throw
  • (D) finally

A

Admin • 831.35K Points
Coach

Q. What kind of exception is FileNotFoundException?

  • (A) Unchecked exception
  • (B) Runtime exception
  • (C) Checked exception
  • (D) Error

A

Admin • 831.35K Points
Coach

Q. What is the base class for all errors in Java?

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

A

Admin • 831.35K Points
Coach

Q. Can we write try block without catch or finally?

  • (A) Yes
  • (B) No
  • (C) Only if throws is used
  • (D) Only for unchecked exceptions

A

Admin • 831.35K Points
Coach

Q. Which of the following can be caught using a catch block?

  • (A) Throwable
  • (B) Error
  • (C) Exception
  • (D) All of the above

A

Admin • 831.35K Points
Coach

Q. Which exception is thrown when a negative size is used for an array?

  • (A) NegativeSizeException
  • (B) NegativeArraySizeException
  • (C) IndexOutOfBoundsException
  • (D) IllegalArgumentException

A

Admin • 831.35K Points
Coach

Q. How do you define a custom exception in Java?

  • (A) Extend Runtime
  • (B) Extend Exception class
  • (C) Use throw only
  • (D) Define method in Throwable
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