Bird
0
0

Which of the following Ruby expressions correctly calculates the remainder of 10 divided by 3?

easy📝 Syntax Q12 of 15
Ruby - Operators and Expressions
Which of the following Ruby expressions correctly calculates the remainder of 10 divided by 3?
A10 - 3
B10 / 3
C10 * 3
D10 % 3
Step-by-Step Solution
Solution:
  1. Step 1: Understand the modulus operator

    The modulus operator (%) returns the remainder after division.
  2. Step 2: Identify the correct expression for remainder

    10 % 3 calculates the remainder when 10 is divided by 3, which is 1.
  3. Final Answer:

    10 % 3 -> Option D
  4. Quick Check:

    Remainder = % [OK]
Quick Trick: Use % to get remainder after division [OK]
Common Mistakes:
  • Using / instead of %
  • Using * or - which do not give remainder
  • Confusing % with division

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes