Bird
0
0

What is the size of the Char type in Kotlin in terms of bits?

easy📝 Conceptual Q1 of 15
Kotlin - Data Types
What is the size of the Char type in Kotlin in terms of bits?
A8 bits
B16 bits
C32 bits
D64 bits
Step-by-Step Solution
Solution:
  1. Step 1: Understand Kotlin Char type storage

    Kotlin's Char type stores a single Unicode character using 16 bits, similar to Java's char.
  2. Step 2: Confirm size in bits

    Since Unicode characters in Kotlin are UTF-16 encoded, each Char occupies 16 bits.
  3. Final Answer:

    16 bits -> Option B
  4. Quick Check:

    Char size = 16 bits [OK]
Quick Trick: Kotlin Char uses UTF-16 encoding, so size is 16 bits [OK]
Common Mistakes:
MISTAKES
  • Confusing Char size with Byte size (8 bits)
  • Assuming Char is 32 bits like Int
  • Thinking Char is 64 bits like Long

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes