iGET

C Programming - MCQ Practice Questions

C questions in placement tests and university exams are rarely about syntax alone. Most of what you will find here is output prediction, pointer arithmetic, arrays and strings, structures and unions, storage classes, recursion, and file handling. The explanations walk through memory behaviour step by step, which is usually where the confusion sits rather than in the code itself.

972 questions | 100% Free

Q.121Medium

What is the behavior of this code?
int i = 0;
while(1) {
i++;
if(i > 5) break;
}

Q.122Medium

Consider the code:
int x = 5;
if(x > 3)
if(x > 10)
printf("A");
else
printf("B");
Which statement best describes the output?

Q.123Medium

What does the following code segment accomplish?
int i = 0;
while(i < 5) {
if(i == 2) {
i++;
continue;
}
printf("%d ", i);
i++;
}

Q.124Medium

Which of the following is a valid use of the switch statement in C?

Q.125Medium

Analyze: What is printed by this code?
for(int i = 1; i <= 3; i++) {
for(int j = 1; j <= i; j++) {
printf("%d", i);
}
printf(" ");
}

Q.126Medium

What happens when you use break in a nested loop structure?

Q.127Medium

Consider the code:
int x = 0;
while(1) {
if(++x > 3) break;
printf("%d ", x);
}
What is the output?

Q.128Medium

What is the key distinction between if-else and switch statements in terms of evaluation?

Q.129Medium

What does the following code segment do?
int i = 0;
do {
printf("%d ", i);
} while(++i < 3);

Q.130Medium

Consider:
switch(x) {
case 1:
case 2:
case 3: printf("A"); break;
default: printf("B");
}
What advantage does stacking cases provide?

Q.131Medium

What does continue do in a for loop with multiple statements in body?

Q.132Medium

What is the output of the following code?
int x = 5;
if(x > 3)
if(x < 10)
printf("Pass");
else
printf("Fail");

Q.133Medium

What is the output?
int x = 10;
while(x-- > 5) {
printf("%d ", x);
}

Q.134Medium

Which of the following statements about switch case is TRUE?

Q.135Medium

What will this code output?
for(int i = 1; i <= 3; i++) {
for(int j = 1; j <= i; j++) {
printf("%d", j);
}
printf("\n");
}

Q.136Medium

How many times will the loop execute?
int i = 0;
while(i++ < 5) {
printf("%d ", i);
}

Q.137Medium

What will be the output of this code?
int n = 5;
switch(n) {
case 4: printf("Four");
case 5: printf("Five");
case 6: printf("Six");
break;
default: printf("Other");
}

Q.138Medium

Which control structure would be most efficient to validate if a number is within one of several specific values?

Q.139Medium

In C programming, what is the difference between break in a loop and break in a switch statement?

Q.140Medium

What is the output of this code?
char ch = 'B';
switch(ch) {
case 'A':
case 'B':
case 'C': printf("Vowel");
break;
default: printf("Consonant");
}