What is the output of the following code? echo '1' . (print '2') + 3;
A. 123
B. 213
C. 142
D. 214
E. Syntax error
What is the recommended method of copying data between two opened files?
A. copy($source_file, $destination_file);
B. copy($destination_file, $source_file);
C. stream_copy_to_stream($source_file, $destination_file);
D. stream_copy_to_stream($destination_file, $source_file);
E. stream_bucket_prepend($source_file, $destination_file);
SimpleXML provides the ability to iterate over items in an XML document, as well as access items within it as if they were object properties. When creating your own classes to access data, implementing which of the following would NOT achieve this goal?
A. __toString
B. Iterator
C. __get/__set
D. ArrayAccess
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
Which interfaces could class C implement in order to allow each statement in the following code to work?
(Choose 2)
$obj = new C();
foreach ($obj as $x => $y) {
echo $x, $y;
}
A. Iterator
B. ArrayAccess
C. IteratorAggregate
D. ArrayObject
Under what condition may HTTP headers be set from PHP if there is 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
What is the output of the following code? var_dump(boolval([]));
A. bool(true)
B. bool(false)
When using password_hash() with the PASSWORD_DEFAULT algorithm constant, which of the following is true? (Choose 2)
A. The algorithm that is used for hashing passwords can change when PHP is upgraded.
B. The salt option should always be set to a longer value to account for future algorithm requirements.
C. The string length of the returned hash can change over time.
D. The hash algorithm that's used will always be compatible with crypt() .
Which of the following items in the $_SERVER superglobal are important for authenticating the client when using HTTP Basic authentication? (Choose 2)
A. PHP_AUTH_TYPE
B. PHP_AUTH_PASSWORD
C. PHP_AUTH_DIGEST
D. PHP_AUTH_PW
E. PHP_AUTH_USER
Which of the following statements is correct?
A. Interfaces can extend only one interface
B. Interfaces can extend more than one interface
C. Interfaces can inherit a method from different interfaces
D. Interfaces can redeclare inherited methods
In the following code, which classes can be instantiated?
abstract class Graphics {
abstract function draw($im, $col);
}
abstract class Point1 extends Graphics {
public $x, $y;
function __construct($x, $y) {
$this->x = $x;
$this->y = $y;
}
function draw($im, $col) {
ImageSetPixel($im, $this->x, $this->y, $col);
}
}
class Point2 extends Point1 { }
abstract class Point3 extends Point2 { }
A. Graphics
B. Point1
C. Point2
D. Point3
E. None, the code is invalid
What is the length of a string returned by: md5(rand(), TRUE);
A. Depends on the value returned by rand() function
B. 32
C. 24
D. 16
E. 64
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
Which PHP function is used to validate whether the contents of $_FILES['name']['tmp_name'] have really been uploaded via HTTP?
Consider the following code:
$result = $value1 ??? $value2;
Which operator needs to be used instead of ??? so that $result equals $value1 if $value1 evaluates to true, and equals $value2 otherwise? Just state the operator as it would be required in the code.