Bird
0
0

What does the range expression 1..5 represent in Kotlin?

easy📝 Conceptual Q1 of 15
Kotlin - Loops and Ranges
What does the range expression 1..5 represent in Kotlin?
AA sequence of numbers from 1 to 5 inclusive
BA list containing numbers 1 and 5 only
CA function that returns 5
DA variable holding the value 1
Step-by-Step Solution
Solution:
  1. Step 1: Understand the range operator

    The .. operator creates a range including both start and end values.
  2. Step 2: Interpret 1..5

    This means all numbers starting at 1 up to and including 5.
  3. Final Answer:

    A sequence of numbers from 1 to 5 inclusive -> Option A
  4. Quick Check:

    Range expression = sequence inclusive [OK]
Quick Trick: Ranges include both start and end numbers [OK]
Common Mistakes:
MISTAKES
  • Thinking range excludes the end number
  • Confusing range with list
  • Assuming range is a single value

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes