1. Question: What will the following script output?
    <?php
    ob_start();
    for ($i = 0; $i < 10; $i++) {
     echo $i;
    }
    $output = ob_get_contents();
    ob_end_clean();
    echo $ouput;
    ?>

    A
    12345678910

    B
    1234567890

    C
    0123456789

    D
    Nothing

    E
    A notice

    Note: Yet another question designed to see how well you recognize bugs in a script. Did you notice that, at the end of the script, the $output variable’s name is misspelled in the echo statement? The script will output a notice and, therefore, Answer E is correct.
    1. Report
  2. Question: By default, PHP stores session data in _______.

    A
    The filesystem

    B
    A database

    C
    Virtual memory

    D
    Shared memory

    E
    None

    Note: The filesystem (Answer A). By default, PHP stores all session information in the /tmp folder; users of operating systems where this folder doesn’t exist (such as Windows) must change the default value of the session.save_path php.ini setting to a directory appropriate for their setup (e.g.: C:\Temp).
    1. Report
  3. Question: When you write a cookie with an expiration date in the future to a particular machine, the cookie never seem to be set. The technique usually works with other computers, and you have checked that the time on the machine corresponds to the time on the server within a reasonable margin by verifying the date reported by the operating system on the client computer’s desktop. The browser on the client machine seems to otherwise work fine on most other websites. What could be likely causes of this problem? (Choose 2)

    A
    The browser’s binaries are corrupt

    B
    The client machine’s time zone is not set properly

    C
    The user has a virus-scanning program that is blocking all secure cookie

    D
    The browser is set to refuse all cookies

    E
    The cookie uses characters that are discarded all data from your server

    Note: Answers A and D both describe likely causes of this type of problem and warrant further investigation on your part. Since the browser seems to work fine, it’s unlikely that its binaries have suffered corruption such that only your site has stopped working, and virus scanning programs do not normally stop secure cookies selectively (although some block all cookies). On the other hand, the browser might have been explicitly set to refuse all cookies, which is probably the first source of trouble you should check for. By the same token, the computer’s time zone might have been set incorrectly and, since cookie expiration dates are coordinated through GMT, cause the cookie to expire as soon as it was set and never be returned to your scripts.
    1. Report
  4. Question: Assuming that the client browser is never restarted, how long after the last access will a session “expire” and be subject to garbage collection?

    A
    After exactly 1,440 seconds

    B
    After the number of seconds specified in the session.gc_maxlifetime INI setting

    C
    It will never expire unless it is manually deleted

    D
    It will only expire when the browser is restarted

    E
    None

    Note: The session.gc_maxlifetime INI setting regulates the amount of time since the last access after which the session handler considers a session data file “garbage” and marks it for deletion by the garbage handler. Once this has happened, any subsequent access to the session will be considered invalid, even if the data file still exists. Coincidentally, the session.gc_maxlifetime is set to 1,440 seconds, but you can’t rely on that number as it might have been changed without your knowledge by the system administrator. Answer B is, therefore, correct.
    1. Report
  5. Question: The _____ function automatically transforms newline characters into HTML <br /> tags Your Answer: _______

    A
    This identifies the nl2br function, which can be used precisely for this purpose.

    B
    This identifies the nltobr function, which can be used precisely for this purpose.

    C
    This identifies the nl_to_br function, which can be used precisely for this purpose.

    D
    This identifies the nl_br function, which can be used precisely for this purpose.

    E
    none

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