Skip to main content

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
Question 1 of 40
★ FPSC ★ PPSC

Which of the following is not infinite loop?

Question 2 of 40
★ 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(); }

Question 3 of 40
★ 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(); }

Question 4 of 40
★ 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(); }

Question 5 of 40
★ 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.

Question 6 of 40
★ 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(); }

Question 7 of 40
★ 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(); }

Question 8 of 40
★ 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(); }

Question 9 of 40
★ 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(); }

Question 10 of 40
★ 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(); }

Question 11 of 40
★ 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(); }

Question 12 of 40
★ 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(); }

Question 13 of 40
★ 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(); }

Question 14 of 40
★ 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); } }

Question 15 of 40
★ FPSC ★ PPSC

What is the correct syntax for do while loop?

Question 16 of 40
★ 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(); }

Question 17 of 40
★ 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# "); }

Question 18 of 40
★ 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.

Question 19 of 40
★ 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(); }

Question 20 of 40
★ 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(); }

Question 21 of 40
★ 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(); }

Question 22 of 40
★ 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(); }

Question 23 of 40
★ 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(); }

Question 24 of 40
★ 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(); }

Question 25 of 40
★ 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(); }

Question 26 of 40
★ 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(); } }

Question 27 of 40
★ 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(); }

Question 28 of 40
★ 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(); }

Question 29 of 40
★ 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(); }

Question 30 of 40
★ 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(); }

Question 31 of 40
★ 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.

Question 32 of 40
★ 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 ; }

Question 33 of 40
★ 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(); }

Question 34 of 40
★ 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(); }

Question 35 of 40
★ 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(); }

Question 36 of 40
★ 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(); }

Question 37 of 40
★ 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(); }

Question 38 of 40
★ 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"); } }

Question 39 of 40
★ 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; } }

Question 40 of 40
★ 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(); }

✓ Link copied to clipboard
Continue Your Practice

Advance Html — Part 1

Master the next curriculum module with 40 exam-standard MCQs.

Next Practice Set →

💡 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.

More Modules in Programming & Software Development

View All →
📚

Study Guides

Topic summaries and syllabus breakdown

Explore Guides →
🎯

Complete Library

Search through 78,000+ verified MCQs

Browse Library →
📱

Mobile App

Offline mock tests and instant bookmarks

Get Mobile App →