Q. What is the output of the following code?
Code:
int x = 5; int y = 3; System.out.println(x % y);
β
Correct Answer: (D)
2
Explanation: The modulus operator (%) returns the remainder of integer division. In this case, 5 divided by 3 has a remainder of 2, which is printed to the console.