200-550 Exam Questions
221 real 200-550 exam questions with expert-verified answers and explanations. Page 2 of 5.
- Question #58
What is the output of the following code? function append($str) { $str = $str.'append'; } function prepend(&$str) { $str = 'prepend'.$str; } $string = 'zce'; append(prepend($string...
- Question #62
How many times will the function counter() be executed in the following code? function counter($start, &$stop) { if ($stop > $start) { return; } counter($start--, ++$stop); } $star...
- Question #63
How do you allow the caller to submit a variable number of arguments to a function?
- Question #64
What will the $array array contain at the end of this script? function modifyArray (&$array) { foreach ($array as &$value) { $value = $value + 1; } $value = $value + 2; } $array =...
- Question #65
What is the output of the following code? class a { public $val; } function renderVal (a $a) { if ($a) { echo $a->val; } } renderVal (null);
- Question #66
What is the output of the following code? function fibonacci (&$x1 = 0, &$x2 = 1) { $result = $x1 + $x2; $x1 = $x2; $x2 = $result; return $result; } for ($i = 0; $i < 10; $i++) { e...
- Question #67
What is the output of the following code? function ratio ($x1 = 10, $x2) { if (isset ($x2)) { return $x2 / $x1; } } echo ratio (0);
- Question #68
Which of the following is NOT a valid function declaration?
- Question #70
Which of the following is true about stream contexts? (Choose 2)
- Question #72
What function can be used to retrieve an array of current options for a stream context?
- Question #73
When retrieving data from URLs, what are valid ways to make sure all file_get_contents calls send a certain user agent string? (Choose 2)
- Question #74
What will an opcode cache ALWAYS automatically improve?
- Question #75
What is cached by an opcode cache?
- Question #76
Which php.ini setting is usually required to use an opcode cache?
- Question #77
What is the output of the following code? var_dump(boolval(-1));
- Question #78
What is the output of the following code? var_dump(boolval([]));
- Question #79
What is the output of the following code? var_dump(boolval(new StdClass()));
- Question #81
Which of the following is NOT true about PHP traits? (Choose 2)
- Question #82
Given the following code, what will the output be: trait MyTrait { private $abc = 1; public function increment() { $this->abc++; } public function getValue() { return $this->abc; }...
- Question #83
Given the following code, how can we use both traits A and B in the same class? (select all that apply) trait A { public function hello() { return "hello"; } public function world(...
- Question #84
In the following code, which line should be changed so it outputs the number 2: class A { protected $x = array(); /* A */ public function getX() { /* B */ return $this->x; /* C */...
- Question #85
What is the output of the following code? class A { public $a = 1; public function __construct($a) { $this->a = $a; } public function mul() { return function($x) { return $this->a*...
- Question #87
What is the output of the following code? class Number { private $v; private static $sv = 10; public function __construct($v) { $this->v = $v; } public function mul() { return stat...
- Question #88
Which of the following statements about anonymous functions in PHP are NOT true? (Choose 2)
- Question #89
What will be the result of the following operation? $a = array_merge([1,2,3] + [4=>1,5,6]); echo $a[2];
- Question #90
What is the return value of the following code substr_compare("foobar", "bar", 3);
- Question #91
What function can be used to retrieve an array of current options for a stream context?
- Question #92
What is the difference between "print" and "echo"?
- Question #93
What is the preferred method for preventing SQL injection?
- Question #94
Is the following code vulnerable to SQL Injection ($mysqli is an instance of the MySQLi class)? $age = $mysqli->real_escape_string($_GET['age']); $name = $mysqli->real_escape_strin...
- Question #95
Which of the following does NOT help to protect against session hijacking and fixation attacks?
- Question #97
Which of the following PHP functions can be used to set the HTTP response code? (Choose 2)
- Question #98
What is the name of the header used to require HTTP authentication?
- Question #99
What types of HTTP authentication are supported by PHP? (Choose 2)
- Question #100
Which of the following items in the $_SERVER superglobal are important for authenticating the client when using HTTP Basic authentication? (Choose 2)
- Question #101
When tracking upload progress with sessions, the values of 2 INI settings are needed to determine the key in $_SESSION of the upload progress data. What are the INI settings? (Choo...
- Question #102
What is the name of the function that allows you register a set of functions that implement user- defined session handling?
- Question #103
Which of these databases is NOT supported by a PDO driver?
- Question #104
Which of these statements about PDO is NOT true?
- Question #105
What is the output of the following code? class test { public $value = 0; function test() { $this->value = 1; } function __construct() { $this->value = 2; } } $object = new test();...
- Question #106
Which methods can be used to overload object properties? (Choose 2)
- Question #107
What is the result of the following code? class T { const A = 42 + 1; } echo T::A;
- Question #108
Which of the following statements is NOT true?
- Question #109
What is the result of the following code? define('PI', 3.14); class T { const PI = PI; } class Math { const PI = T::PI; } echo Math::PI;
- Question #110
Given the following code, what is correct? function f(stdClass &$x = NULL) { $x = 42; } $z = new stdClass; f($z); var_dump($z);
- Question #111
Which of the following statements is NOT correct?
- Question #112
Which of the following statements is correct?
- Question #113
Which of the following statements about exceptions is correct? (Choose 2)
- Question #114
What is the output of the following code? try { class MyException extends Exception {}; try { throw new MyException; } catch (Exception $e) { echo "1:"; throw $e; } catch (MyExcept...
- Question #116
What is the name of the method that can be used to provide read access to virtual properties in a class?