Operators And Expressions In C Sharp — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Operators And Expressions In C Sharp — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
29
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
35 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
29
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/29 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 29 questions answered.
Question 1 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Correct order of priorities are:
Correct Answer: Option C — '*' > '/' > '%' > '+'
Detailed Academic Explanation:
'*' > '/' > '%' > '+' is the correct answer to “Correct order of priorities are:”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 2 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a = 4; int b = 5; int c = 6; int d = 8; if (((a * b / c) + d) >= ((b * c + d ) / a)) { Console.WriteLine("Line 1 - a is greater to b"); Console.WriteLine((a * b / c) + d); } else { Console.WriteLine("Line 1 - a is not greater to b"); Console.WriteLine((b * c + d )/ a); } }
Correct Answer: Option A — "Line 1 - a is greater to b" 11
Detailed Academic Explanation:
"Line 1 - a is greater to b" 11 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a = 4; int b = 5; int c = 6; int d = 8; if (((a * b / c) + d) >= ((b * c + d ) / a)) { Console.WriteLine("Line 1 - a is greater to b"); Console.WriteLine((a * b / c) + d); } else { Console.WriteLine("Line 1 - a is not greater to b"); Console.WriteLine((b * c + d )/ a); } }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 3 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which among the following is a conditional operator?
Correct Answer: Option C — ?:
Detailed Academic Explanation:
?: is the correct answer to “Which among the following is a conditional operator”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 4 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { byte varA = 10; byte varB = 20; long result = varA & varB; Console.WriteLine("{0} AND {1} Result :{2}", varA, varB, result); varA = 10; varB = 10; result = varA & varB; Console.WriteLine("{0} AND {1} Result : {2}", varA, varB, result); Console.ReadLine(); }
Correct Answer: Option C — 0, 10
Detailed Academic Explanation:
0, 10 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { byte varA = 10; byte varB = 20; long result = varA & varB; Console.WriteLine("{0} AND {1} Result :{2}", varA, varB, result); varA = 10; varB = 10; result = varA & varB; Console.WriteLine("{0} AND {1} Result : {2}", varA, varB, result); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 5 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? m = 5; int y; 1. y = m++; 2. y = ++m;
Correct Answer: Option C — y = 5, m = 6; y = 7, m = 7
Detailed Academic Explanation:
y = 5, m = 6; y = 7, m = 7 is the correct answer to “What will be the output of the following C# code? m = 5; int y; 1. y = m++; 2. y = ++m;”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 6 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Select the relevant C# code set to fill up the blank for the following C# program? static void Main(string[] args) { int x = 10, y = 20; int res; /*_______________*/ Console.WriteLine(res); }
Correct Answer: Option B — x % y == 0 ? y += 10:(x += 10)
Detailed Academic Explanation:
x % y == 0 ? y += 10:(x += 10) is the correct answer to “Select the relevant C# code set to fill up the blank for the following C# program? static void Main(string[] args) { int x = 10, y = 20; int res; /*_______________*/ Console.WriteLine(res); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 7 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int m = 10, n = 5, p = 20; bool b1 = m * p / n <= p * n / m ; int l = p - 2 * m; bool b2 = l == 0; int z = Convert.ToInt32(b2); int k = Convert.ToInt32(b1); Console.WriteLine(k); Console.WriteLine(z); }
Correct Answer: Option C — 0 1
Detailed Academic Explanation:
0 1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int m = 10, n = 5, p = 20; bool b1 = m * p / n <= p * n / m ; int l = p - 2 * m; bool b2 = l == 0; int z = Convert.ToInt32(b2); int k = Convert.ToInt32(b1); Console.WriteLine(k); Console.WriteLine(z); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 8 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int y = 5; int x; int k = (!(Convert.ToInt32(y) > 10))? x = y + 3 : x = y + 10; Console.WriteLine(x); Console.WriteLine(y); Console.ReadLine(); }
Correct Answer: Option C — 8, 5
Detailed Academic Explanation:
8, 5 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int y = 5; int x; int k = (!(Convert.ToInt32(y) > 10))? x = y + 3 : x = y + 10; Console.WriteLine(x); Console.WriteLine(y); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 9 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following options is not a Bitwise Operator in C#?
Correct Answer: Option D — +=, -=
Detailed Academic Explanation:
+=, -= is the correct answer to “Which of the following options is not a Bitwise Operator in C#”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 10 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Arrange the operators in the increasing order as defined in C#. !=, ?:, &, ++, &&
Correct Answer: Option C — ?: < && < & <!= < ++
Detailed Academic Explanation:
?: < && < & <!= < ++ is the correct answer to “Arrange the operators in the increasing order as defined in C#. !=, ?:, &, ++, &&”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 11 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? public static void Main() { byte varA = 10; byte varB = 20; long result = varA | varB; Console.WriteLine("{0} OR {1} Result :{2}", varA, varB, result); varA = 10; varB = 10; result = varA | varB; Console.WriteLine("{0} OR {1} Result : {2}", varA, varB, result); }
Correct Answer: Option B — 30, 10
Detailed Academic Explanation:
30, 10 is the correct answer to “What will be the output of the following C# code? public static void Main() { byte varA = 10; byte varB = 20; long result = varA | varB; Console.WriteLine("{0} OR {1} Result :{2}", varA, varB, result); varA = 10; varB = 10; result = varA | varB; Console.WriteLine("{0} OR {1} Result : {2}", varA, varB, result); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 12 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a, b, c, x; a = 90; b = 15; c = 3; x = a - b / 3 + c * 2 - 1; Console.WriteLine(x); Console.ReadLine(); }
Correct Answer: Option C — 90
Detailed Academic Explanation:
90 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a, b, c, x; a = 90; b = 15; c = 3; x = a - b / 3 + c * 2 - 1; Console.WriteLine(x); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 13 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { float a = 16.4f; int b = 12; float c; c = a * ( b + a) / (a - b) ; Console.WriteLine("result is :" +c); Console.ReadLine(); }
Correct Answer: Option C — 105.8546
Detailed Academic Explanation:
105.8546 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { float a = 16.4f; int b = 12; float c; c = a * ( b + a) / (a - b) ; Console.WriteLine("result is :" +c); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 14 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Check the following C# code whether the given relation operator works according to the if condition or not. static void Main(string[] args) { int a = 10; int b = 5; int c = 12; int e = 8; int d; d = Convert.ToInt32((a * (c - b) / e + (b + c)) <= (e * (c + a) / (b + c) + a)); Console.WriteLine(d); if (d == 1) { Console.WriteLine("C# is great language!"); Console.WriteLine((a * (c - b) / e + (b + c))); } else { Console.WriteLine("harsh is not great language!"); Console.WriteLine((e * (c + a) / (b + c) + a)); } }
Correct Answer: Option D — 0 C# is not great! 20
Detailed Academic Explanation:
0 C# is not great! 20 is the correct answer to “Check the following C# code whether the given relation operator works according to the if condition or not. static void Main(string[] args) { int a = 10; int b = 5; int c = 12; int e = 8; int d; d = Convert.ToInt32((a * (c - b) / e + (b + c)) <= (e * (c + a) / (b + c) + a)); Console.WriteLine(d); if (d == 1) { Console.WriteLine("C# is great language!"); Console.WriteLine((a * (c - b) / e + (b + c))); } else { Console.WriteLine("harsh is not great language!"); Console.WriteLine((e * (c + a) / (b + c) + a)); } }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 15 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? public static void Main(string[] args) { int a = 4; int c = 2; bool b = (a % c == 0 ? true : false); Console.WriteLine(b.ToString()); if (a/c == 2) { Console.WriteLine("true"); } else { Console.WriteLine("false"); } Console.ReadLine(); }
Correct Answer: Option C — TRUE TRUE
Detailed Academic Explanation:
TRUE TRUE is the correct answer to “What will be the output of the following C# code? public static void Main(string[] args) { int a = 4; int c = 2; bool b = (a % c == 0 ? true : false); Console.WriteLine(b.ToString()); if (a/c == 2) { Console.WriteLine("true"); } else { Console.WriteLine("false"); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 16 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a = 3, b = 5, c = 1; int z = ++b; int y = ++c; b = Convert.ToInt32((Convert.ToBoolean(z)) && (Convert.ToBoolean(y)) || Convert.ToBoolean(Convert.ToInt32(!(++a == b)))); a = Convert.ToInt32(Convert.ToBoolean(c) || Convert.ToBoolean(a--)); Console.WriteLine(++a); Console.WriteLine(++b); Console.WriteLine(c); }
Correct Answer: Option C — 2, 2, 2
Detailed Academic Explanation:
2, 2, 2 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a = 3, b = 5, c = 1; int z = ++b; int y = ++c; b = Convert.ToInt32((Convert.ToBoolean(z)) && (Convert.ToBoolean(y)) || Convert.ToBoolean(Convert.ToInt32(!(++a == b)))); a = Convert.ToInt32(Convert.ToBoolean(c) || Convert.ToBoolean(a--)); Console.WriteLine(++a); Console.WriteLine(++b); Console.WriteLine(c); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 17 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a = 8, b = 6, c = 10; int d = a * c * 2 / Convert.ToInt32(Math.Pow ((c - b), 2)); if (d == (c = Convert.ToInt32(Math.Sqrt (a * a + b * b))) && c == 10) { Console.WriteLine("figure is hypotenuse"); } else { Console.WriteLine("figure is square"); } }
Correct Answer: Option A — Figure is square
Detailed Academic Explanation:
Figure is square is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a = 8, b = 6, c = 10; int d = a * c * 2 / Convert.ToInt32(Math.Pow ((c - b), 2)); if (d == (c = Convert.ToInt32(Math.Sqrt (a * a + b * b))) && c == 10) { Console.WriteLine("figure is hypotenuse"); } else { Console.WriteLine("figure is square"); } }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 18 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int n = 5; int x = 4; int z, c, k; for (c = 1; c <= n; c++) { for (k = 1; k <= c; k++) { z = 3 * x * x + 2 * x + 4 / x + 8; Console.Write(Convert.ToString(Convert.ToChar(z))); } Console.WriteLine("\n"); } Console.ReadLine(); }
Correct Answer: Option C — A AA AAA AAAA AAAAA
Detailed Academic Explanation:
A AA AAA AAAA AAAAA is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int n = 5; int x = 4; int z, c, k; for (c = 1; c <= n; c++) { for (k = 1; k <= c; k++) { z = 3 * x * x + 2 * x + 4 / x + 8; Console.Write(Convert.ToString(Convert.ToChar(z))); } Console.WriteLine("\n"); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 19 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? int n = 2; int p = 4; int q = 5; int w = 3; if ( !((p * q) /n <= (q * w) + n/p )) { Console.WriteLine( ++p + w++ + " " + ++n); Console.WriteLine("b"); } else { Console.WriteLine(--p + q-- + " " + --n); Console.WriteLine("a"); }
Correct Answer: Option B — 8 1 a
Detailed Academic Explanation:
8 1 a is the correct answer to “What will be the output of the following C# code? int n = 2; int p = 4; int q = 5; int w = 3; if ( !((p * q) /n <= (q * w) + n/p )) { Console.WriteLine( ++p + w++ + " " + ++n); Console.WriteLine("b"); } else { Console.WriteLine(--p + q-- + " " + --n); Console.WriteLine("a"); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 20 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? bool a = true; bool b = false; a |= b; Console.WriteLine(a); Console.ReadLine();
Correct Answer: Option C — True
Detailed Academic Explanation:
True is the correct answer to “What will be the output of the following C# code? bool a = true; bool b = false; a |= b; Console.WriteLine(a); Console.ReadLine();”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 21 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a = 4, b = 5, c = 7, u = 9; int h; h = (Convert.ToInt32(u < b)) + (a + b--) + 2; Console.WriteLine(h); Console.WriteLine(b); Console.WriteLine(u < b); }
Correct Answer: Option B — 11, 4, False
Detailed Academic Explanation:
11, 4, False is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a = 4, b = 5, c = 7, u = 9; int h; h = (Convert.ToInt32(u < b)) + (a + b--) + 2; Console.WriteLine(h); Console.WriteLine(b); Console.WriteLine(u < b); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 22 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a , b; int c = 10; int d = 12; int e = 5; int f = 6; a = c * (d + e) / f + d; Console.WriteLine(a); b = c * ( d + e / f + d); Console.WriteLine(b); if (a < b) { Console.WriteLine(" parentheses changes values"); } else if (a > b) { Counterintelligence("they have same value"); } Console.ReadLine(); }
Correct Answer: Option B — Parentheses changes values
Detailed Academic Explanation:
Parentheses changes values is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a , b; int c = 10; int d = 12; int e = 5; int f = 6; a = c * (d + e) / f + d; Console.WriteLine(a); b = c * ( d + e / f + d); Console.WriteLine(b); if (a < b) { Console.WriteLine(" parentheses changes values"); } else if (a > b) { Counterintelligence("they have same value"); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 23 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is/are not Relational operators in C#.NET?
Correct Answer: Option B — <>=
Detailed Academic Explanation:
<>= is the correct answer to “Which of the following is/are not Relational operators in C#.NET”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 24 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a, b, c, x; a = 80; b = 15; c = 2; x = a - b / (3 * c) * ( a + c); Console.WriteLine(x); Console.ReadLine(); }
Correct Answer: Option B — -84
Detailed Academic Explanation:
-84 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a, b, c, x; a = 80; b = 15; c = 2; x = a - b / (3 * c) * ( a + c); Console.WriteLine(x); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 25 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { byte b1 = 0 * AB; byte b2 = 0 * 99; byte temp; temp = (byte) ~b2; Console.Write( temp + " "); temp = (byte) (b1 << b2); Console.Write(temp + " "); temp = (byte)(b2 >> 2); Console.WriteLine(temp); Console.ReadLine(); }
Correct Answer: Option C — 102 0 38
Detailed Academic Explanation:
102 0 38 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { byte b1 = 0 * AB; byte b2 = 0 * 99; byte temp; temp = (byte) ~b2; Console.Write( temp + " "); temp = (byte) (b1 << b2); Console.Write(temp + " "); temp = (byte)(b2 >> 2); Console.WriteLine(temp); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 26 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int n = 5; int x = 4; int z, c, k; z = 3 * x * x + 2 * x + 4 / x + 8; for (c = 1; c <= n; c++) { for (k = 1; k <= c; k++) { Console.Write(Convert.ToString(Convert.ToChar(z))); z++; } Console.WriteLine("\n"); } Console.ReadLine(); }
Correct Answer: Option C — A BC DEF GHIJ KLMNO
Detailed Academic Explanation:
A BC DEF GHIJ KLMNO is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int n = 5; int x = 4; int z, c, k; z = 3 * x * x + 2 * x + 4 / x + 8; for (c = 1; c <= n; c++) { for (k = 1; k <= c; k++) { Console.Write(Convert.ToString(Convert.ToChar(z))); z++; } Console.WriteLine("\n"); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 27 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? int i, j = 1, k; for (i = 0; i < 3; i++) { k = j++ - ++j; Console.Write(k + " "); }
Correct Answer: Option C — -2 -2 -2
Detailed Academic Explanation:
-2 -2 -2 is the correct answer to “What will be the output of the following C# code? int i, j = 1, k; for (i = 0; i < 3; i++) { k = j++ - ++j; Console.Write(k + " "); }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 28 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The correct way of incrementing the operators are:
Correct Answer: Option C — c += 1
Detailed Academic Explanation:
c += 1 is the correct answer to “The correct way of incrementing the operators are:”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
Question 29 of 29
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? class method1 { public int fun(int m) { return( m++ % 10); } } class Program { static void Main(string[] args) { int a = 23, b = 0, c; method1 z = new method1(); c = z.fun (++b * --a % 2); int d = (z.fun (c-- + --a)); Console.WriteLine(c); Console.WriteLine(a++); Console.WriteLine(d); Console.ReadLine(); } }
Correct Answer: Option B — -1, 21, 1
Detailed Academic Explanation:
-1, 21, 1 is the correct answer to “What will be the output of the following C# code? class method1 { public int fun(int m) { return( m++ % 10); } } class Program { static void Main(string[] args) { int a = 23, b = 0, c; method1 z = new method1(); c = z.fun (++b * --a % 2); int d = (z.fun (c-- + --a)); Console.WriteLine(c); Console.WriteLine(a++); Console.WriteLine(d); Console.ReadLine(); } }”. This question is standard in competitive examination syllabi for Operators And Expressions In C Sharp.
💡Key Conceptual Anchor:Operators And Expressions In C Sharp
✓Link copied to clipboard
Continue Your Practice
Advance Html — Part 1
Master the next curriculum module with 40 exam-standard MCQs.
💡Examiner's Advisory for Programming & Software Development
In competitive commission exams (FPSC, PPSC, KPPSC, SPSC, CSS, PMS), questions are frequently phrased with distractor options designed to catch rote learners. Whenever you answer an MCQ, read the Detailed Academic Explanation and Conceptual Anchor to understand why the remaining options are incorrect.