PHP Exception Handling


  1. Which one of the following is the right description for the method getMessage() ?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Returns the message if it is passed to the constructor


  1. Which of the following statements invoke the exception class?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    throw new Exception();



  1. Which version added the method getPrevious()?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: A

    PHP 5.3


  1. How many methods are available for the exception class?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: B

    The seven methods are: getCode(), getFile(), getLine(), getMessage(), getPrevious(), getTrace(), getTraceAsString().



  1. Which version of PHP was added with Exception handling?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Exception handling was added to PHP with the version 5 release, and further enhanced with version 5.3.