200-550 Exam Questions
221 real 200-550 exam questions with expert-verified answers and explanations. Page 1 of 5.
- Question #1
What is the result of the following bitwise operation in PHP? 1 ^ 2
- Question #2
What is the output of the following code? echo "22" + "0.2", 23 . 1;
- Question #3
What is the output of the following code? $first = "second"; $second = "first"; echo $$$first;
- Question #5
Which of the following code snippets DO NOT write the exact content of the file "source.txt" to "target.txt"? (Choose 2)
- Question #6
What is the recommended method of copying data between two opened files?
- Question #7
Which of the following will set a 10 seconds read timeout for a stream?
- Question #8
What function allows resizing of PHP's file write buffer?
- Question #9
What does the __FILE__ constant contain?
- Question #10
What can prevent PHP from being able to open a file on the hard drive (Choose 2)?
- Question #11
What purpose do namespaces fulfill?
- Question #12
When would you use classes and when would you use namespaces?
- Question #13
Which of these elements can be encapsulated by namespaces and made accessible from the outside?
- Question #14
You'd like to use the class MyDBConnection that's defined in the MyGreatFramework\MyGreatDatabaseAbstractionLayer namespace, but you want to minimize *as much as possible* the leng...
- Question #15
How should you track errors on your production website?
- Question #16
What would be the output of the following code? namespace MyFramework\DB; class MyClass { static function myName() { return __METHOD__; } } print MyClass::myName();
- Question #17
Which of the following methods are available to limit the amount of resources available to PHP through php.ini? (Choose 2)
- Question #18
Consider the following two files. When you run test.php, what would the output look like? test.php: include "MyString.php"; print ","; print strlen("Hello world!"); MyString.php: n...
- Question #19
Which line of code can be used to replace the INSERT comment in order to output "hello"? class C { public $ello = 'ello'; public $c; public $m; function __construct($y) { $this->c...
- Question #20
What is the output of the following code? function z($x) { return function ($y) use ($x) { return str_repeat($y, $x); }; } $a = z(2); $b = z(3); echo $a(3) . $b(2);
- Question #21
What is the output of the following code? $f = function () { return "hello"; }; echo gettype($f);
- Question #22
What is the output of the following code? class C { public $x = 1; function __construct() { ++$this->x; } function __invoke() { return ++$this->x; } function __toString() { return...
- Question #25
In order to create an object storage where each object would be stored only once, you may use which of the following? (Choose 2)
- Question #26
What is the output of the following code? class Base { protected static function whoami() { echo "Base "; } public static function whoareyou() { static::whoami(); } } class A exten...
- Question #27
Late static binding is used in PHP to:
- Question #28
What is the output of the following code? class Test { public function __call($name, $args) { call_user_func_array(array('static', "test$name"), $args); } public function testS($l)...
- Question #29
Which of the following tasks can be achieved by using magic methods? (Choose 3)
- Question #30
How should class MyObject be defined for the following code to work properly? Assume $array is an array and MyObject is a user-defined class. $obj = new MyObject(); array_walk($arr...
- Question #31
Consider the following code. What change must be made to the class for the code to work as written? class Magic { protected $v = array("a" => 1, "b" => 2, "c" => 3); public functio...
- Question #32
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 acce...
- Question #33
Which of the following is used to find all PHP files under a certain directory?
- Question #38
What information can be used to reliably determine the type of an uploaded file?
- Question #39
What is the output of the following code? class Foo Implements ArrayAccess { function offsetExists($k) { return true;} function offsetGet($k) {return 'a';} function offsetSet($k, $...
- Question #40
What is the output of the following code? class Bar { private $a = 'b'; public $c = 'd'; } $x = (array) new Bar(); echo array_key_exists('a', $x) ? 'true' : 'false'; echo '-'; echo...
- Question #41
What is the output of the following code? $a = array('a', 'b'=>'c'); echo property_exists((object) $a, 'a')?'true':'false'; echo '-'; echo property_exists((object) $a, 'b')?'true':...
- Question #42
Assuming UTF-8 encoding, what is the value of $count? $count = strlen($data);
- Question #43
What is the output of this code? $world = 'world'; echo <<<'TEXT' hello $world TEXT;
- Question #44
Given a php.ini setting of default_charset = utf-8 what will the following code print in the browser? header('Content-Type: text/html; charset=iso-8859-1'); echo '✂✔✝';
- Question #45
What will the following code print out? $str = '✔ one of the following'; echo str_replace('✔', 'Check', $str);
- Question #46
What is the pattern modifier for handling UTF-8 encoded preg_* functionality?
- Question #47
What is the output of the following code? $text = 'This is text'; $text1 = <<<'TEXT' $text TEXT; $text2 = <<<TEXT $text1 TEXT; echo "$text2";
- Question #48
Your public web application needs to provide access to binary files for registered users only. How would you achieve this?
- Question #49
What content-type is required when sending an HTTP POST using JavaScript to ensure that PHP can access the data?
- Question #50
From your PHP application, how can you send the same header twice, but with different values?
- Question #51
Which class of HTTP status codes is used for server error conditions?
- Question #52
Which class of HTTP status codes is used for redirections?
- Question #53
Which of the following can NOT be used to send a cookie from within a PHP application?
- Question #54
Under what condition may HTTP headers be set from PHP if there is content echoed prior to the header function being used?
- Question #55
Before the headers are sent, how can you remove a previously set header?
- Question #56
How can you determine whether a PHP script has already sent cookies to the client?
- Question #57
An HTML form has two submit buttons. After submitting the form, how can you determine with PHP which button was clicked?