1. Question: What is the output of the following code?
    <?php
    class MyException extends Exception {}
    class AnotherException extends MyException {}
    
    class Foo {
      public function something() {
        throw new AnotherException();
      }
      public function somethingElse() {
        throw new MyException();
      }
    }
    
    $a = new Foo();
    
    try {
      try {
        $a->something();	
      } catch(AnotherException $e) {
        $a->somethingElse();	
      } catch(MyException $e) {
        print "Caught Exception";
      }
    } catch(Exception $e) {
      print "Didn't catch the Exception!";
    }
    
    ?>

    A
    "Caught Exception" followed by "Didn't catch the Exception!"

    B
    A fatal error for an uncaught exception

    C
    "Didn't catch the Exception!"

    D
    "Didn't catch the Exception!" followed by a fatal error

    E
    "Caught Exception"

    Note: Not available
    1. Report
  2. Question: Which two internal PHP interfaces provide functionality which allow you to treat an object like an array?

    A
    iteration

    B
    arrayaccess

    C

    D

    E
    array

    Note: Not available
    1. Report
  3. Question: Which php.ini directive should be disabled to prevent the execution of a remote PHP script via an include or require construct?

    A
    You cannot disable remote PHP script execution

    B
    curl.enabled

    C
    allow_remote_url

    D
    allow_url_fopen

    E
    allow_require

    Note: Not available
    1. Report
  4. Question: When attempting to prevent a cross-site scripting attack, which of the following is most important?

    A
    Not writing Javascript on the fly using PHP

    B
    Filtering Output used in form data

    C

    D

    E

    Note: Not available
    1. Report
  5. Question: Which of the following php.ini directives should be disabled to improve the outward security of your application?

    A
    safe_mode

    B

    C

    D
    display_errors

    E
    allow_url_fopen

    Note: Not available
    1. Report
  6. Question: Which of the following list of potential data sources should be considered trusted?

    A

    B
    $_ENV

    C

    D
    $_COOKIE

    E

    Note: Not available
    1. Report
  7. Question: What is the best way to ensure the distinction between filtered / trusted and unfiltered / untrusted data?

    A

    B
    Never trust any data from the user

    C
    Enable built-in security features such as magic_quotes_gpc and safe_mode

    D
    Always filter all incoming data

    E
    Use PHP 5's tainted mode

    Note: Not available
    1. Report
  8. Question: Consider the following code:

    <?php
    session_start();

    if(!empty($_REQUEST['id'])
    && !empty($_REQUEST['quantity'])) {
    $id = scrub_id($_REQUEST['id']);
    $quantity = scrub_quantity($_REQUEST['quantity'])
    $_SESSION['cart'][] = array('id' => $id,
    'quantity' => $quantity)
    }

    /* .... */

    ?>
    What potential security hole would this code snippet produce?

    A
    Cross-Site Scripting Attack

    B
    There is no security hole in this code

    C
    Code Injection

    D
    SQL Injection

    E
    Choose 1 answer

    Note: Not available
    1. Report
  9. Question: What is the best measure one can take to prevent a cross-site request forgery?

    A
    Disallow requests from outside hosts

    B

    C
    Turn off allow_url_fopen in php.ini

    D

    E
    Filter all input

    Note: Not available
    1. Report
  10. Question: Consider the following code:

    <?php
    header("Location: {$_GET['url']}");
    ?>
    Which of the following values of $_GET['url'] would cause session fixation?

    A

    B

    C

    D
    Set-Cookie%3A+PHPSESSID%611234

    E

    Note: Not available
    1. Report
Copyright © 2025. Powered by Intellect Software Ltd