 
			 
			MCQOPTIONS
 Saved Bookmarks
				This section includes 10 Mcqs, each offering curated multiple-choice questions to sharpen your Technical MCQs knowledge and support exam preparation. Choose a topic below to get started.
| 1. | Which of the following is/are an exception? i) OutOfBoundException ii) OutOfRangeException iii) OverflowException iv) UnderflowException | 
| A. | i) | 
| B. | i) and iii) | 
| C. | i) and ii) | 
| D. | i), ii), iii) and iv) | 
| E. | |
| Answer» E. | |
| 2. | Which is the correct method to turn off error display? | 
| A. | ini_set("Off") | 
| B. | init_set("error_reporting","Off") | 
| C. | error_reporting=Off | 
| D. | init_set("error_reporting=Off") | 
| Answer» C. error_reporting=Off | |
| 3. | Which is the error level to report errors during PHP startup engine? | 
| A. | E_CORE_ERROR | 
| B. | E_ERROR | 
| C. | E_COMPILE_ERROR | 
| D. | E_CORE | 
| Answer» B. E_ERROR | |
| 4. | How can errors be logged in files? | 
| A. | Turn on log_errors | 
| B. | Set error_log to file name | 
| C. | Both A and B | 
| D. | None of the above | 
| Answer» D. None of the above | |
| 5. | What is the advantage of log_errors directive? | 
| A. | Helps in trouble shooting of the application | 
| B. | Displays error messages on the browser | 
| C. | Displays only errors which meet the criteria | 
| D. | None of the above | 
| Answer» B. Displays error messages on the browser | |
| 6. | Which is the error level to report probable run-time errors? | 
| A. | E_ERROR | 
| B. | E_NOTICE | 
| C. | E_CORE | 
| D. | E_USER_ERROR | 
| Answer» C. E_CORE | |
| 7. | Which of the below statements are false? | 
| A. | Exception class can be inherited | 
| B. | The methods in Exception class are defined as abstract | 
| C. | The methods in Exception class are defined as final | 
| D. | Sub classess of Exception, can define new methods to extend the functionality | 
| Answer» D. Sub classess of Exception, can define new methods to extend the functionality | |
| 8. | Which of the following are valid statements to raise an exception | 
| A. | throw new exception() | 
| B. | throw new exception("Error Occured") | 
| C. | throw new exception("Error Occured",5) | 
| D. | All of the above | 
| Answer» E. | |
| 9. | Rimo is handling the exception raised by Nanda and wants to print the appropriate error message and code. Identify the correct catch block | 
| A. | catch() { echo getMessage(); echo getCode(); } | 
| B. | catch(Exception $e) { echo $e->getMessage(); echo $e->getCode(); } | 
| C. | catch(Exception $e) { echo "Message:Uninitialized Variable"; echo "Code:5"; } | 
| D. | None of the above | 
| Answer» C. catch(Exception $e) { echo "Message:Uninitialized Variable"; echo "Code:5"; } | |
| 10. | Nanda, a PHP programmer is checking for uninitialized variables and would want to throw an exception if any with an error code 5. Identify the correct statement Nanda should write | 
| A. | throw new Exception(5,"Uninitialized Variable") | 
| B. | new Exception(5,"Uninitialized Variable") | 
| C. | throw new Exception("Uninitialized Variable",5) | 
| D. | throw new Exception("Uninitialized Variable") | 
| Answer» D. throw new Exception("Uninitialized Variable") | |