PHP Questions and Answers – Exception Handling
This collection of PHP Multiple Choice Questions and Answers (MCQs): Quizzes & Practice Tests with Answer focuses on “Exception Handling”.
1. Which PHP version provide Exception handling?
A PHP 6
B PHP 5.3
C PHP 5
D PHP 4
2. In PHP there are ____ error levels.
A 17
B 16
C 15
D 14
3. What is the intent of try block?
A It introduce block of code in which exception can arise.
B It is used instead of catch block or after catch block.
C It is used to throw an exception.
D None of the above
4. What is the intent of finally block?
A It introduce block of code in which exception can arise.
B It is used instead of catch block or after catch block.
C It is used to throw an exception.
D None of the above
5. What is the intent of throw block?
A It introduce block of code in which exception can arise.
B It is used instead of catch block or after catch block.
C It is used to throw an exception.
D None of the above
6. Which of the following declaration invoke the exception class?
A throws new Exception();
B throw new Exception();
C new Exception();
D new throws Exception();
7. Why using Exception Handling in PHP?
A To separate the error handling code from normal code
B Grouping of error types
C Both A And B
D None of the above
8. Which is not a specific keywords in exception handling?
A this
B try
C catch
D throw
9. What is the explanation of Error level E_ERROR?
A Fatal Compile-time error
B Fatal run-time error
C Compile-time error
D Near-fatal error
10. Which of the following are an exception in PHP?
A UnderflowException
B OverflowException
C OutOfRangeException
D OutOfBoundException