

MCQOPTIONS
Saved Bookmarks
1. |
Which of the following code snippets are the correct way to determine whether a is Odd or Even? int a; String res; if (a % 2 == 0) res = "Even"; else res = "Odd"; int a; String res; if (a Mod 2 == 0) res = "Even"; else res = "Odd"; int a; Console.WriteLine(a Mod 2 == 0 ? "Even": "Odd"); int a; String res; a % 2 == 0 ? res = "Even" : res = "Odd"; Console.WriteLine(res); |
A. | 1, 3 |
B. | 1 Only |
C. | 2, 3 |
D. | 4 Only |
E. | None of these |
Answer» C. 2, 3 | |