Question
1.
int a;
String res;
if (a % 2 == 0)
res = "Even";
else
res = "Odd";
2.
int a;
String res;
if (a Mod 2 == 0)
res = "Even";
else
res = "Odd";
3.
int a;
Console.WriteLine(a Mod 2 == 0 ? "Even": "Odd");
4.
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
Posted under C# programming
Engage with the Community - Add Your Comment
Confused About the Answer? Ask for Details Here.
Know the Explanation? Add it Here.
Q. Which of the following code snippets are the correct way to determine whether a is Odd or Even?
Similar Questions
Discover Related MCQs
Q. Which of the following is the incorrect form of Decision Control instruction?
View solution
Q. Which of the following statements is correct?
View solution
Suggested Topics
Are you eager to expand your knowledge beyond C# programming? We've curated a selection of related categories that you might find intriguing.
Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!