0%
0 / 15 answered

Iteration Practice Test

15 Questions
Question
1 / 15
Q1

A game loop updates a player's score each time a coin is collected. Examine the following code snippet:

`coins <- true, false, true, true

score <- 0

index <- 0 // initialization

WHILE (index < LENGTH(coins))

{

IF (coinsindex = true)

{

 score <- score + 10     // update game state

}

index <- index + 1 // advance to next coin event

}

PRINT(score) // prints final score`

What is the output of the following loop?

Question Navigator