MCQ on exception handling in Java
In Java, exception handling is an essential feature that allows developers to handle errors that occur during the execution of a program. This article will provide you with a set of MCQs on exception handling in Java to test your knowledge and understanding of this important topic.
1. What is an exception in Java?
a) An error that occurs during the execution of a program
b) A syntax error in the Java code
c) A logical error in the Java code
d) None of the above
Answer: a
Explanation: An exception in Java is an error that disrupts the normal flow of program execution, caused by reasons such as division by zero, accessing an invalid array index or attempting to open a non-existent file, and it's handled using try-catch-finally mechanism.
2. Which keyword is used to throw an exception in Java?
a) throw
b) throws
c) try
d) catch
Answer: a
Explanation: The keyword used to throw an exception in Java is "throw". It is used to explicitly throw an exception from a method or block of code. When an exception is thrown using the "throw" keyword, the normal flow of the program is disrupted and the control is transferred to the catch block where the exception can be handled. The "throws" keyword, on the other hand, is used in the method signature to declare the exceptions that may be thrown by the method.
3. Which keyword is used to declare a method that throws an exception?
a) throw
b) throws
c) try
d) catch
Answer: b
Explanation: The keyword used to declare a method that throws an exception in Java is "throws". This keyword is used in the method signature to declare the exceptions that may be thrown by the method. When a method declares that it may throw an exception using the "throws" keyword, the calling method must either handle the exception using a try-catch block or declare the exception in its own signature using the "throws" keyword. This allows for better error handling and allows the programmer to write more robust and reliable code.
4. Which keyword is used to catch an exception in Java?
a) throw
b) throws
c) try
d) catch
Answer: d
Explanation: The keyword used to catch an exception in Java is "catch". The try-catch-finally mechanism is used to handle exceptions in Java. The "try" block contains the code that may throw an exception, and the "catch" block is used to handle the exception that is thrown. When an exception is thrown in the "try" block, the control is transferred to the corresponding "catch" block that matches the type of the exception. The "catch" block contains the code that handles the exception, such as logging the error or displaying a user-friendly message.
5. What is the purpose of the finally block in Java exception handling?
a) To handle an exception
b) To catch an exception
c) To clean up resources after a try block
d) None of the above
Answer: c
Explanation: The purpose of the finally block in Java exception handling is to clean up resources after a try block. The finally block is executed whether or not an exception is thrown in the try block. It is typically used to release resources such as open files, database connections, or network sockets that were acquired in the try block. The finally block ensures that these resources are released even if an exception is thrown, which helps prevent resource leaks and other issues. The finally block is optional, but it is good practice to use it when dealing with resources that need to be released.
6. What happens if an exception is thrown but not caught in Java?
a) The program will continue to run without any issues
b) The program will terminate abruptly
c) The program will enter an infinite loop
d) None of the above
Answer: b
Explanation: If an exception is thrown but not caught in Java, the program will terminate abruptly. This is because the normal flow of the program is disrupted by the exception, and if there is no code to handle the exception, the program cannot continue to execute in a predictable manner. When an exception is thrown and not caught, the Java runtime system will print an error message and terminate the program. This can lead to data loss, corrupted files, or other issues, so it is important to handle exceptions properly in Java programs.
7. Which of the following is an unchecked exception in Java?
a) IOException
b) ClassNotFoundException
c) RuntimeException
d) None of the above
Answer: c
Explanation: The unchecked exception in Java is "RuntimeException". Unchecked exceptions are exceptions that are not checked at compile-time and can occur at run-time. These exceptions can occur due to programming errors or logical errors in the code. Examples of unchecked exceptions include NullPointerException, ArrayIndexOutOfBoundsException, and ArithmeticException. In contrast, checked exceptions like IOException and ClassNotFoundException are checked at compile-time and must be either caught or declared in the method signature using the "throws" keyword.
8. Which of the following is a checked exception in Java?
a) NullPointerException
b) ArrayIndexOutOfBoundsException
c) FileNotFoundException
d) ArithmeticException
Answer: c
Explanation: The checked exception in Java is "FileNotFoundException". Checked exceptions are exceptions that are checked at compile-time and must be either caught or declared in the method signature using the "throws" keyword. These exceptions can occur due to external factors such as input/output operations or network connections. Examples of checked exceptions include IOException, SQLException, and ClassNotFoundException. In contrast, unchecked exceptions like NullPointerException and ArithmeticException are not checked at compile-time and can occur due to programming errors or logical errors in the code.
9. Which of the following is a subclass of Exception in Java?
a) Error
b) RuntimeException
c) Throwable
d) None of the above
Answer: d
Explanation: This statement is incorrect. One of the subclasses of Exception in Java is "RuntimeException", which is an unchecked exception. Other subclasses of Exception include IOException, SQLException, and ClassNotFoundException, which are checked exceptions. "Error" and "Throwable" are not subclasses of Exception, but rather they are direct subclasses of Object. Errors in Java are used to represent serious, unrecoverable problems such as OutOfMemoryError, while Throwable is the superclass of all errors and exceptions in Java.
10. Which of the following is a subclass of RuntimeException in Java?
a) IOException
b) NullPointerException
c) ClassNotFoundException
d) None of the above
Answer: b
Explanation: The subclass of RuntimeException in Java is b) NullPointerException. The other options, a) IOException and c) ClassNotFoundException, are both subclasses of Exception but not of RuntimeException. RuntimeException is a subclass of Exception, and any exceptions that extend RuntimeException are called unchecked exceptions because they don't have to be caught or declared in a method's throws clause. Therefore, NullPointerException is a type of unchecked exception in Java.
11. Which of the following is not a type of exception in Java?
a) Checked exception
b) Unchecked exception
c) Run-time exception
d) Arithmetic exception
Answer: d
Explanation: All the options (a), (b), and (c) are types of exceptions in Java, but option (d), Arithmetic exception, is not a type of exception, rather it is a specific type of unchecked exception that is thrown when an arithmetic operation results in an error, such as division by zero.Checked exceptions are exceptions that are checked at compile-time and must be either caught or declared in the method's throws clause. Examples of checked exceptions include IOException and ClassNotFoundException. Unchecked exceptions are exceptions that are not checked at compile-time and don't have to be caught or declared in the method's throws clause. Examples of unchecked exceptions include RuntimeException and NullPointerException.Run-time exceptions are a type of unchecked exception that are thrown at runtime and not caught by the compiler.
12. Which of the following keywords can be used to catch multiple exceptions in a single catch block?
a) try
b) catch
c) finally
d) throw
Answer: b
Explanation: The keyword that can be used to catch multiple exceptions in a single catch block in Java is (b) catch. In Java, a try-catch block is used to handle exceptions. A try block contains the code that may throw an exception, and a catch block is used to handle the exception that is thrown by the try block.In some cases, it is necessary to catch multiple exceptions in a single catch block. This can be achieved by specifying multiple exception types in the catch block, separated by a vertical bar (|).The (a) try keyword is used to enclose the code that may throw an exception, and the (c) finally keyword is used to specify a block of code that will be executed after the try block, regardless of whether an exception is thrown or not. The (d) throw keyword is used to throw an exception manually.
13. Which of the following keywords is used to specify a block of code that may throw exceptions in Java?
a) throw
b) try
c) catch
d) finally
Answer: b
Explanation: The keyword used to specify a block of code that may throw exceptions in Java is (b) try. In Java, a try-catch block is used to handle exceptions. The try block contains the code that may throw an exception, and the catch block is used to handle the exception that is thrown by the try block.The try block is used to enclose the code that is likely to throw an exception. If an exception is thrown during the execution of the try block, the catch block is executed to handle the exception. If no exception is thrown, the catch block is skipped.The (a) throw keyword is used to throw an exception manually, the (c) catch keyword is used to specify a block of code that handles an exception, and the (d) finally keyword is used to specify a block of code that will be executed after the try block, regardless of whether an exception is thrown or not.
14. Which of the following is not a valid way to handle an exception in Java?
a) Catch the exception and re-throw it
b) Log the exception and continue execution
c) Ignore the exception and continue execution
d) Catch the exception and terminate the program
Answer: c
Explanation: Option (c) is not a valid way to handle an exception in Java. Ignoring an exception and continuing the execution of the program can lead to unexpected behavior or errors.In Java, there are several ways to handle an exception, including:a) Catch the exception and re-throw it: This involves catching an exception in a catch block and then throwing the same or a different exception to be handled by another catch block or to terminate the program.b) Log the exception and continue execution: This involves logging the exception and its details to a log file or console and then continuing the execution of the program.c) Ignore the exception and continue execution: As mentioned earlier, this is not a valid way to handle an exception.d) Catch the exception and terminate the program: This inlves catching an exception in a catch block and then terminating the program or taking some other action, such as notifying the user of the error.
15. Which of the following statements is true about the finally block in Java?
a) The finally block is executed only if an exception is thrown
b) The finally block is executed only if a catch block is present
c) The finally block is executed regardless of whether an exception is thrown or caught
d) The finally block is optional in Java exception handling
Answer: c
Explanation: The correct statement about the finally block in Java is (c) The finally block is executed regardless of whether an exception is thrown or caught.In Java, a try-catch-finally block is used to handle exceptions. The try block contains the code that may throw an exception, and the catch block is used to handle the exception if it is thrown. The finally block is used to specify a block of code that will be executed after the try block, regardless of whether an exception is thrown or caught.The finally block is optional, but if it is present, it will be executed regardless of whether an exception is thrown or caught. This can be useful for cleaning up resources, such as closing files or database connections, that were opened in the try block.
16. Which of the following is an example of a checked exception in Java?
a) NullPointerException
b) ArithmeticException
c) FileNotFoundException
d) ArrayIndexOutOfBoundsException
Answer: c
Explanation: The example of a checked exception in Java is (c) FileNotFoundException. In Java, exceptions are classified into two categories: checked exceptions and unchecked exceptions. Checked exceptions are exceptions that must be declared in the method signature or handled in a try-catch block. Unchecked exceptions, on the other hand, do not have to be declared or handled explicitly. FileNotFoundException is a checked exception that is thrown when an attempt is made to access a file that does not exist. It is a subclass of IOException, which is also a checked exception. NullPointerException, ArithmeticException, and ArrayIndexOutOfBoundsException are examples of unchecked exceptions.
17. Which of the following is an example of an unchecked exception in Java?
a) IOException
b) ClassNotFoundException
c) ArrayIndexOutOfBoundsException
d) None of the above
Answer: c
Explanation: The example of an unchecked exception in Java is (c) ArrayIndexOutOfBoundsException.In Java, exceptions are classified into two categories: checked exceptions and unchecked exceptions. Unchecked exceptions are exceptions that do not have to be declared in the method signature or handled in a try-catch block. Checked exceptions, on the other hand, must be declared or handled explicitly.ArrayIndexOutOfBoundsException is an unchecked exception that is thrown when an attempt is made to access an array with an index that is out of bounds. It is a subclass of RuntimeException, which is also an unchecked exception. IOException and ClassNotFoundException are examples of checked exceptions.
18. Which of the following is the correct order of execution in Java exception handling?
a) try - catch - finally
b) catch - try - finally
c) finally - catch - try
d) finally - try - catch
Answer: d
Explanation: The correct order of execution in Java exception handling is (d) finally - try - catch.In Java, exception handling involves the use of a try-catch-finally block. The try block contains the code that may throw an exception, the catch block is used to handle the exception if it is thrown, and the finally block is used to specify a block of code that will be executed after the try block, regardless of whether an exception is thrown or caught.The order of execution is as follows:
- The code in the try block is executed.
- If an exception is thrown, the corresponding catch block is executed. If no exception is thrown, the catch block is skipped.
- Regardless of whether an exception is thrown or caught, the code in the finally block is executed.
- Therefore, the correct order of execution in Java exception handling is finally - try - catch.
19. Which of the following keywords is used to specify a block of code that will always be executed, regardless of whether an exception is thrown or not?
a) try
b) catch
c) finally
d) throw
Answer: c
Explanation: The keyword used to specify a block of code that will always be executed, regardless of whether an exception is thrown or not, is (c) finally. In Java, a try-catch-finally block is used to handle exceptions. The try block contains the code that may throw an exception, the catch block is used to handle the exception if it is thrown, and the finally block is used to specify a block of code that will be executed after the try block, regardless of whether an exception is thrown or caught.The finally block is optional, but if it is present, it will always be executed, regardless of whether an exception is thrown or not. This can be useful for cleaning up resources, such as closing files or database connections, that were opened in the try block.
20. Which of the following is a way to create a custom exception in Java?
a) Inheriting from the Exception class
b) Inheriting from the Throwable class
c) Defining a new class with a public constructor that takes a string message as input and invokes the constructor of the Exception class
d) All of the above
Answer: d
Explanation: All of the options (a), (b), and (c) are ways to create a custom exception in Java.In Java, custom exceptions can be created by defining a new class that extends either the Exception or the RuntimeException class. These classes provide the functionality required to throw and catch exceptions.Option (a) is a valid way to create a custom exception by inheriting from the Exception class.Option (b) is also a valid way to create a custom exception by inheriting from the Throwable class, which is the superclass of both the Exception and the RuntimeException classes.Option (c) is another way to create a custom exception by defining a new class with a public constructor that takes a string message as input and invokes the constructor of the Exception class.Therefore, option (d) is the correct answer.
21. Which of the following is not a common error that can occur during the execution of a Java program?
a) ArithmeticError
b) OutOfMemoryError
c) StackOverflowError
d) SyntaxError
Answer: d
Explanation: The option (d) SyntaxError is not a common error that can occur during the execution of a Java program.A SyntaxError is a compile-time error that occurs when the syntax of a program is incorrect. This error prevents the program from being compiled and executed.On the other hand, options (a), (b), and (c) are all common errors that can occur during the execution of a Java program.
22. What is the purpose of the throws keyword in Java exception handling?
a) To declare that a method may throw an exception
b) To catch an exception that may be thrown by a method
c) To specify the type of exception that a catch block can handle
d) None of the above
Answer: a
Explanation: The purpose of the "throws" keyword in Java exception handling is to declare that a method may throw one or more exceptions. When a method uses the "throws" keyword, it is indicating to the caller of the method that it may throw an exception and the caller needs to handle it appropriately. This helps in designing robust code that can handle exceptional situations gracefully. The "throws" keyword is not used for catching exceptions or specifying the type of exception that a catch block can handle, which are handled by the "try-catch" block.
23.Which of the following keywords is used to propagate an exception up the call stack?
a) throw
b) throws
c) try
d) catch
Answer: a
Explanation: The keyword "throw" is used to propagate an exception up the call stack in Java. When an exception occurs in a method, the method can use the "throw" keyword to throw the exception to the calling method, indicating that something unexpected has happened and the calling method should handle it appropriately. The "throws" keyword is used to declare that a method may throw an exception, while the "try" and "catch" keywords are used for exception handling within a method. So, option (a) is the correct answer.
24. Which of the following statements is true about checked exceptions in Java?
a) They are subclasses of the RuntimeException class
b) They are not checked by the Java compiler
c) They must be declared in a method signature or handled using a try-catch block
d) None of the above
Answer: c
Explanation: The statement that is true about checked exceptions in Java is: "They must be declared in a method signature or handled using a try-catch block." Checked exceptions in Java are exceptions that are checked by the Java compiler at compile time to ensure that they are either declared in the method signature using the "throws" keyword or handled using a try-catch block. This is to ensure that the programmer explicitly handles the exception, which helps in writing more reliable and robust code. Checked exceptions are not subclasses of the RuntimeException class, which is used for unchecked exceptions. So, option (c) is the correct answer.
25. Which of the following statements is true about unchecked exceptions in Java?
a) They must be declared in a method signature or handled using a try-catch block
b) They are not checked by the Java compiler
c) They are subclasses of the Exception class
d) None of the above
Answer: b
Explanation: The statement that is true about unchecked exceptions in Java is: "They are not checked by the Java compiler." Unchecked exceptions in Java are exceptions that are not checked by the Java compiler at compile time, which means they do not need to be declared in the method signature or handled using a try-catch block. Unchecked exceptions are subclasses of the RuntimeException class, which is a subclass of the Exception class. So, option (b) is the correct answer.
26. Which of the following is an example of a runtime exception in Java?
a) NullPointerException
b) FileNotFoundException
c) ClassNotFoundException
d) IOException
Answer: a
Explanation: The example of a runtime exception in Java is: "NullPointerException". Runtime exceptions are exceptions that occur at runtime and are not checked by the Java compiler, which means they do not need to be declared in the method signature or handled using a try-catch block. They are subclasses of the RuntimeException class. Option (b), (c), and (d) are all examples of checked exceptions that must be either declared in the method signature or handled using a try-catch block. So, option (a) is the correct answer.
27. Which of the following statements is true about the try-catch-finally block in Java?
a) The try block must always be followed by a catch block
b) The finally block must always be followed by a try block
c) The finally block is optional
d) The catch block is optional
Answer: c
Explanation: The statement that is true about the try-catch-finally block in Java is: "The finally block is optional." The try-catch-finally block is used for exception handling in Java. The try block contains the code that may throw an exception, and the catch block contains the code that handles the exception if it occurs. The finally block contains the code that must be executed, regardless of whether an exception occurs or not. While the try and catch blocks are mandatory, the finally block is optional. If a finally block is present, it is guaranteed to execute, even if an exception occurs or if the catch block executes a return statement. So, option (c) is the correct answer.
28. Which of the following is a common use case for the finally block in Java?
a) To catch an exception and handle it
b) To re-throw an exception that was caught in a catch block
c) To clean up resources that were used in a try block
d) None of the above
Answer: c
Explanation: The common use case for the finally block in Java is: "To clean up resources that were used in a try block." The finally block is often used to release resources that were allocated in the try block, such as file handles, database connections, or network sockets. The finally block is guaranteed to execute, regardless of whether an exception occurs or not, which makes it a good place to perform cleanup operations. The catch block is used to catch and handle exceptions, while the try block is used to enclose the code that may throw an exception. The re-throwing of an exception that was caught in a catch block is typically done using the "throw" keyword, but it is not a common use case for the finally block. So, option (c) is the correct answer.
29. Which of the following is not a best practice for Java exception handling?
a) Catching the most specific exception type possible
b) Throwing exceptions instead of returning error codes
c) Swallowing exceptions without logging or handling them
d) Documenting the exceptions that a method may throw
Answer: c
Explanation: The option that is not a best practice for Java exception handling is: "Swallowing exceptions without logging or handling them." Swallowing exceptions means catching an exception and doing nothing about it, such as not logging or handling it in any way. This is not a good practice as it makes it harder to diagnose and fix issues when they occur. The best practice for exception handling in Java includes catching the most specific exception type possible, throwing exceptions instead of returning error codes, documenting the exceptions that a method may throw, and handling or logging exceptions appropriately. So, option (c) is the correct answer.
30. Which of the following statements is true about custom exceptions in Java?
a) They must inherit from the Throwable class
b) They must be declared in a method signature or handled using a try-catch block
c) They can be used to create more meaningful error messages and handle specific cases in a program
d) None of the above
Answer: c
Explanation: The statement that is true about custom exceptions in Java is: "They can be used to create more meaningful error messages and handle specific cases in a program." Custom exceptions are user-defined exception classes that are created by extending the Exception class. They can be used to handle specific error cases in a program and provide more meaningful error messages to the users. Custom exceptions are typically used in larger programs where it is not possible to handle all the error cases using the existing built-in exceptions. Custom exceptions can be thrown using the "throw" keyword and caught using a try-catch block, just like built-in exceptions. So, option (c) is the correct answer.
31. What is the purpose of the getMessage() method in Java exceptions?
a) To get a human-readable message describing the exception
b) To get the name of the exception class
c) To get the stack trace of the exception
d) None of the above
Answer: a
Explanation: The purpose of the getMessage() method in Java exceptions is: "To get a human-readable message describing the exception." The getMessage() method is a method defined in the Throwable class and is inherited by all exception classes in Java. It returns a String that describes the details of the exception and can be used to provide a more meaningful message to the user. The message returned by getMessage() method is typically set by the exception constructor when the exception is created. So, option (a) is the correct answer.
32. Which of the following statements is true about the Error class in Java?
a) It is a subclass of the Exception class
b) It is a subclass of the RuntimeException class
c) It is used to indicate serious problems that cannot be handled by the program
d) None of the above
Answer: c
Explanation: The statement that is true about the Error class in Java is: "It is used to indicate serious problems that cannot be handled by the program." The Error class is a subclass of the Throwable class in Java and represents serious errors that cannot be recovered from. Examples of errors include OutOfMemoryError, StackOverflowError, and AssertionError. Unlike exceptions, errors are not meant to be caught and handled by the program, as they typically indicate a severe problem with the JVM or hardware. So, option (c) is the correct answer.
33. Which of the following statements is true about the finally block in Java?
a) It is always executed, regardless of whether an exception is thrown or not
b) It is only executed if an exception is thrown
c) It is only executed if a catch block is present
d) None of the above
Answer: a
Explanation: The statement that is true about the finally block in Java is: "It is always executed, regardless of whether an exception is thrown or not." The finally block is used to contain code that must be executed regardless of whether an exception is thrown or not. This block is executed after the try block and any associated catch blocks, and before the control is transferred outside the try-catch-finally block. The finally block is typically used to release resources that were acquired in the try block, such as file handles or database connections. So, option (a) is the correct answer.
34. Which of the following keywords is used to catch multiple exceptions in a single catch block?
a) and
b) or
c) catch
d) finally
Answer: b
Explanation: The statement that is true about the keywords used to catch multiple exceptions in a single catch block is: "b) or". In Java, it is possible to catch multiple exceptions in a single catch block by separating the exception types with the | (or) operator. This catch block will catch either an IOException or an SQLException. If both exceptions are thrown, the catch block will handle both of them. So, option (b) is the correct answer.
35. Which of the following statements is true about the throws clause in Java?
a) It can only appear in method declarations
b) It is used to declare the exceptions that a method may throw
c) It is used to catch exceptions that may be thrown by a method
d) None of the above
Answer: b
Explanation: The throws clause in Java is used to declare the exceptions that a method may throw. It is placed in the method declaration after the method signature and before the opening curly brace. The throws clause informs the calling code that the method may throw certain types of exceptions, which must be caught or declared to be thrown by the calling code. Therefore, statement b) is true. Statements a) and c) are false because the throws clause can only appear in method declarations and it does not catch exceptions, but rather declares them to be thrown.
36. Which of the following is an example of a checked exception in Java?
a) ArrayIndexOutOfBoundsException
b) IllegalArgumentException
c) IOException
d) None of the above
Answer: c
Explanation: The correct answer is c) IOException. A checked exception is an exception that the compiler requires a method to either handle or declare in its throws clause. IOException is a checked exception in Java that is thrown when an input/output operation fails or is interrupted, such as when reading or writing a file.On the other hand, ArrayIndexOutOfBoundsException and IllegalArgumentException are both unchecked exceptions, which means they do not have to be declared in the method's throws clause or handled explicitly by the calling code. Unchecked exceptions are typically caused by programming errors, such as attempting to access an invalid array index or passing invalid arguments to a method.
37. Which of the following statements is true about the try-with-resources statement in Java?
a) It is used to catch exceptions that may be thrown by a method
b) It must be followed by a catch or finally block
c) It is used to declare resources that will be closed after use
d) None of the above
Answer: c
Explanation: The correct answer is c) It is used to declare resources that will be closed after use.The try-with-resources statement is used to declare and initialize resources that will be automatically closed after the program finishes with them, regardless of whether an exception is thrown. It was introduced in Java 7 as a convenient way to handle resources such as file I/O streams and database connections, which need to be closed to avoid resource leaks.Statement a) is false because the try-with-resources statement does not catch exceptions directly, but rather ensures that the resources are closed properly even if an exception is thrown. Statement b) is also false because the try-with-resources statement can be used without a catch or finally block, although either or both can be used if needed.
38. What is the purpose of the finally block in Java?
a. To catch an exception that occurs in the try block.
b. To throw an exception if one occurs in the try block.
c. To always execute the code, regardless of whether an exception occurs.
d. To provide additional information about an exception that occurs in the try block.
Answer: c
Explanation: The finally block in Java is used to ensure that a section of code is always executed, regardless of whether an exception occurs. This is useful for releasing resources, closing files, and other cleanup tasks that need to be performed regardless of whether the code completed successfully or not.
39. Which of the following is not a type of exception in Java?
a. Checked exceptions
b. Runtime exceptions
c. Unchecked exceptions
d. Logical exceptions
Answer: d
Explanation: Logical exceptions are not a type of exception in Java. Checked exceptions, runtime exceptions, and unchecked exceptions are the three types of exceptions in Java. Checked exceptions are checked at compile time, while runtime exceptions and unchecked exceptions are checked at runtime. Logical exceptions are not related to the execution of the code, but rather to the logic of the program.
40. Which statement is true about checked exceptions in Java?
a. They are checked at runtime.
b. They are checked at compile time.
c. They are always fatal to the program.
d. They are always unchecked exceptions.
Answer: b
Explanation: Checked exceptions are checked at compile time in Java. This means that the compiler will check whether the code that may throw a checked exception has proper exception handling in place. If not, the code will not compile. Examples of checked exceptions include IOException and ClassNotFoundException.