Q. 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
πŸ’¬ Discuss
βœ… Correct Answer: (A) It introduce block of code in which exception can arise.

Q. 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
πŸ’¬ Discuss
βœ… Correct Answer: (B) It is used instead of catch block or after catch block.

Q. 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
πŸ’¬ Discuss
βœ… Correct Answer: (C) It is used to throw an exception.

Q. Which of the following declaration invoke the exception class?

  • (A) throws new Exception();
  • (B) throw new Exception();
  • (C) new Exception();
  • (D) new throws Exception();
πŸ’¬ Discuss
βœ… Correct Answer: (B) throw new Exception();

Q. 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
πŸ’¬ Discuss
βœ… Correct Answer: (C) Both A And B
Explanation: Exception Handling in PHP is used to separate the error handling code from normal code and to groupe the error types.

Q. Which is not a specific keywords in exception handling?

  • (A) this
  • (B) try
  • (C) catch
  • (D) throw
πŸ’¬ Discuss
βœ… Correct Answer: (A) this

Q. 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
πŸ’¬ Discuss
βœ… Correct Answer: (B) Fatal run-time error

Q. Which of the following are an exception in PHP?

  • (A) UnderflowException
  • (B) OverflowException
  • (C) OutOfRangeException
  • (D) All of the above
πŸ’¬ Discuss
βœ… Correct Answer: (D) All of the above
Explanation: The exception is thrown if a value is not valid. UnderflowException, OverflowException, OutOfRangeException, OutOfBoundException are valid exceptions in PHP.

Q. Which function is used for replacing the entire string with an alternative string?

  • (A) Replace()
  • (B) Str_replace()
  • (C) Strrpos()
  • (D) Strstr()
πŸ’¬ Discuss
βœ… Correct Answer: (B) Str_replace()

Q. Stristr() is same to Strstr() except that ______

  • (A) The comparison is case independent
  • (B) The comparison start from middle
  • (C) The comparison is case sensitive
  • (D) None of them
πŸ’¬ Discuss
βœ… Correct Answer: (A) The comparison is case independent