Question 1Easy
What is the output?
for (i in 1..10 step 4) print(i)- 1234
- 15
- 159
- 1591
Answer: C. 159
Explanation
step 4 adds 4 each time: 1, 5, 9. 13 exceeds 10.
Step-by-step solution
- 1.
- 1+4 = 5.
- 5+4 = 9; next 13 > 10, stop.
Why the other options are wrong
- A. step 4 skips values.
- B. 9 is still within 10.
- D. No extra element.