Bird
0
0

What does the % operator do in Ruby?

easy📝 Conceptual Q2 of 15
Ruby - Operators and Expressions
What does the % operator do in Ruby?
ADivides two numbers
BMultiplies two numbers
CSubtracts two numbers
DCalculates the remainder of division
Step-by-Step Solution
Solution:
  1. Step 1: Understand the % operator in Ruby

    The % operator returns the remainder after division.
  2. Step 2: Match the operator function to options

    Only Calculates the remainder of division correctly describes the remainder operation.
  3. Final Answer:

    Calculates the remainder of division -> Option D
  4. Quick Check:

    % operator = remainder [OK]
Quick Trick: Use % to get remainder after division [OK]
Common Mistakes:
  • Thinking % does division
  • Confusing % with multiplication
  • Using % for subtraction

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Ruby Quizzes