nerdexam
Zend

200-530 · Question #118

What is the output of the following script? 1 <?php 2 function fibonacci ($x1, $x2) 3 { 4 return $x1 + $x2; 5 } 7 $x1 = 0; 8 $x2 = 1; 10 for ($i = 0; $i < 10; $i++) { 11 echo fibonacci($x1, $x2)…

The correct answer is D. 1,1,1,1,1,1,1,1,1,1. See the full explanation below for the reasoning.

Question

What is the output of the following script? 1 <?php 2 function fibonacci ($x1, $x2) 3 { 4 return $x1 + $x2; 5 } 7 $x1 = 0; 8 $x2 = 1; 10 for ($i = 0; $i < 10; $i++) { 11 echo fibonacci($x1, $x2) . ','; 12 } 13 ?> Zend 200-530 Exam

Options

  • A1,2,3,4,5,6,7,8,9
  • B1,2,3,4,5,6,7,8,9,10,
  • C1,2,3,5,8,13,21,34,55,89,
  • D1,1,1,1,1,1,1,1,1,1,

How the community answered

(48 responses)
  • A
    2% (1)
  • B
    4% (2)
  • C
    10% (5)
  • D
    83% (40)

Community Discussion

No community discussion yet for this question.

Full 200-530 Practice