Question:

What output will be produced by the code below?

var i = 2

repeat {
    i *= i * 2
} while i < 100

print(i)

Answer: 

128.

Explanation: Each time the loop goes around, the i is doubled then multiplied by itself. The first time through the loop it will be 8, and the second time it will be 128, at which point the loop will exit and print 128.

 


Keywords:

© 2017 QuizBucket.org