Bird
0
0

You want to create a range of letters from 'a' to 'e' excluding 'e'. Which Ruby code correctly does this?

hard📝 Application Q8 of 15
Ruby - Operators and Expressions
You want to create a range of letters from 'a' to 'e' excluding 'e'. Which Ruby code correctly does this?
A('a'..'e')
B('a'...'e')
C('a'...'f')
D('a'..'d')
Step-by-Step Solution
Solution:
  1. Step 1: Understand letter ranges and exclusion

    Using ... excludes the end value, so ('a'...'e') includes 'a' to 'd'.
  2. Step 2: Check other options

    ('a'..'e') includes 'e', ('a'...'f') excludes 'f' but includes 'e', and ('a'..'d') excludes 'e' but uses double dot.
  3. Final Answer:

    ('a'...'e') -> Option B
  4. Quick Check:

    Triple dot excludes end letter in range [OK]
Quick Trick: Triple dot excludes last letter in character range [OK]
Common Mistakes:
  • Using double dot when exclusion is needed
  • Choosing wrong end letter
  • Confusing letter ranges with numbers

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes