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.61Easy

Which header file contains the definition of NULL macro?

Q.62Medium

What is the output of:
#define ADD(x,y) (x+y)
int main() { printf("%d", ADD(5,3)*2); return 0; }

Q.63Easy

What does #undef directive do?

Q.64Medium

What is the output of:
#define MIN(a,b) ((a)<(b)?(a):(b))
int main() { printf("%d", MIN(10, 5*2)); return 0; }

Q.65Medium

Which of the following about preprocessor is TRUE?

Q.66Medium

What is the correct way to define a multi-line macro in C?

Q.67Hard

What will happen if we define a macro with the same name as a C standard library function?

Q.68Hard

Consider the macro: #define AREA(r) 3.14*r*r
What is the issue and how to fix it?

Q.69Medium

Consider the preprocessor directive #define MAX 100. If this macro is used in multiple source files, which statement is TRUE?

Q.70Hard

Which of the following will correctly print the number of arguments passed to a variadic macro in C99?

Q.71Medium

What is the output of the following code?
#define SQUARE(x) x*x
int main() { int a = 5; printf("%d", SQUARE(a+1)); return 0; }

Q.72Medium

What will be the result of executing the following?
#define PRINT(x) printf(#x)
int main() { int a = 10; PRINT(a); return 0; }

Q.73Easy

In C99, which of the following is a valid use of token pasting operator (##)?

Q.74Medium

What is the purpose of #line directive in C preprocessing?

Q.75Easy

Which header file is required to use assert() macro in C?

Q.76Hard

Consider: #define SWAP(a,b) {int temp=a; a=b; b=temp;}
If used in an if-else without braces, which problem occurs?
if(condition) SWAP(x,y); else printf("No swap");

Q.77Hard

What does the following preprocessor output?
#define VERSION "2024"
#define STR(x) #x
printf(STR(VERSION));

Q.78Medium

Which of the following correctly uses #pragma once for header file protection in 2024 standards?

Q.79Hard

What will be the output of:
#define MAX(a,b) ((a)>(b)?(a):(b))
int main() { printf("%d", MAX(5++, 10)); return 0; }

Q.80Medium

Which preprocessor directive is used to generate a compiler warning or error message at compile time?