Control Structures — Part 2 MCQs with Explanations
Practice high-yield Programming & Software Development MCQs on Control Structures — 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 control structure in C is used to perform a repetitive task while a condition is true?
Correct Answer: Option C — while loop
Detailed Academic Explanation:
while loop is the correct answer to “Which control structure in C is used to perform a repetitive task while a condition is true”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 2 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression `7 || 0` in C?
Correct Answer: Option A — TRUE
Detailed Academic Explanation:
TRUE is the correct answer to “What is the result of the expression `7 || 0` in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 3 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, what is the purpose of the 'goto' statement?
Correct Answer: Option C — Transfer control to a labeled statement
Detailed Academic Explanation:
Transfer control to a labeled statement is the correct answer to “In C, what is the purpose of the 'goto' statement”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 4 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What does the 'default' case in a 'switch' statement do in C?
Correct Answer: Option A — Executes when no other case matches
Detailed Academic Explanation:
Executes when no other case matches is the correct answer to “What does the 'default' case in a 'switch' statement do in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 5 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How can you create an infinite loop in C?
Correct Answer: Option B — Use a 'while' loop with a true condition
Detailed Academic Explanation:
Use a 'while' loop with a true condition is the correct answer to “How can you create an infinite loop in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 6 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression 2 && 0 in C?
Correct Answer: Option B — FALSE
Detailed Academic Explanation:
FALSE is the correct answer to “What is the result of the expression 2 && 0 in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 7 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, which statement is used to exit the current iteration of a loop and continue with the next iteration?
Correct Answer: Option C — continue
Detailed Academic Explanation:
continue is the correct answer to “In C, which statement is used to exit the current iteration of a loop and continue with the next iteration”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 8 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which control structure is used to execute a block of code repeatedly as long as a condition is true in C?
Correct Answer: Option B — while loop
Detailed Academic Explanation:
while loop is the correct answer to “Which control structure is used to execute a block of code repeatedly as long as a condition is true in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 9 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'switch' statement in C?
Correct Answer: Option B — Make a decision
Detailed Academic Explanation:
Make a decision is the correct answer to “What is the purpose of the 'switch' statement in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 10 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression `3 || 0` in C?
Correct Answer: Option A — TRUE
Detailed Academic Explanation:
TRUE is the correct answer to “What is the result of the expression `3 || 0` in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 11 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, which control structure is used to execute a block of code a specific number of times?
Correct Answer: Option A — for loop
Detailed Academic Explanation:
for loop is the correct answer to “In C, which control structure is used to execute a block of code a specific number of times”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 12 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What happens if a 'break' statement is used within a 'switch' statement in C?
Correct Answer: Option B — It exits the 'switch' statement
Detailed Academic Explanation:
It exits the 'switch' statement is the correct answer to “What happens if a 'break' statement is used within a 'switch' statement in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 13 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression !0 in C?
Correct Answer: Option A — TRUE
Detailed Academic Explanation:
TRUE is the correct answer to “What is the result of the expression !0 in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 14 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
Which control structure is used to execute a block of code only if a condition is true in C?
Correct Answer: Option C — if statement
Detailed Academic Explanation:
if statement is the correct answer to “Which control structure is used to execute a block of code only if a condition is true in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 15 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the purpose of the 'return' statement in C?
Correct Answer: Option C — Return a value from a function
Detailed Academic Explanation:
Return a value from a function is the correct answer to “What is the purpose of the 'return' statement in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 16 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
In C, which control structure allows you to define a block of code to be executed in response to a specific event or condition?
Correct Answer: Option B — if statement
Detailed Academic Explanation:
if statement is the correct answer to “In C, which control structure allows you to define a block of code to be executed in response to a specific event or condition”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 17 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What is the result of the expression 1 && 1 in C?
Correct Answer: Option A — TRUE
Detailed Academic Explanation:
TRUE is the correct answer to “What is the result of the expression 1 && 1 in C”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 18 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The type of the controlling expression of a switch statement cannot be of the type ........
Correct Answer: Option D — float
Detailed Academic Explanation:
float is the correct answer to “The type of the controlling expression of a switch statement cannot be of the type ........”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 19 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the value of sum after the following program is executed? void main() { int sum=1, index = 9; do{ index = index – 1; sum *= 2; }while( index > 9 ); }
Correct Answer: Option B — 2
Detailed Academic Explanation:
2 is the correct answer to “What will be the value of sum after the following program is executed? void main() { int sum=1, index = 9; do{ index = index – 1; sum *= 2; }while( index > 9 ); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 20 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be printed if the following code is executed? void main() { int x=0; for( ; ; ) { if( x++ == 4 ) break; continue; } printf("x=%d", x); }
Correct Answer: Option B — x=5
Detailed Academic Explanation:
x=5 is the correct answer to “What will be printed if the following code is executed? void main() { int x=0; for( ; ; ) { if( x++ == 4 ) break; continue; } printf("x=%d", x); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 21 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h> void main() { int ch; printf("enter a value between 1 to 2:"); scanf("%d", &ch); switch (ch, ch + 1) { case 1: printf("1\n"); break; case 2: printf("2"); break; } }
Correct Answer: Option B — 2
Detailed Academic Explanation:
2 is the correct answer to “What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h> void main() { int ch; printf("enter a value between 1 to 2:"); scanf("%d", &ch); switch (ch, ch + 1) { case 1: printf("1\n"); break; case 2: printf("2"); break; } }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 22 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> void main() { int i = 0; do { printf("Hello"); } while (i != 0); }
Correct Answer: Option C — Hello
Detailed Academic Explanation:
Hello is the correct answer to “What will be the output of the following C code? #include <stdio.h> void main() { int i = 0; do { printf("Hello"); } while (i != 0); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 23 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; while (i < 2) { if (i == 1) break; i++; if (i == 1) continue; printf("In while loop\n"); } printf("After loop\n"); }
Correct Answer: Option B — After loop
Detailed Academic Explanation:
After loop is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; while (i < 2) { if (i == 1) break; i++; if (i == 1) continue; printf("In while loop\n"); } printf("After loop\n"); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 24 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> void main() { int i = 0, k; label: printf("%d", i); if (i == 0) goto label; }
Correct Answer: Option B — Infinite 0
Detailed Academic Explanation:
Infinite 0 is the correct answer to “What will be the output of the following C code? #include <stdio.h> void main() { int i = 0, k; label: printf("%d", i); if (i == 0) goto label; }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 25 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int x = 97; switch (x) { case 'a': printf("yes "); break; case 97: printf("no\n"); break; } }
Correct Answer: Option C — Duplicate case value error
Detailed Academic Explanation:
Duplicate case value error is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int x = 97; switch (x) { case 'a': printf("yes "); break; case 97: printf("no\n"); break; } }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 26 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int *p = NULL; for (foo(); p; p = 0) printf("In for loop\n"); printf("After loop\n"); }
Correct Answer: Option B — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int *p = NULL; for (foo(); p; p = 0) printf("In for loop\n"); printf("After loop\n"); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 27 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { printf("%d ", 1); goto l1; printf("%d ", 2); l1:goto l2; printf("%d ", 3); l2:printf("%d ", 4); }
Correct Answer: Option A — 1 4
Detailed Academic Explanation:
1 4 is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { printf("%d ", 1); goto l1; printf("%d ", 2); l1:goto l2; printf("%d ", 3); l2:printf("%d ", 4); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 28 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
The keyword 'break' cannot be simply used within . . . . . . . .
Correct Answer: Option B — if-else
Detailed Academic Explanation:
if-else is the correct answer to “The keyword 'break' cannot be simply used within . . . . . . . .”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 29 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 1) if (x == 0) printf("inside if\n"); else printf("inside else if\n"); else printf("inside else\n"); }
Correct Answer: Option C — inside else
Detailed Academic Explanation:
inside else is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 1) if (x == 0) printf("inside if\n"); else printf("inside else if\n"); else printf("inside else\n"); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 30 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h> void main() { char *ch; printf("enter a value between 1 to 3:"); scanf("%s", ch); switch (ch) { case "1": printf("1"); break; case "2": printf("2"); break; } }
Correct Answer: Option B — Compile time error
Detailed Academic Explanation:
Compile time error is the correct answer to “What will be the output of the following C code? (Assuming that we have entered the value 1 in the standard input) #include <stdio.h> void main() { char *ch; printf("enter a value between 1 to 3:"); scanf("%s", ch); switch (ch) { case "1": printf("1"); break; case "2": printf("2"); break; } }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 31 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0, j = 0; l1: while (i < 2) { i++; while (j < 3) { printf("loop\n"); goto l1; } } }
Correct Answer: Option A — loop loop
Detailed Academic Explanation:
loop loop is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int i = 0, j = 0; l1: while (i < 2) { i++; while (j < 3) { printf("loop\n"); goto l1; } } }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 32 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 0) printf("true, "); else if (x = 10) printf("false, "); printf("%d\n", x); }
Correct Answer: Option B — true, 0
Detailed Academic Explanation:
true, 0 is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 0) printf("true, "); else if (x = 10) printf("false, "); printf("%d\n", x); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 33 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; do { i++; if (i == 2) continue; printf("In while loop "); } while (i < 2); printf("%d\n", i); }
Correct Answer: Option A — In while loop 2
Detailed Academic Explanation:
In while loop 2 is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; do { i++; if (i == 2) continue; printf("In while loop "); } while (i < 2); printf("%d\n", i); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 34 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> void main() { int k; for (k = -3; k < -5; k++) printf("Hello"); }
Correct Answer: Option D — Nothing
Detailed Academic Explanation:
Nothing is the correct answer to “What will be the output of the following C code? #include <stdio.h> void main() { int k; for (k = -3; k < -5; k++) printf("Hello"); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 35 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 1) if (x >= 0) printf("true\n"); else printf("false\n"); }
Correct Answer: Option D — No print statement
Detailed Academic Explanation:
No print statement is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int x = 0; if (x == 1) if (x >= 0) printf("true\n"); else printf("false\n"); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 36 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> void main() { double k = 0; for (k = 0.0; k < 3.0; k++) printf("Hello"); }
Correct Answer: Option B — Hello is printed thrice
Detailed Academic Explanation:
Hello is printed thrice is the correct answer to “What will be the output of the following C code? #include <stdio.h> void main() { double k = 0; for (k = 0.0; k < 3.0; k++) printf("Hello"); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 37 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How many times i value is checked in the following C code? #include <stdio.h> int main() { int i = 0; while (i < 3) i++; printf("In while loop\n"); }
Correct Answer: Option C — 4
Detailed Academic Explanation:
4 is the correct answer to “How many times i value is checked in the following C code? #include <stdio.h> int main() { int i = 0; while (i < 3) i++; printf("In while loop\n"); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 38 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; do { i++; printf("In while loop\n"); } while (i < 3); }
Correct Answer: Option A — In while loop In while loop In while loop
Detailed Academic Explanation:
In while loop In while loop In while loop is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int i = 0; do { i++; printf("In while loop\n"); } while (i < 3); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 39 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
How many times i value is checked in the following C code? #include <stdio.h> int main() { int i = 0; do { i++; printf("in while loop\n"); } while (i < 3); }
Correct Answer: Option B — 3
Detailed Academic Explanation:
3 is the correct answer to “How many times i value is checked in the following C code? #include <stdio.h> int main() { int i = 0; do { i++; printf("in while loop\n"); } while (i < 3); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
Question 40 of 40
★ FPSC
★ PPSC
★ FPSC
★ PPSC
What will be the output of the following C code? #include <stdio.h> int main() { int x = 1; if (x > 0) printf("inside if\n"); else if (x > 0) printf("inside elseif\n"); }
Correct Answer: Option A — inside if
Detailed Academic Explanation:
inside if is the correct answer to “What will be the output of the following C code? #include <stdio.h> int main() { int x = 1; if (x > 0) printf("inside if\n"); else if (x > 0) printf("inside elseif\n"); }”. This question is standard in competitive examination syllabi for Control Structures.
💡Key Conceptual Anchor:Control Structures
✓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.