Free 200-550 Exam Braindumps (page: 23)

Page 22 of 56

How many times will the function counter() be executed in the following code?
function counter($start, &$stop)
{
if ($stop > $start)
{
return;
}
counter($start--, ++$stop);
}
$start = 5;
$stop = 2;
counter($start, $stop);

  1. 3
  2. 4
  3. 5
  4. 6

Answer(s): C



How do you allow the caller to submit a variable number of arguments to a function?

  1. Using a prototype like function test(... $parameters).
  2. Using a prototype like function test() and the function func_get_args() inside the function body.
  3. Using a prototype like function test($parameters[]).
  4. Using a prototype like function test() and the function get_variable_args() inside the function body.
  5. This is not possible in PHP.

Answer(s): B



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 = array (1, 2, 3);
modifyArray($array);

  1. 2, 3, 4
  2. 2, 3, 6
  3. 4, 5, 6
  4. 1, 2, 3

Answer(s): B



What is the output of the following code?
class a
{
public $val;
}
function renderVal (a $a)
{
if ($a) {
echo $a->val;
}
}
renderVal (null);

  1. A syntax error in the function declaration line
  2. An error, because null is not an instance of 'a'
  3. Nothing, because a null value is being passed to renderVal()
  4. NULL

Answer(s): B






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

200-550 Discussions & Posts