Skip to main content

Control Structures — Part 1 MCQs with Explanations

Practice high-yield Programming & Software Development MCQs on Control Structures — 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
Question 1 of 40
★ FPSC ★ PPSC

How many times will a 'do-while' loop execute its body if the condition is initially false in C?

Question 2 of 40
★ FPSC ★ PPSC

What is the output of given program if user enter value 99? #include<stdio.h> void main() { int i; printf("Enter a number:"); scanf("%d", &i); // 99 is given as input. if(i%5 == 0){ printf("nNumber entered is divisible by 5"); } }

Question 3 of 40
★ FPSC ★ PPSC

What is the output of given program if user enter "xyz" ? #include<stdio.h> void main() { float age, AgeInSeconds; printf("Enter your age:"); scanf("%f", &age); AgeInSeconds = 365 * 24 * 60 * 60 * age; printf("You have lived for %f seconds", AgeInSeconds); }

Question 4 of 40
★ FPSC ★ PPSC

What is the output of given program if user enter "xyz" ? #include<stdio.h> void main() { float age, AgeInSeconds; int value; printf("Enter your age:"); value=scanf("%f", &age); if(value==0){ printf("\\nYour age is not valid"); } AgeInSeconds = 365 * 24 * 60 * 60 * age; printf("\\n You have lived for %f seconds", AgeInSeconds); }

Question 5 of 40
★ FPSC ★ PPSC

What will be the output of the given program? #include<stdio.h> void main() { int i=10; printf("i=%d", i); { int i=20; printf("i=%d", i); i++; printf("i=%d", i); } printf("i=%d", i); }

Question 6 of 40
★ FPSC ★ PPSC

What will be the value of i and j after execution of following program? #include<stdio.h> void main() { int i, j; for(i=0,j=0;i<10,j<20;i++,j++){ printf("i=%d %t j=%d", i, j); } }

Question 7 of 40
★ FPSC ★ PPSC

What will be the output given program? #include<stdio.h> void main() { int i = -10; for(;i;printf("%d ", i++)); }

Question 8 of 40
★ FPSC ★ PPSC

What will be the output of the given program? #include<stdio.h> void main() { int a=11,b=5; if(a=5) b++; printf("%d %d", ++a, b++); }

Question 9 of 40
★ FPSC ★ PPSC

What will be the output of the given program? #include<stdio.h> void main() { int value=0; if(value) printf("well done "); printf("examveda"); }

Question 10 of 40
★ FPSC ★ PPSC

What will be the output of the given program? #include<stdio.h> void main() { int value1, value2=100, num=100; if(value1=value2%5) num=5; printf("%d %d %d", num, value1, value2); }

Question 11 of 40
★ FPSC ★ PPSC

What will be the output of the given program? #include<stdio.h> void main() { float num=5.6; switch(num){ case 5:printf("5"); case 6:printf("6"); default : printf("0"); break; } printf("%d", num); }

Question 12 of 40
★ FPSC ★ PPSC

What will be the output of given program? #include<stdio.h> void main() { int a=1; if("%d=hello", a); }

Question 13 of 40
★ FPSC ★ PPSC

What will be the output of given program? #include<stdio.h> void main() { int a=3; for(;a;printf("%d ", a--); }

Question 14 of 40
★ FPSC ★ PPSC

What will be the output of given program? #include<stdio.h> void main() { int i=1, j=-1; if((printf("%d", i)) < (printf("%d", j))) printf("%d", i); else printf("%d", j); }

Question 15 of 40
★ FPSC ★ PPSC

What will be the output of the following piece of code? for(i = 0; i<10; i++); printf("%d", i);

Question 16 of 40
★ FPSC ★ PPSC

What will be the output of the following code? #include<stdio.h> void main() { int s=0; while(s++<10) { if(s<4 && s<9) continue; printf("%dt", s); } }

Question 17 of 40
★ FPSC ★ PPSC

Which command is used to skip the rest of a loop and carry on from the top of the loop again?

Question 18 of 40
★ FPSC ★ PPSC

What is the output of the following program? #include<stdio.h> int c[10] = {1,2,3,4,5,6,7,8,9,10}; main() { int a, b=0; for(a=0;a<10;++a) if(c[a]%2 == 1) b+=c[a]; printf("%d", b); }

Question 19 of 40
★ FPSC ★ PPSC

What is the output of the following statements? for(i=10; i++; i<15) printf("%d ", i);

Question 20 of 40
★ FPSC ★ PPSC

What's wrong in the following statement, provided k is a variable of type int? for ( k = 2, k <=12, k ++)

Question 21 of 40
★ FPSC ★ PPSC

Find the output of the following program. #include<stdio.h> void main() { int y=10; if(y++>9 && y++!=10 && y++>11) printf("%d", y); else printf("%d", y); }

Question 22 of 40
★ FPSC ★ PPSC

What is the right choice, if the following loop is implemented? void main() { int num = 0; do{ --num; printf("%d", num); }while( ++num >= 0 ); }

Question 23 of 40
★ FPSC ★ PPSC

What will be the final value of the digit? void main() { int digit = 0; for( ; digit <= 9; ) digit++; digit *= 2; --digit; }

Question 24 of 40
★ FPSC ★ PPSC

What will be the following code's output if choice = 'R'? switch(choice) { case 'R' : printf("RED"); case 'W' : printf("WHITE"); case 'B' : printf("BLUE"); default : printf("ERROR");break; }

Question 25 of 40
★ FPSC ★ PPSC

Consider the following program fragment: for(c=1, sum=0; c <= 10; c++) { scanf("%d", &x); if( x < 0 ) continue; sum += x; } What would be the value of sum for the input 1, -1, 2, -2, 3, -3, 4, -4, 5, -5

Question 26 of 40
★ FPSC ★ PPSC

Consider the following code: void main() { int a[5] = {6,8,3,9,0}, i=0; if(i != 0) { break; printf("%d", a[i]); } else printf("%d", a[i++]); } What is the output of the above program?

Question 27 of 40
★ FPSC ★ PPSC

What will be the output of the following C code? #include <stdio.h> void main() { int i = 0; if (i == 0) { printf("Hello"); break; } }

Question 28 of 40
★ FPSC ★ PPSC

What will be the output of the following C code? #include <stdio.h> int x; void main() { if (x) printf("hi"); else printf("how are u"); }

Question 29 of 40
★ FPSC ★ PPSC

What will be the output of the following C code? #include <stdio.h> int main() { switch (printf("Do")) { case 1: printf("First\n"); break; case 2: printf("Second\n"); break; default: printf("Default\n"); break; } }

Question 30 of 40
★ FPSC ★ PPSC

Which control structure is used to repeatedly execute a block of code in C?

Question 31 of 40
★ FPSC ★ PPSC

In C, what is the purpose of the 'break' statement within a loop?

Question 32 of 40
★ FPSC ★ PPSC

What is the purpose of the 'else' statement in C's 'if-else' control structure?

Question 33 of 40
★ FPSC ★ PPSC

Which control structure is used to make a decision between two or more alternatives in C?

Question 34 of 40
★ FPSC ★ PPSC

What is the result of the expression 5 > 3 && 4 < 6 in C?

Question 35 of 40
★ FPSC ★ PPSC

In C, what happens if the 'default' case is missing in a 'switch' statement?

Question 36 of 40
★ FPSC ★ PPSC

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

Question 37 of 40
★ FPSC ★ PPSC

What is the result of the expression !(5 == 5) in C?

Question 38 of 40
★ FPSC ★ PPSC

In C, which control structure is used to iterate through a collection of items, such as an array or a list?

Question 39 of 40
★ FPSC ★ PPSC

What is the purpose of the 'if' control structure in C?

Question 40 of 40
★ FPSC ★ PPSC

In C, what happens if the 'break' statement is used outside of a loop or switch statement?

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