Bird
0
0

How can you check if a character ch is an uppercase English letter using ranges in Kotlin?

hard📝 Application Q9 of 15
Kotlin - Operators and Expressions
How can you check if a character ch is an uppercase English letter using ranges in Kotlin?
Ach in "A".."Z"
Bch in 'a'..'z'
Cch in 'A'..'Z'
Dch in 'Z'..'A'
Step-by-Step Solution
Solution:
  1. Step 1: Understand character ranges

    Characters can be compared using ranges like 'A'..'Z' for uppercase letters.
  2. Step 2: Check options

    ch in 'A'..'Z' correctly checks if ch is between 'A' and 'Z'.
  3. Final Answer:

    ch in 'A'..'Z' -> Option C
  4. Quick Check:

    Character ranges use single quotes and '..' [OK]
Quick Trick: Use 'A'..'Z' to check uppercase letters [OK]
Common Mistakes:
MISTAKES
  • Using double quotes for chars
  • Reversing range order
  • Checking lowercase range instead

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes