Skip to main content

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

Which control structure in C is used to perform a repetitive task while a condition is true?

Question 2 of 40
★ FPSC ★ PPSC

What is the result of the expression `7 || 0` in C?

Question 3 of 40
★ FPSC ★ PPSC

In C, what is the purpose of the 'goto' statement?

Question 4 of 40
★ FPSC ★ PPSC

What does the 'default' case in a 'switch' statement do in C?

Question 5 of 40
★ FPSC ★ PPSC

How can you create an infinite loop in C?

Question 6 of 40
★ FPSC ★ PPSC

What is the result of the expression 2 && 0 in C?

Question 7 of 40
★ FPSC ★ PPSC

In C, which statement is used to exit the current iteration of a loop and continue with the next iteration?

Question 8 of 40
★ FPSC ★ PPSC

Which control structure is used to execute a block of code repeatedly as long as a condition is true in C?

Question 9 of 40
★ FPSC ★ PPSC

What is the purpose of the 'switch' statement in C?

Question 10 of 40
★ FPSC ★ PPSC

What is the result of the expression `3 || 0` in C?

Question 11 of 40
★ FPSC ★ PPSC

In C, which control structure is used to execute a block of code a specific number of times?

Question 12 of 40
★ FPSC ★ PPSC

What happens if a 'break' statement is used within a 'switch' statement in C?

Question 13 of 40
★ FPSC ★ PPSC

What is the result of the expression !0 in C?

Question 14 of 40
★ FPSC ★ PPSC

Which control structure is used to execute a block of code only if a condition is true in C?

Question 15 of 40
★ FPSC ★ PPSC

What is the purpose of the 'return' statement in C?

Question 16 of 40
★ 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?

Question 17 of 40
★ FPSC ★ PPSC

What is the result of the expression 1 && 1 in C?

Question 18 of 40
★ FPSC ★ PPSC

The type of the controlling expression of a switch statement cannot be of the type ........

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

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

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

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

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

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

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

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

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

Question 28 of 40
★ FPSC ★ PPSC

The keyword 'break' cannot be simply used within . . . . . . . .

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

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

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

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

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

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

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

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

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

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

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

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

✓ 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 →