Tag: programming languages

Questions Related to programming languages

  1. Divide by zero error

  2. Accessing the elements of an array beyond its range

  3. Invalid input

  4. Opening an empty file

  5. Hard disk crash


Correct Option: A,B,C,E
  1. Checked exceptions must be explicitly caught or propagated(declared Thrown)

  2. Unchecked exceptions must be explicitly caught or propagated(declared Thrown)

  3. Checked exceptions in Java extend the java.lang.Exception class

  4. Unchecked exceptions extend the java.lang.RuntimeException class


Correct Option: A,C,D

By convention, all exception-class names should end with the word Exception

  1. True

  2. False


Correct Option: B
  1. Errors

  2. Exceptions

  3. Both errors and exceptions

  4. Neither


Correct Option: B

Is a program required to catch all exceptions that might happen?

  1. No. You can write a program to catch just the exceptions you want.

  2. No. But if a program catches one type of exception it must catch all other types as well.

  3. Yes. If a program is not written to catch all exceptions it will not compile.

  4. Yes. A program can not do I/O unless it catches all exceptions.


Correct Option: A
  1. an IntegerArithmeticException

  2. an ArithmeticException

  3. a DivideByZeroException

  4. a NumberFormatException


Correct Option: B

If a catch handler is written to catch exception objects of a superclass type, it can also catch all objects of that class's subclasses.

  1. True

  2. False


Correct Option: B