200-550

200-550 practice questions, page 4 of 9, with answer review and explanations.

Question 16

Which of the following will set a 10 seconds read timeout for a stream?

  1. ini_set("default_socket_timeout", 10);
  2. stream_read_timeout($stream, 10);
  3. Specify the timeout as the 5th parameter to the fsockopen() function used to open a stream
  4. stream_set_timeout($stream, 10);
  5. None of the above

Question 17

What function allows resizing of PHP's file write buffer?

  1. ob_start()
  2. set_write_buffer()
  3. stream_set_write_buffer()
  4. Change the output_buffering INI setting via ini_set() function

Question 18

What does the __FILE__ constant contain?

  1. The filename of the current script.
  2. The full path to the current script.
  3. The URL of the request made.
  4. The path to the main script.

Question 19

What can prevent PHP from being able to open a file on the hard drive (Choose 2)?

  1. File system permissions
  2. File is outside of open_basedir
  3. File is inside the /tmp directory.
  4. PHP is running in CGI mode.

Question 20

What purpose do namespaces fulfill?

  1. Encapsulation
  2. Alternative to classes
  3. Improved performance
  4. All of the above