Web Services Development MCQs with Answers
Practice important Web Services Development MCQs with answers and explanations.
Multiple Choice Questions
Q251: Which keyword is used to explicitly throw an exception in Java?
- A: throws
- B: try
- C: throw
- D: catch
View Answer
C
Q252: Which block is used to handle exceptions after a try block?
- A: throw
- B: finally
- C: catch
- D: return
View Answer
C
Q253: What block always executes after a try block, irrespective of exceptions?
- A: catch
- B: return
- C: throw
- D: finally
View Answer
D
Q254: What does the 'throw' keyword do in exception handling?
- A: Declares an exception
- B: Throws an exception explicitly
- C: Handles exceptions
- D: Returns the exception
View Answer
B
Q255: Which class is the superclass of all exceptions in Java?
- A: Throwable
- B: RuntimeException
- C: IOException
- D: Error
View Answer
A
Q256: What will happen if an exception is thrown but not caught by a catch block?
- A: Program continues normally
- B: Program terminates normally
- C: Program terminates abnormally
- D: Program pauses
View Answer
C
Q257: What is the purpose of a 'finally' block in Java exception handling?
- A: To throw exceptions
- B: To handle exceptions
- C: To execute code after try or catch
- D: To skip the catch block
View Answer
C
Q258: Fill in the blank: Unchecked exceptions occur during _______.
- A: Compile-time
- B: Execution time
- C: File reading
- D: Code writing
View Answer
B
Q259: Fill in the blank: A _______ block is mandatory after a try block if no catch block is used.
- A: return
- B: catch
- C: finally
- D: break
View Answer
C
Q260: Which of the following is an unchecked exception?
- A: SQLException
- B: NullPointerException
- C: IOException
- D: FileNotFoundException
View Answer
B