Paper Tayyari

Lecture 7: Introduction to Exceptions

MCQs, short and long questions from lecture 7.Lecture 7 ki MCQs, short aur long sawal.

5 MCQs · 5 MCQs from past papers5 MCQs · 5 MCQs past papers se

Start mock testMock test shuru karein
DoneHal kiye 0/5
– correctsahi
1.
★ Midterm past paper

There are _________ types of exceptions in Java

  1. A2
  2. B3
  3. C4
  4. D5

Exceptions are divided into checked and unchecked exceptions.

2.
★ Midterm past paper

Which of the following belongs to a category of checked exception?

  1. ANull Pointer exception
  2. BIOException
  3. CArray index out of bounds
  4. DNumberFormatException

IOException must be caught or declared, so it is checked.

3.
★ Midterm past paper

Which of the following exception belongs to a category of un-checked exception?

  1. AIOException
  2. BNull Pointer exception
  3. CAWTException
  4. DClassNotFoundException

NullPointerException is a RuntimeException, so it is unchecked.

4.
★ Midterm past paper

All the exceptions and errors in java are inherited from _____ class.

  1. AException
  2. BError
  3. CThrowable
  4. DIOException

Throwable is the superclass of both Exception and Error.

5.
★ Midterm past paper

When defining a method, which clause is used to declare exceptions that may be thrown?

  1. Atry block
  2. Bfinally block
  3. Ccatch block
  4. Dthrows clause

A method declares the checked exceptions it may throw with a throws clause.