Bird
0
0

Which statement about Kotlin's repeat function is TRUE?

hard📝 Conceptual Q10 of 15
Kotlin - Loops and Ranges
Which statement about Kotlin's repeat function is TRUE?
Arepeat executes the block exactly n times with index from 0 to n-1
Brepeat returns a list of results from each block execution
Crepeat can only be used with print statements
Drepeat automatically delays execution between iterations
Step-by-Step Solution
Solution:
  1. Step 1: Recall repeat function behavior

    repeat runs the block n times with index from 0 to n-1, no return value.
  2. Step 2: Evaluate each option

    Only repeat executes the block exactly n times with index from 0 to n-1 correctly describes repeat's behavior; others are false.
  3. Final Answer:

    repeat executes the block exactly n times with index from 0 to n-1 -> Option A
  4. Quick Check:

    repeat runs block n times, no return list [OK]
Quick Trick: repeat runs block n times with index 0 to n-1 [OK]
Common Mistakes:
MISTAKES
  • Thinking repeat returns a list
  • Assuming it delays execution
  • Believing it only works with print

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes