iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

978 questions | 100% Free

Q.281Medium

Analyze this code: for(int i = 0; i < 5; i++) { if(i == 2) continue; if(i == 3) break; printf("%d ", i); } What is the output?

Q.282Medium

Which of the following statements about the switch-case construct is INCORRECT?

Q.283Hard

Consider the code: int sum = 0; for(int i = 1; i <= 10; i++) { if(i % 2 == 0) continue; sum += i; } printf("%d", sum); What will be printed?

Q.284Easy

What is the primary purpose of using functions in C programming?

Q.285Easy

Which keyword is used to define a function in C?

Q.286Medium

What is the default return type of a function in C if not specified?

Q.287Easy

Which of the following is a correct function declaration?

Q.288Easy

What will be the output of the following code? int func(int x) { return x * 2; } int main() { printf("%d", func(5)); }

Q.289Easy

How many times can a function be called in a C program?

Q.290Medium

What is the difference between function declaration and function definition?

Q.291Medium

What happens if a function does not have a return statement?

Q.292Medium

Which of the following function calls is valid? int calculate(int a, float b, char c);

Q.293Medium

What is a recursive function?

Q.294Medium

What is the issue with the following code? int factorial(int n) { return n * factorial(n-1); }

Q.295Medium

In C, are function parameters passed by value or by reference by default?

Q.296Medium

What will be the output? void modify(int x) { x = x + 10; } int main() { int a = 5; modify(a); printf("%d", a); }

Q.297Hard

How can you modify a variable inside a function and reflect the change in the calling function?

Q.298Hard

What is the output of this code? int* getPointer(int *p) { return p; } int main() { int a = 10; int *ptr = getPointer(&a); printf("%d", *ptr); }

Q.299Hard

What are static local variables in functions used for?

Q.300Hard

What will be the output? int counter() { static int count = 0; return ++count; } int main() { printf("%d ", counter()); printf("%d ", counter()); printf("%d", counter()); }