nerdexam
CIW

1D0-635 · Question #9

Consider the following code: <script> var x = 0; for (i=0; i<5; i++) { x += i; } alert("1+2+3+4 = " +x); </script> How many times will the program loop, and what will be the final value of x?

The correct answer is A. 5, 10. See the full explanation below for the reasoning.

Question

Consider the following code:

<script> var x = 0; for (i=0; i<5; i++) { x += i; } alert("1+2+3+4 = " +x); </script> How many times will the program loop, and what will be the final value of x?

Options

  • A5, 10
  • B4, 9
  • C4, 5
  • D5, 5

How the community answered

(49 responses)
  • A
    82% (40)
  • B
    2% (1)
  • C
    6% (3)
  • D
    10% (5)

Community Discussion

No community discussion yet for this question.

Full 1D0-635 Practice