Free 200-550 Exam Braindumps (page: 9)

Page 8 of 56

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);

  1. 22333
  2. 33222
  3. 33322
  4. 222333

Answer(s): B



What is the output of the following code?
$f = function () { return "hello"; };
echo gettype($f);

  1. hello
  2. string
  3. object
  4. function

Answer(s): C



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 (string) --$this->x; }
}
$obj = new C();
echo $obj();

  1. 0
  2. 1
  3. 2
  4. 3

Answer(s): D



CORRECT TEXT
Consider the following code. Which keyword should be used in the line marked with "KEYWORD" instead of "self" to make this code work as intended?
abstract class Base {
protected function __construct() {
}
public static function create() {
return new self(); // KEYWORD
}
abstract function action();
}
class Item extends Base {
public function action() { echo __CLASS__; }
}
$item = Item::create();
$item->action(); // outputs "Item"

  1. static

Answer(s): A






Post your Comments and Discuss Zend 200-550 exam with other Community members:

200-550 Discussions & Posts