Home > PHP & Programming > Quizzes > Exception Handling In PHP Practice Test
Exception Handling In PHP Practice Test
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 73% Most missed: “The … class is used if a callback refers to an undefined function or if some arg…”
Exception Handling In PHP Practice Test
Time left 00:00
20 Questions

1. The … class should be used to handle a function’s output values that fall outside of a predefined range.
2. The getPrevious() method in exception class was added in …
3. The … class is used when performing an invalid operation on an empty container, such as removing an element.
4. The … class is used if a callback refers to an undefined method or if some arguments are missing.
5. … class handles the situations where an application is programmed incorrectly, such as when there is an attempt to invoke a method before a class attribute has been set.
6. The … class should be used to handle situations where an argument of an incompatible type is passed to a function or method.
7. In PHP’s exception handling, the overloaded constructor offers additional functionality through the acceptance of the following optional parameters.
i. message
ii. error code
iii. previous
iv. next
8. State whether the following statements about the RangeException class is TRUE or FALSE.
i. It indicates the range of errors during program execution.
ii. There was an arithmetic error other than under/overflow.
ii. This is the compile-time version of DomainException.
9. The … class should be used to handle situations where a provided value does not match any of a predefined set of values.
10. … handles exceptions due to value being too small to maintain precision, resulting in loss of accuracy.
11. The … class should be used to handle situations where an arithmetic or buffer overflow occurs.
12. The … class is used if a callback refers to an undefined function or if some arguments are missing.
13. Which of the following is the correct order of the steps for implementing the exception handling process.
i. If the attempt fails, the exception-handling feature throws an exception.
ii. The application attempts to perform some task.
iii. The exception handling feature cleans-up any resources consumed during the attempt.
iv. The assigned handler catches the exception and performs any necessary tasks.
14. The … class should be used to handle situations where a provided value does not match any of an array’s defined keys.
15. The … class is used to handle arithmetic errors unrelated to overflow and underflow.
16. The … class should be used to handle scenarios where an input value falls outside of a range.
17. Which of the following are the methods available to the exception class in PHP.
i. getCode()
ii. getLine()
iii. getString()
iv. getTrace()
18. The method …. in exception class will return an array consisting of information pertinent to the context in which the error occurred.
19. There are … methods available to the exception class in PHP.
20. The standard PHP library offers access to … predefined exceptions.