Control Flow Statements In C Sharp — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Control Flow Statements In C Sharp — Part 2 with worked academic solutions for FPSC, PPSC, NTS, NITB, PTS.
Questions
40
Difficulty Level
Exam-Level
Target Exams
FPSC, PPSC, NTS...
Estimated Time
48 mins
Exam-Level FPSC PPSC NTS NITB PTS
Verified for Commission Syllabus • Oct 14, 2026
40
Verified Practice Questions
Interactive test mode with detailed academic worked solutions
Live Progress|0/40 answered
✓0 correct
✗0 wrong
0% score
🎉 Set complete! All 40 questions answered.
Question 1 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is not infinite loop?
Correct Answer: Option B — for( ;'0'; )
Detailed Academic Explanation:
for( ;'0'; ) is the correct answer to “Which of the following is not infinite loop”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = -10; for ( ;Convert.ToBoolean(Convert.ToInt32(i)) ;Console.WriteLine(i++)) ; Console.ReadLine(); }
-10 -9 -8 -7 -6 -5 -4 -3 -2 -1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = -10; for ( ;Convert.ToBoolean(Convert.ToInt32(i)) ;Console.WriteLine(i++)) ; Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 2, k = 3; switch (i - k) { case -1: ++i; ++k; break; case 2: --i; ++k; break; default: i += 3; k += i; break; } Console.WriteLine(i + "\n" + k); Console.ReadLine(); }
Correct Answer: Option C — 3 4 4
Detailed Academic Explanation:
3 4 4 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 2, k = 3; switch (i - k) { case -1: ++i; ++k; break; case 2: --i; ++k; break; default: i += 3; k += i; break; } Console.WriteLine(i + "\n" + k); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 1, j; do { for (j = 1; ; j++) { if (j > 2) break; if (i == j) continue; Console.WriteLine(i + " " + j); } i++; } while (i < 3); Console.ReadLine(); }
Correct Answer: Option A — 1 2 2 1
Detailed Academic Explanation:
1 2 2 1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 1, j; do { for (j = 1; ; j++) { if (j > 2) break; if (i == j) continue; Console.WriteLine(i + " " + j); } i++; } while (i < 3); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i; Console.WriteLine("enter value of i:"); i = Convert.ToInt32(Console.ReadLine()); if ( i % 2 == 0) goto even: else { Console.WriteLine("number is odd:"); Console.ReadLine(); } even: Console.WriteLine("number is even:"); Console.ReadLine(); } for i = 4.
Correct Answer: Option C — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i; Console.WriteLine("enter value of i:"); i = Convert.ToInt32(Console.ReadLine()); if ( i % 2 == 0) goto even: else { Console.WriteLine("number is odd:"); Console.ReadLine(); } even: Console.WriteLine("number is even:"); Console.ReadLine(); } for i = 4.”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 2, j = 3, k = 4; switch (i + j - k) { case 0: case 2: case 4: ++i; k += j; break; case 1: case 3: case 5 : --i; k -= j; break; default: i += j; break; } Console.WriteLine(i + "\n" + j + "\n" + k); Console.ReadLine(); }
Correct Answer: Option A — 1 3 1
Detailed Academic Explanation:
1 3 1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 2, j = 3, k = 4; switch (i + j - k) { case 0: case 2: case 4: ++i; k += j; break; case 1: case 3: case 5 : --i; k -= j; break; default: i += j; break; } Console.WriteLine(i + "\n" + j + "\n" + k); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 1, j = 2, k = 3; do { Console.WriteLine((Convert.ToBoolean(Convert.ToInt32(i++))) && (Convert.ToBoolean(Convert.ToInt32(++j)))); }while (i <= 3); Console.ReadLine(); }
Correct Answer: Option B — True True True
Detailed Academic Explanation:
True True True is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 1, j = 2, k = 3; do { Console.WriteLine((Convert.ToBoolean(Convert.ToInt32(i++))) && (Convert.ToBoolean(Convert.ToInt32(++j)))); }while (i <= 3); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { char ch = Convert.ToChar('a' | 'b' | 'c'); switch (ch) { case 'A': case 'a': Console.WriteLine("case A|case a"); break; case 'B': case 'b': Console.WriteLine("case B|case b"); break; case 'C': case 'c': case 'D': case 'd': Console.WriteLine("case D|case d"); break; } Console.ReadLine(); }
Correct Answer: Option D — case D|case d
Detailed Academic Explanation:
case D|case d is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { char ch = Convert.ToChar('a' | 'b' | 'c'); switch (ch) { case 'A': case 'a': Console.WriteLine("case A|case a"); break; case 'B': case 'b': Console.WriteLine("case B|case b"); break; case 'C': case 'c': case 'D': case 'd': Console.WriteLine("case D|case d"); break; } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { float s = 0.1f; while (s <= 0.5f) { ++s; Console.WriteLine(s); } Console.ReadLine(); }
Correct Answer: Option B — 1.1
Detailed Academic Explanation:
1.1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { float s = 0.1f; while (s <= 0.5f) { ++s; Console.WriteLine(s); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int x = 10; do { Console.WriteLine( x++); } while(Convert.ToBoolean(5) && Convert.ToBoolean(4) && Convert.ToBoolean(3) && Convert.ToBoolean(2) && Convert.ToBoolean(1) && Convert.ToBoolean(0)); Console.ReadLine(); }
Correct Answer: Option D — 10
Detailed Academic Explanation:
10 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int x = 10; do { Console.WriteLine( x++); } while(Convert.ToBoolean(5) && Convert.ToBoolean(4) && Convert.ToBoolean(3) && Convert.ToBoolean(2) && Convert.ToBoolean(1) && Convert.ToBoolean(0)); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i; Console.WriteLine("enter value of i:"); i = Convert.ToInt32(Console.ReadLine()); if (i < 7) { i++; continue; } Console.WriteLine("final value of i:" +i); Console.ReadLine(); }
Correct Answer: Option C — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i; Console.WriteLine("enter value of i:"); i = Convert.ToInt32(Console.ReadLine()); if (i < 7) { i++; continue; } Console.WriteLine("final value of i:" +i); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 0; if (i == 0) { goto label; } label: Console.WriteLine("HI..."); Console.ReadLine(); }
Correct Answer: Option D — Hi...
Detailed Academic Explanation:
Hi... is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 0; if (i == 0) { goto label; } label: Console.WriteLine("HI..."); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 0; while (i++ != 0) ; Console.WriteLine(i); Console.ReadLine(); }
Correct Answer: Option C — 1
Detailed Academic Explanation:
1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 0; while (i++ != 0) ; Console.WriteLine(i); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 0; while (i <= 50) { if (i % 10 == 0) continue; else break; i += 10; Console.WriteLine(i % 10); } }
Correct Answer: Option C — infinite loop but doesn't print anything
Detailed Academic Explanation:
infinite loop but doesn't print anything is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 0; while (i <= 50) { if (i % 10 == 0) continue; else break; i += 10; Console.WriteLine(i % 10); } }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the correct syntax for do while loop?
Correct Answer: Option D — do { statement; }while (condition)
Detailed Academic Explanation:
do { statement; }while (condition) is the correct answer to “What is the correct syntax for do while loop”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 1; while (i <= 1) { if ('A' < 'a') { Console.WriteLine("Hello..."); } else { Console.WriteLine("Hi..."); } i++; } Console.ReadLine(); }
Correct Answer: Option B — Hello...
Detailed Academic Explanation:
Hello... is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 1; while (i <= 1) { if ('A' < 'a') { Console.WriteLine("Hello..."); } else { Console.WriteLine("Hi..."); } i++; } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a = 5, b = 10; if (Convert.ToBoolean(Convert.ToInt32(++a)) || Convert.ToBoolean(Convert.ToInt32(++b))) { Console.WriteLine(a + "\n" + b); } else Console.WriteLine(" C# "); }
Correct Answer: Option D — 6 10
Detailed Academic Explanation:
6 10 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a = 5, b = 10; if (Convert.ToBoolean(Convert.ToInt32(++a)) || Convert.ToBoolean(Convert.ToInt32(++b))) { Console.WriteLine(a + "\n" + b); } else Console.WriteLine(" C# "); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i, s = 0, a = 1, d; i = Convert.ToInt32(Console.ReadLine()); do { d = i % (2 * 4); s = s + d * a; }while ((Convert.ToInt32(i = i / (2 * 4))) != 0 && (Convert.ToBoolean(Convert.ToInt32((a) = (a * 10))))); Console.WriteLine(s); Console.ReadLine(); } enter i = 342.
Correct Answer: Option B — It finds octal equivalent of i
Detailed Academic Explanation:
It finds octal equivalent of i is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i, s = 0, a = 1, d; i = Convert.ToInt32(Console.ReadLine()); do { d = i % (2 * 4); s = s + d * a; }while ((Convert.ToInt32(i = i / (2 * 4))) != 0 && (Convert.ToBoolean(Convert.ToInt32((a) = (a * 10))))); Console.WriteLine(s); Console.ReadLine(); } enter i = 342.”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 1, j = 5; do { Console.WriteLine(i = i++ * j); }while (i <= 10); Console.ReadLine(); }
Correct Answer: Option B — 5 25
Detailed Academic Explanation:
5 25 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 1, j = 5; do { Console.WriteLine(i = i++ * j); }while (i <= 10); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 1, j = 1; while (++i <= 10) { j++; } Console.WriteLine(i+ " " +j); Console.ReadLine(); }
Correct Answer: Option C — 11 10
Detailed Academic Explanation:
11 10 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 1, j = 1; while (++i <= 10) { j++; } Console.WriteLine(i+ " " +j); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int I, J = 0; for (I = 1; I < 10; ) ; { J = J + I; I += 2; } Console.WriteLine("Sum of first 10 even numbers is:"+J); Console.ReadLine(); }
Correct Answer: Option D — Run time error
Detailed Academic Explanation:
Run time error is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int I, J = 0; for (I = 1; I < 10; ) ; { J = J + I; I += 2; } Console.WriteLine("Sum of first 10 even numbers is:"+J); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i; for (i = 0; ; ) { Console.WriteLine("hello"); } Console.ReadLine(); }
Correct Answer: Option C — hello printed infinite times
Detailed Academic Explanation:
hello printed infinite times is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i; for (i = 0; ; ) { Console.WriteLine("hello"); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 10 , j = 0; label: i--; if ( i > 0) { Console.WriteLine(i+ " "); goto label; } Console.ReadLine(); }
Correct Answer: Option C — 9 8 7 6 5 4 3 2 1
Detailed Academic Explanation:
9 8 7 6 5 4 3 2 1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 10 , j = 0; label: i--; if ( i > 0) { Console.WriteLine(i+ " "); goto label; } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i= 0,k; label: Console.WriteLine(i); if (i == 0) goto label; Console.ReadLine(); }
Correct Answer: Option C — 0 infinite times
Detailed Academic Explanation:
0 infinite times is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i= 0,k; label: Console.WriteLine(i); if (i == 0) goto label; Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int I, X; for (I = 1; I <= (9 % 2 + I); I++) { X = (I * 3 + I * 2) / I; Console.WriteLine(X); } Console.ReadLine(); }
Correct Answer: Option C — Print 5 infinite times
Detailed Academic Explanation:
Print 5 infinite times is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int I, X; for (I = 1; I <= (9 % 2 + I); I++) { X = (I * 3 + I * 2) / I; Console.WriteLine(X); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i, j; for (i = 2; i >= 0; i--) { for (j = 0; j <= 2; j++) { if (i == j) { Console.WriteLine("1"); } else { Console.WriteLine("0"); } } Console.WriteLine("\n"); Console.ReadLine(); } }
Correct Answer: Option C — 0 0 1 0 1 0 1 0 0
Detailed Academic Explanation:
0 0 1 0 1 0 1 0 0 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i, j; for (i = 2; i >= 0; i--) { for (j = 0; j <= 2; j++) { if (i == j) { Console.WriteLine("1"); } else { Console.WriteLine("0"); } } Console.WriteLine("\n"); Console.ReadLine(); } }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 0, j = 0; while (i < 2) { l1: i--; while (j < 2) { Console.WriteLine("hi\n"); goto l1; } } Console.ReadLine(); }
Correct Answer: Option D — hi hi hi..... infinite times
Detailed Academic Explanation:
hi hi hi..... infinite times is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 0, j = 0; while (i < 2) { l1: i--; while (j < 2) { Console.WriteLine("hi\n"); goto l1; } } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 30; int j = 25 % 25; if (Convert.ToBoolean(Convert.ToInt32(i = j))) { Console.WriteLine("In if"); } else { Console.WriteLine("In else"); } Console.WriteLine("In main"); Console.ReadLine(); }
Correct Answer: Option D — In else In main
Detailed Academic Explanation:
In else In main is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 30; int j = 25 % 25; if (Convert.ToBoolean(Convert.ToInt32(i = j))) { Console.WriteLine("In if"); } else { Console.WriteLine("In else"); } Console.WriteLine("In main"); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Select the output for the following set of code : static void Main(string[] args) { int a = 0; int i = 0; int b; for (i = 0; i < 5; i++) { a++; Console.WriteLine("Hello \n"); continue; } Console.ReadLine(); }
Correct Answer: Option C — print hello 5 times
Detailed Academic Explanation:
print hello 5 times is the correct answer to “Select the output for the following set of code : static void Main(string[] args) { int a = 0; int i = 0; int b; for (i = 0; i < 5; i++) { a++; Console.WriteLine("Hello \n"); continue; } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i, j; for (i = 1; i <= 3; i++) { j = 1; while (i % j == 2) { j++; } Console.WriteLine(i + " " + j); } Console.ReadLine(); }
Correct Answer: Option C — 11 21 31
Detailed Academic Explanation:
11 21 31 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i, j; for (i = 1; i <= 3; i++) { j = 1; while (i % j == 2) { j++; } Console.WriteLine(i + " " + j); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int n, r; n = Convert.ToInt32(Console.ReadLine()); while (n > 0) { r = n % 10; n = n / 10; Console.WriteLine(+r); } Console.ReadLine(); } for n = 5432.
Correct Answer: Option C — 2345
Detailed Academic Explanation:
2345 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int n, r; n = Convert.ToInt32(Console.ReadLine()); while (n > 0) { r = n % 10; n = n / 10; Console.WriteLine(+r); } Console.ReadLine(); } for n = 5432.”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a = 5, b = 10; if (Convert.ToBoolean(Convert.ToInt32(0xB))) if (Convert.ToBoolean(Convert.ToInt32(022))) if (Convert.ToBoolean(Convert.ToInt32('\xeb'))) Console.WriteLine("java"); else ; else ; else ; }
Correct Answer: Option C — java
Detailed Academic Explanation:
java is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a = 5, b = 10; if (Convert.ToBoolean(Convert.ToInt32(0xB))) if (Convert.ToBoolean(Convert.ToInt32(022))) if (Convert.ToBoolean(Convert.ToInt32('\xeb'))) Console.WriteLine("java"); else ; else ; else ; }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 5; for (; Convert.ToBoolean(Convert.ToInt32(i)); Console.WriteLine(i--)) ; Console.ReadLine(); }
Correct Answer: Option C — 5 4 3 2 1
Detailed Academic Explanation:
5 4 3 2 1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 5; for (; Convert.ToBoolean(Convert.ToInt32(i)); Console.WriteLine(i--)) ; Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a = 5; if (Convert.ToBoolean((.002f) -(0.1f))) Console.WriteLine("Sachin Tendulkar"); else if (a == 5) Console.WriteLine("Rahul Dravid"); else Console.WriteLine("Ms Dhoni"); Console.ReadLine(); }
Correct Answer: Option B — Sachin Tendulkar
Detailed Academic Explanation:
Sachin Tendulkar is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a = 5; if (Convert.ToBoolean((.002f) -(0.1f))) Console.WriteLine("Sachin Tendulkar"); else if (a == 5) Console.WriteLine("Rahul Dravid"); else Console.WriteLine("Ms Dhoni"); Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { switch (5) { case 5.0f: Console.WriteLine("harsh"); break; case 5: Console.WriteLine("amish"); break; case 5.0L: Console.WriteLine("ANKIT"); break; default: Console.WriteLine("ashish"); } Console.ReadLine(); }
Correct Answer: Option D — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { switch (5) { case 5.0f: Console.WriteLine("harsh"); break; case 5: Console.WriteLine("amish"); break; case 5.0L: Console.WriteLine("ANKIT"); break; default: Console.WriteLine("ashish"); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { float i = 1.0f, j = 0.05f; while (i < 2.0f && j <= 2.0f) { Console.WriteLine(i++ - ++j); } Console.ReadLine(); }
Correct Answer: Option C — -0.04999995f
Detailed Academic Explanation:
-0.04999995f is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { float i = 1.0f, j = 0.05f; while (i < 2.0f && j <= 2.0f) { Console.WriteLine(i++ - ++j); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i, j; for (i = 1, j = i; i <= 3 && j >= 0; i++, j--) { if (i == j) continue; else Console.WriteLine(j); } Console.ReadLine(); }
Correct Answer: Option C — j = 0
Detailed Academic Explanation:
j = 0 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i, j; for (i = 1, j = i; i <= 3 && j >= 0; i++, j--) { if (i == j) continue; else Console.WriteLine(j); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int const p = 0; switch (3 * 5 / 6) { case p: Console.WriteLine("A"); break; case p * 1: Console.WriteLine("B"); break; case p - 2: Console.WriteLine("C"); break; default: Console.WriteLine("D"); } }
Correct Answer: Option D — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int const p = 0; switch (3 * 5 / 6) { case p: Console.WriteLine("A"); break; case p * 1: Console.WriteLine("B"); break; case p - 2: Console.WriteLine("C"); break; default: Console.WriteLine("D"); } }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int a = 15, b = 10, c = 1; if (Convert.ToBoolean(a) && (b > c)) { Console.WriteLine("cquestionbank"); } else { break; } }
Correct Answer: Option C — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int a = 15, b = 10, c = 1; if (Convert.ToBoolean(a) && (b > c)) { Console.WriteLine("cquestionbank"); } else { break; } }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements In C Sharp
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i; i = 0; while (i++ < 5) { Console.WriteLine(i); } Console.WriteLine("\n"); i = 0; while ( ++i < 5) { Console.WriteLine(i); } Console.ReadLine(); }
Correct Answer: Option C — 1 2 3 4 5 1 2 3 4
Detailed Academic Explanation:
1 2 3 4 5 1 2 3 4 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i; i = 0; while (i++ < 5) { Console.WriteLine(i); } Console.WriteLine("\n"); i = 0; while ( ++i < 5) { Console.WriteLine(i); } Console.ReadLine(); }”. This question is standard in competitive examination syllabi for Control Flow Statements In C Sharp.
💡Key Conceptual Anchor:Control Flow Statements 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.