RECF Programming Practice Test

Access More Questions
What does the modulo operator (%) do?
Correct Answer:
It yields the remainder of division (a % b gives the remainder of a divided by b)
Explanation:
Modulo computes the remainder after dividing one number by another. When you divide a by b, you get a quotient (how many times b fits into a) and a remainder (what’s left). The expression a % b returns that remainder. For example, 7 % 3 is 1, because 3 goes into 7 twice with 1 leftover. Similarly, 9 % 3 is 0, since 3 fits perfectly into 9 with nothing left over. This is not the quotient, nor the sum, nor the product. Modulo is handy for tasks like checking if a number is even (n % 2 gives 0 for even numbers) or wrapping around indices in circular structures.

Access more questions from this quiz

Continue to RECF Programming Practice Test for more practice questions and the full quiz experience.

Access More Questions