0%
0 / 15 answered
Iteration Practice Test
•15 QuestionsQuestion
1 / 15
Q1
A student generates a numeric pattern for a display by iterating a fixed number of steps. Examine the following code snippet:
`result <- ""
FOR (i <- 1; i <= 4; i <- i + 1) // initialization, condition, update
{
result <- result + (i * 2) + " " // append even number and a space
}
PRINT(result) // prints the built sequence`
What is the output of the following loop?
A student generates a numeric pattern for a display by iterating a fixed number of steps. Examine the following code snippet:
`result <- ""
FOR (i <- 1; i <= 4; i <- i + 1) // initialization, condition, update
{
result <- result + (i * 2) + " " // append even number and a space
}
PRINT(result) // prints the built sequence`
What is the output of the following loop?