php mcq questions with answers


                                
What object method specifies post-serialization behavior for an object?
A.__sleep()
B.__wakeup()
C.__set_state()
D.__get()
E.__autoload()
                                
Which of the following data types is implicitly passed by reference in PHP 5 while it is passed by value in PHP 4?
A.Class
B.String
C.Object
D.Array
                                
Which of the following will set a 10 seconds read timeout for a stream?
A.ini_set("default_socket_timeout", 10);
B.stream_read_timeout($stream, 10);
C.Specify the timeout as the 5th parameter to the fsockopen() function used to open a stream
D.stream_set_timeout($stream, 10);
E.None of the above
                                
What function allows resizing of PHP's file write buffer?
A.ob_start()
B.set_write_buffer()
C.stream_set_write_buffer()
D.Change the output_buffering INI setting via ini_set() function
                                
What is the error in the following declaration of a static class method? <?php class car { static $speeds = array( 'fast', 'slow', 'medium', ); static function getSpeeds() { return $this->speeds; } } ?>
A.Static methods must not return a value.
B.The use of $this from within static methods is not possible.
C.Static methods need the method keyword instead of the function keyword.
D.There is no static keyword in PHP.