Control Flow Statements In C Sharp — Part 1 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Control Flow Statements In C Sharp — Part 1 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 control flow statement is used to iterate over a collection in C#?
Correct Answer: Option B — foreach
Detailed Academic Explanation:
foreach is the correct answer to “Which control flow statement is used to iterate over a collection in 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 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression 5 > 3 ? "Yes" : "No" in C#?
Correct Answer: Option C — Yes
Detailed Academic Explanation:
Yes is the correct answer to “What is the result of the expression 5 > 3 ? "Yes" : "No" in 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 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which control flow statement is used to handle exceptions in C#?
Correct Answer: Option A — try-catch
Detailed Academic Explanation:
try-catch is the correct answer to “Which control flow statement is used to handle exceptions in 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 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C#, what is the syntax for a 'for' loop?
Correct Answer: Option C — for (initialization; condition; update) { }
Detailed Academic Explanation:
for (initialization; condition; update) { } is the correct answer to “In C#, what is the syntax for a 'for' 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 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which keyword is used to skip the current iteration of a loop in C#?
Correct Answer: Option B — continue
Detailed Academic Explanation:
continue is the correct answer to “Which keyword is used to skip the current iteration of a loop in 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 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression 10 % 2 == 0 ? "Even" : "Odd" in C#?
Correct Answer: Option C — Even
Detailed Academic Explanation:
Even is the correct answer to “What is the result of the expression 10 % 2 == 0 ? "Even" : "Odd" in 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 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which control flow statement is used to define a block of code that executes repeatedly as long as a condition is true in C#?
Correct Answer: Option D — while
Detailed Academic Explanation:
while is the correct answer to “Which control flow statement is used to define a block of code that executes repeatedly as long as a condition is true in 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 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which control flow statement is used to repeatedly execute a block of code as long as a specified condition is true in C#?
Correct Answer: Option C — while
Detailed Academic Explanation:
while is the correct answer to “Which control flow statement is used to repeatedly execute a block of code as long as a specified condition is true in 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 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which loop in C# executes its body at least once, even if the condition is false?
Correct Answer: Option B — do-while
Detailed Academic Explanation:
do-while is the correct answer to “Which loop in C# executes its body at least once, even if the condition is false”. 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 is the result of the expression 7 % 4 in C#?
Correct Answer: Option B — 1
Detailed Academic Explanation:
1 is the correct answer to “What is the result of the expression 7 % 4 in 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 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following is a valid way to exit a loop prematurely in C#?
Correct Answer: Option D — break
Detailed Academic Explanation:
break is the correct answer to “Which of the following is a valid way to exit a loop prematurely in 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 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'do-while' loop in C#?
Correct Answer: Option A — To execute a block of code repeatedly until a condition is true
Detailed Academic Explanation:
To execute a block of code repeatedly until a condition is true is the correct answer to “What is the purpose of the 'do-while' loop in 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 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C#, what is the syntax for a 'switch' statement?
Correct Answer: Option D — switch (expression) { case value1: statements; break; case value2: statements; break; default: statements; break; }
Detailed Academic Explanation:
switch (expression) { case value1: statements; break; case value2: statements; break; default: statements; break; } is the correct answer to “In C#, what is the syntax for a 'switch' statement”. 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
Which of the following is used to control the flow of a program in C#?
Correct Answer: Option C — Control statements
Detailed Academic Explanation:
Control statements is the correct answer to “Which of the following is used to control the flow of a program in 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 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'default' keyword do in a 'switch' statement in C#?
Correct Answer: Option B — Defines the default case if no other case matches
Detailed Academic Explanation:
Defines the default case if no other case matches is the correct answer to “What does the 'default' keyword do in a 'switch' statement in 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 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C#, what is the syntax for a 'for-each' loop?
Correct Answer: Option C — foreach (type variable in collection) { }
Detailed Academic Explanation:
foreach (type variable in collection) { } is the correct answer to “In C#, what is the syntax for a 'for-each' 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 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression 10 == 10 in C#?
Correct Answer: Option D — TRUE
Detailed Academic Explanation:
TRUE is the correct answer to “What is the result of the expression 10 == 10 in 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
Which loop in C# is more appropriate for iterating through an array?
Correct Answer: Option D — foreach
Detailed Academic Explanation:
foreach is the correct answer to “Which loop in C# is more appropriate for iterating through an array”. 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
In C#, what is the result of the expression 5 >= 5?
Correct Answer: Option D — TRUE
Detailed Academic Explanation:
TRUE is the correct answer to “In C#, what is the result of the expression 5 >= 5”. 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
Which control flow statement in C# is used to handle multiple conditions using a single switch expression?
Correct Answer: Option C — switch-case
Detailed Academic Explanation:
switch-case is the correct answer to “Which control flow statement in C# is used to handle multiple conditions using a single switch expression”. 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 is the result of the expression 12 < 5 ? "Yes" : "No" in C#?
Correct Answer: Option B — Yes
Detailed Academic Explanation:
Yes is the correct answer to “What is the result of the expression 12 < 5 ? "Yes" : "No" in 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 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int x = 0; do { x++; if (x == 5) { x++; continue; break; } Console.WriteLine(x + " "); } }while (x < 10);
Correct Answer: Option D — 1 2 3 4 5 6 7 8 9 10
Detailed Academic Explanation:
1 2 3 4 5 6 7 8 9 10 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int x = 0; do { x++; if (x == 5) { x++; continue; break; } Console.WriteLine(x + " "); } }while (x < 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 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int x; for (x = 10; x <= 15; x++) while (Convert.ToBoolean(Convert.ToInt32(x))) { do { Console.WriteLine(1); if (Convert.ToBoolean(x >> 1)) continue; }while (Convert.ToBoolean(0)); break; } Console.ReadLine(); }
Correct Answer: Option C — 1 1 1 1 1 1
Detailed Academic Explanation:
1 1 1 1 1 1 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int x; for (x = 10; x <= 15; x++) while (Convert.ToBoolean(Convert.ToInt32(x))) { do { Console.WriteLine(1); if (Convert.ToBoolean(x >> 1)) continue; }while (Convert.ToBoolean(0)); 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 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int x; for (x = 1; x <= 3; x++) { int j = 1; do { j++; }while (x % j == 2); Console.WriteLine(x + " " + j); } Console.ReadLine(); }
Correct Answer: Option C — 12 22 32
Detailed Academic Explanation:
12 22 32 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int x; for (x = 1; x <= 3; x++) { int j = 1; do { j++; }while (x % j == 2); Console.WriteLine(x + " " + 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 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which of the following conditions are true in the following C# code? static void Main(string[] args) { Console.WriteLine("Enter a letter:"); char c = (char)Console.Read(); if (Char.IsDigit(c) == true) Console.WriteLine("A number"); else if (char.IsLower(c) == true) Console.WriteLine("A lowercase letter"); else if (char.IsUpper(c) == true) Console.WriteLine("An uppercase letter"); Console.ReadLine(); } a. Enter a letter : a An uppercase letter b. Enter a letter : A An uppercase letter c. Enter a letter : 2 A number d. Enter a letter : 2 A lowercase letter.
Correct Answer: Option D — b, c
Detailed Academic Explanation:
b, c is the correct answer to “Which of the following conditions are true in the following C# code? static void Main(string[] args) { Console.WriteLine("Enter a letter:"); char c = (char)Console.Read(); if (Char.IsDigit(c) == true) Console.WriteLine("A number"); else if (char.IsLower(c) == true) Console.WriteLine("A lowercase letter"); else if (char.IsUpper(c) == true) Console.WriteLine("An uppercase letter"); Console.ReadLine(); } a. Enter a letter : a An uppercase letter b. Enter a letter : A An uppercase letter c. Enter a letter : 2 A number d. Enter a letter : 2 A lowercase letter.”. 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) { char ch = 'p'; switch (ch) { case 'p': Console.WriteLine("coco" + "\t" + Convert.ToInt32(ch)); break; default: Console.WriteLine("default"); break; } Console.WriteLine("main"); }
Correct Answer: Option C — coco 112 main
Detailed Academic Explanation:
coco 112 main is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { char ch = 'p'; switch (ch) { case 'p': Console.WriteLine("coco" + "\t" + Convert.ToInt32(ch)); break; default: Console.WriteLine("default"); break; } Console.WriteLine("main"); }”. 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; int b = 8, a = 32; for (i = 0; i <= 10; i++) { if ((a / b * 2)== 2) { Console.WriteLine( i + " "); continue; } else if (i != 4) Console.Write(i + " "); else break; } Console.ReadLine(); }
Correct Answer: Option C — 0 1 2 3
Detailed Academic Explanation:
0 1 2 3 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i; int b = 8, a = 32; for (i = 0; i <= 10; i++) { if ((a / b * 2)== 2) { Console.WriteLine( i + " "); continue; } else if (i != 4) Console.Write(i + " "); else 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 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i; int j = 1; int []ar = {21, 22, 13, 4}; switch (ar[j]) { case 1: i++; break; case 2: i += 2; j = 3; continue; case 3: i %= 2; j = 4; continue; default: --i; } Console.WriteLine(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; int j = 1; int []ar = {21, 22, 13, 4}; switch (ar[j]) { case 1: i++; break; case 2: i += 2; j = 3; continue; case 3: i %= 2; j = 4; continue; default: --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 29 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 =-3; i <= 3; i++) { switch (i) { case 0: Console.WriteLine("zero"); break; } if (i > 0) Console.WriteLine("A"); else if (i < 0) Console.WriteLine("B"); } Console.ReadLine(); }
Correct Answer: Option C — B B B zero A A A
Detailed Academic Explanation:
B B B zero A A A is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i; for (i =-3; i <= 3; i++) { switch (i) { case 0: Console.WriteLine("zero"); break; } if (i > 0) Console.WriteLine("A"); else if (i < 0) Console.WriteLine("B"); } 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 = 0; int j = 0; for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { if (i > 1) continue; Console.WriteLine("Hi \n"); } } Console.ReadLine(); }
Correct Answer: Option C — Prints hi 6 times
Detailed Academic Explanation:
Prints hi 6 times is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 0; int j = 0; for (i = 0; i < 4; i++) { for (j = 0; j < 3; j++) { if (i > 1) continue; Console.WriteLine("Hi \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 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int temp = 1; switch (temp << 2 + temp) { default: Console.WriteLine("Example1"); break; case 4: Console.WriteLine("Example2"); break; case 5: Console.WriteLine("Example3"); break; case 8: Console.WriteLine("Example4"); break; } Console.ReadLine(); }
Correct Answer: Option C — Example4
Detailed Academic Explanation:
Example4 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int temp = 1; switch (temp << 2 + temp) { default: Console.WriteLine("Example1"); break; case 4: Console.WriteLine("Example2"); break; case 5: Console.WriteLine("Example3"); break; case 8: Console.WriteLine("Example4"); 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 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? static void Main(string[] args) { int i = 9 , j = 7; switch (i - j + 3) { case 9: 7: j += 6; break; case 5: i -= 4; break; } Console.WriteLine(i + "\n" + j); 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 = 9 , j = 7; switch (i - j + 3) { case 9: 7: j += 6; break; case 5: i -= 4; break; } Console.WriteLine(i + "\n" + 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 33 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 = 4; switch (i + j * 2) { case 1 : case 2 : Console.WriteLine("1 and 2"); break; case 3 to 10: Console.WriteLine("3 to 10"); break; } Console.ReadLine(); }
Correct Answer: Option C — The code reports an error as missing ; before :
Detailed Academic Explanation:
The code reports an error as missing ; before : is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int i = 2, j = 4; switch (i + j * 2) { case 1 : case 2 : Console.WriteLine("1 and 2"); break; case 3 to 10: Console.WriteLine("3 to 10"); 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 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
For the incomplete C# program below, which of the C# code fragment will not result in an infinite loop? static void Main(string[] args) { int i = 1234 ,j = 0; /*ADD CODE HERE */ Console.WriteLine(j); }
Correct Answer: Option A — do { j = j + (i % 10); }while ((i = i / 10)!= 0)
Detailed Academic Explanation:
do { j = j + (i % 10); }while ((i = i / 10)!= 0) is the correct answer to “For the incomplete C# program below, which of the C# code fragment will not result in an infinite loop? static void Main(string[] args) { int i = 1234 ,j = 0; /*ADD CODE HERE */ Console.WriteLine(j); }”. 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) { int x = 0; while (x < 20) { while (x < 10) { if (x % 2 == 0) { Console.WriteLine(x); } x++; } } Console.ReadLine(); }
Correct Answer: Option C — 0 2 4 6 8
Detailed Academic Explanation:
0 2 4 6 8 is the correct answer to “What will be the output of the following C# code? static void Main(string[] args) { int x = 0; while (x < 20) { while (x < 10) { if (x % 2 == 0) { Console.WriteLine(x); } 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 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; do { Console.WriteLine(i++ - ++j); }while (i < 2.0f && j <= 2.0f); Console.ReadLine(); }
Correct Answer: Option D — -0.04999995
Detailed Academic Explanation:
-0.04999995 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; do { Console.WriteLine(i++ - ++j); }while (i < 2.0f && j <= 2.0f); 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) { Console.WriteLine("HI"); continue; Console.WriteLine("Hello"); 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) { Console.WriteLine("HI"); continue; 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 38 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; l1: while (i < 2) { i++; while (j < 3) { Console.WriteLine("loop\n"); goto l1; } } Console.ReadLine(); }
Correct Answer: Option C — loop loop
Detailed Academic Explanation:
loop loop 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; l1: while (i < 2) { i++; while (j < 3) { Console.WriteLine("loop\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 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C# code? { int i; Console.WriteLine("Hi"); for (i = 1; i <= 10; i++) Program.Main(args); Console.ReadLine(); }
Correct Answer: Option C — Stack overflow exception Condition generated
Detailed Academic Explanation:
Stack overflow exception Condition generated is the correct answer to “What will be the output of the following C# code? { int i; Console.WriteLine("Hi"); for (i = 1; i <= 10; i++) Program.Main(args); 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 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which statement is correct among the mentioned statements? i. The for loop works faster than a while loop ii. for( ; ; )implements an infinite loop
Correct Answer: Option B — Only ii is correct
Detailed Academic Explanation:
Only ii is correct is the correct answer to “Which statement is correct among the mentioned statements? i. The for loop works faster than a while loop ii. for( ; ; )implements an 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
✓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.