Java OCA OCP Practice Question 1124

Question

What is the value of x after the following operation is performed?

x = 23 % 4; 
  • A. 23
  • B. 4
  • C. 5.3
  • D. 3
  • E. 5


D.

Note

The modulo (%) operator returns the leftover value after a division operation.

In the given example, 23 / 4 = 5, with 3 remaining after the division.

Therefore, the answer is 3.




PreviousNext

Related