Skip to content

Module 4 quiz on FOR loops :Java for Android (Android App Development Specialization) Answers 2025

1. Loop from i = 1 to i < 5 → prints 4 times

✔️ 4
❌ 0
❌ 5
❌ 6
❌ infinitely many


2. Loop from i = 5 down to 0 → prints 6 times (5,4,3,2,1,0)

✔️ 6
❌ 0
❌ 4
❌ 5
❌ infinitely many


3. Inner loop wrongly reuses i → becomes infinite loop

✔️ infinitely many
❌ 0
❌ 4
❌ 5
❌ 6


4. Total prints = 0 + 1 + 2 + 3 + 4 = 10

✔️ 10
❌ 0
❌ 5
❌ 15
❌ infinitely many


5. Loop must run 10 times, from i = 6 to 15

✔️ 6
(15 − 6 + 1 = 10 iterations)


6. Inner loop runs only when j > i, but j starts at 1 → never runs → 0 stars

✔️ 0
❌ 5
❌ 10
❌ 15
❌ infinitely many


7. Sequence: 5 13 21 29 37 45 53 61

This is an arithmetic sequence:

  • First term = 5

  • Common difference = 8

Formula: 8*i – 3

✔️ 8*i-3


8. Pattern star count decreases: 9, 7, 5, 3, 1

Stars = 11 − 2*i
(or equivalently: -2*i+11)

✔️ -2*i+11


Summary Table

Q No. Correct Answer
1 4
2 6
3 infinitely many
4 10
5 6
6 0
7 8*i-3
8 -2*i+11