Stream Context
Which of the following is true about stream contexts? (Choose 2)
A. A context can modify or enhance the behavior of a stream
B. A context indicates what session the stream is part of
C. A context is a set of parameters and stream wrapper specific options
D. Contexts are created with new Stream_Context(); |
stream
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 |
PUT method
When uploading a file to a PHP script using the HTTP PUT method, where would the file
data be found?
A. the $_FILES super-global
B. the input stream php://input
C. the $_POST super-global
D. the global variable scope |
Methods
What is the name of the method that can be used to provide read access to virtual properties in a class?
A. __call()
B. __get()
C. __set()
D. __wakeup()
E. __fetch() |
Methods
Which of the following tasks can be achieved by using magic methods? (Choose 3)
A. Initializing or uninitializing object data
B. Creating a new stream wrapper
C. Creating an iterable object
D. Processing access to undefined methods or properties
E. Overloading operators like +, *, etc.
F. Converting objects to string representation |
Methods
Which of the following methods are available to limit the amount of resources available to
PHP through php.ini? (Choose 2)
A. Limit the amount of memory a script can consume
B. Limit the total amount of memory PHP uses on the entire server
C. Limit the maximum execution time of a script
D. Limit the maximum number of concurrent PHP processes
E. Limit the maximum number of concurrent PHP threads |
Methods
Which methods can be used to overload object properties? (Choose 2)
A. set(), get()
B. __set(), __get()
C. __put(), __receive(), __exists()
D. set(), get(), isset()
E. __isset(), __unset() |
key
What is the name of the key in $_FILES['name'] that contains the number of bytes of the uploaded file? |
uploads
Your application uses PHP to accept and process file uploads. It fails to upload a file that is
5 MB in size, although upload_max_filesize is set to "10M". Which of the following configurations could be responsible for this outcome? (Choose 2)
A. The PHP configuration option post_max_size is set to a value that is too small
B. The web server is using an incorrect encoding as part of the HTTP response sent to the client
C. The browser uses an incorrect encoding as part of the HTTP request sent to the server
D. The hidden form field MAX_FILE_SIZE was set to a value that is too small
E. PHP cannot process file uploads larger than 4 MB |
object storage
In order to create an object storage where each object would be stored only once, you may use which of the following? (choose 2)
A. SplFixedArray
B. SplObjectStorage
C. SplString
D . spl_object_hash
E. spl_same_object |
|
|
Joins
Which technique should be used to speed up joins without changing their results?
A. Add indices on joined columns
B. Add a WHERE clause
C. Add a LIMIT clause
D. Use an inner join |
content-type
What content-type is required when sending an HTTP POST using JavaScript to ensure that PHP can access the data?
A. application/x-www-form-urlencoded
B. http/post
C. text/html
D. object/multipart-formdata |
indetifiers
Which of the following are valid identifiers?
A. function 4You(){}
B. function _4You(){}
C. function object(){}
D. $1 = "Hello";
E. $_1 = "Hello World"; |
traits
Which of the following is NOT true about PHP traits? (Choose 2)
A. Multiple traits can be used by a single class.
B. A trait can implement an interface.
C. A trait can declare a private variable.
D. Traits are able to be auto-loaded.
E. Traits automatically resolve conflicts based on definition order. |
expressions
Which of the following expressions will evaluate to a random value from an array below?
$array = array("Sue","Mary","John","Anna");
A. array_rand($array);
B. array_rand($array, 1);
C. shuffle($array);
D. $array[array_rand($array)];
E. array_values($array, ARRAY_RANDOM); |
exceptions
What exception type will catch the error raised by the expression 2 / 0?
A. LogicException
B. RangeException
C. DivisionByZeroError
D. ArithmeticError |
exceptions
Which of the following statements about exceptions is correct? (Choose 2)
A. you can only throw classes derived from Exception
B. a try block can have multiple catch blocks
C. a try block must not be followed by a catch block
D. try blocks cannot contain nested try blocks |
exceptions
Which of the following statements about exceptions is correct? (Choose 2)
A. you can only throw classes derived from Exception
B. a try block can have multiple catch blocks
C. a try block must not be followed by a catch block
D. try blocks cannot contain nested try blocks |
|
|
Regex
Which sentence describes the following regular expression match?
preg_match('/^\d+(?:\.[0-9]+)?$/', $test);
A. It matches float numbers with thousand seperators.
B. It matches float numbers without thousand seperators.
C. It matches binary integer numbers.
D. It matches any string.
E. It does not match anything |
Regex
Which parts of the text are matched in the following regular expression?
$text = <<<EOT
The big bang bonged under the bung.
EOT;
preg_match_all('@b.n?g@', $text, $matches);
A. bang bong bung
B. bang bonged bung
C. big bang bong bung
D. big bang bung |
Regex
How many elements does the $matches array contain after the following function call is performed? preg_match('/^(\d{1,2}([a-z]+))(?:\s*)\S+ (?=201[0-9])/', '21st March 2014', $matches);
A. 1
B. 2
C. 3
D. 4 |
Headers
Under what condition may HTTP headers be set from PHP if there content echoed prior to the header function being used?
A. headers_sent() returns true
B. Output buffering is enabled
C. The client supports local buffering
D. The webserver uses preemptive mode |
Headers
Before the headers are sent, how can you remove a previously set header?
A. Use the header_remove() function, providing the name of the header
B. Use the die() function to abort the PHP script
C. Not possible
D. Use the headers_list() function, providing the name of the header as the second argument |
Headers
From your PHP application, how can you send the same header twice, but with different values?
A. Set the second argument of the header() function to false
B. PHP does that automatically
C. You may only send a particular type of header once
D. Use the header_add() function |
type hinting
Type hinting in PHP allows the identification of the following variable types : (choose 2)
A. String
B. Integer
C. Array
D. Any class or interface type
E. All of the above |
type hinting
Which of the following statements is NOT correct?
A. Only methods can have type hints
B. Typehints can be optional
C. Typehints can be references |
reflection
Which of the following is NOT possible using reflection?
A. Analysing of nearly any aspect of classes and interfaces
B. Analysing of nearly any aspect of functions
C. Adding class methods
D. Implement dynamic construction (new with a variable class name) |
reflection
Which of the following statements about reflection is correct?
A. Reflection is an extension that can be disabled
B. Reflection is a new extension present only in PHP7.0+
C. Reflection only allows to reflect on built-in classes
D. Built-in classes can be reflected on command line using php --rc <classname> |
|