Java Exception Handling - 1

6 Questions | Total Attempts: 249

SettingsSettingsSettings
Please wait...
Java Exception Handling - 1

.


Questions and Answers
  • 1. 
    What is the base class for Error and Exception in Java?
    • A. 

      Throwable

    • B. 

      RunTimeExceptions

    • C. 

      Throws

    • D. 

      Option 4

  • 2. 
    I will cause a complier error if you did not declare/handle me in your program. I am :
    • A. 

      Checked Exception

    • B. 

      Unchecked Exception

    • C. 

      All Exceptions

    • D. 

      Option 4

  • 3. 
    If a statement tries to divide by zero which exception is thrown?
    • A. 

      NullPointerException

    • B. 

      NumberFormatException

    • C. 

      ArithmeticException

    • D. 

      DivideByZeroException

  • 4. 
    An instance of _________ describes system errors. If this type of error occurs, there is little you can do beyond notifying the user and trying to terminate the program gracefully.
    • A. 

      RunTimeException

    • B. 

      Exception

    • C. 

      Error

    • D. 

      NumberFormatException

  • 5. 
    Two classes of exceptions you should ideally deal in your program are:
    • A. 

      Checked Exceptions

    • B. 

      Runtime Exceptions

    • C. 

      Error class

    • D. 

      All Exceptions

  • 6. 
    Which of the following is true regarding try blocks in Java language?
    • A. 

      Try blocks must be placed below a catch block

    • B. 

      Try blocks must have at least one corresponding catch block

    • C. 

      They always use recursion

    • D. 

      Try blocks are only used for Exceptions related to file input and output

Back to Top Back to top