Bird
0
0

Given val x = 10, val y = 3, what is the result of this Kotlin expression?

hard📝 Application Q9 of 15
Kotlin - Operators and Expressions
Given val x = 10, val y = 3, what is the result of this Kotlin expression?
val result = x / y + x % y
A6
B7
C4
D3
Step-by-Step Solution
Solution:
  1. Step 1: Calculate integer division x / y

    10 / 3 = 3 (integer division truncates decimals).
  2. Step 2: Calculate modulus x % y

    10 % 3 = 1 (remainder of division).
  3. Step 3: Add the two results

    3 + 1 = 4.
  4. Step 4: Re-check options

    7 is 7, 6 is 6, 4 is 4. The correct sum is 4.
  5. Final Answer:

    4 -> Option C
  6. Quick Check:

    Division plus remainder = 4 [OK]
Quick Trick: Add quotient and remainder carefully [OK]
Common Mistakes:
MISTAKES
  • Adding before division
  • Mixing up remainder and quotient
  • Choosing wrong option number

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kotlin Quizzes