Multiple choice technology programming languages

Given: class Sixties { public static void main(String[] args) { int x = 5; int y = 7; System.out.print(((y * 2) % x)); System.out.print(" " + (y % x)); } } What is the result?

  1. 1 1

  2. 1 2

  3. 2 1

  4. 2 2

  5. 4 1

  6. 4 2

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

First expression: (y * 2) % x = (7 * 2) % 5 = 14 % 5 = 4 (remainder of 14 divided by 5). Second expression: y % x = 7 % 5 = 2 (remainder of 7 divided by 5). The output is 4 2, with a space between the two print results.