Multiple choice technology programming languages

What is the value of y? int y = 19 % 4;

  1. 2

  2. 3

  3. 4

  4. 4.75

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The modulo operator (%) returns the remainder of integer division. When 19 is divided by 4, the quotient is 4 and the remainder is 3 (since 19 = 4*4 + 3). Therefore 19 % 4 equals 3. The result is always an integer when both operands are integers.