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

Which of the following is NOT a preprocessor directive?

Q.22Medium

Consider the following code:
#define MAX 100
#define MAX 200
What will be the result?

Q.23Medium

What will be the output of the following code?
#define SQUARE(x) x*x
int result = SQUARE(2+3);
printf("%d", result);

Q.24Easy

Which preprocessor directive is used to conditionally compile code based on whether a macro is defined?

Q.25Medium

What will be printed?
#define DEBUG 1
#if DEBUG
printf("Debug mode ON");
#else
printf("Debug mode OFF");
#endif

Q.26Medium

What does the following macro do?
#define CONCATENATE(a,b) a##b

Q.27Easy

Which statement about preprocessor is TRUE?

Q.28Medium

What is the output of:
#define STR(x) #x
printf("%s", STR(HELLO));

Q.29Hard

Consider:
#define MAX(a,b) ((a)>(b)?(a):(b))
Which advantage does this provide?

Q.30Medium

What happens when you use #undef on a macro?

Q.31Medium

Which of the following will correctly find the maximum of two numbers using a macro?

Q.32Hard

What will be output?
#define PRINT(x) printf(#x " = %d\n", x)
PRINT(5+3);

Q.33Easy

Which preprocessor directive should be used to check if a macro is NOT defined?

Q.34Hard

What is the result of the following?
#define MIN(x,y) ((x)<(y)?(x):(y))
int a=5, b=3;
int result = MIN(a++, b++);

Q.35Easy

Which header file is included using angle brackets in standard C library?

Q.36Hard

What does the following preprocessor do?
#define OFFSET(type, field) ((size_t)&(((type *)0)->field))

Q.37Medium

Which of the following is the correct way to prevent multiple inclusion of a header file?

Q.38Easy

Which preprocessor directive is used to define a constant that cannot be changed during program execution?

Q.39Medium

What is the output of the following code?
#define SQUARE(x) x*x
int a = SQUARE(5+3);

Q.40Easy

Which of the following is a difference between #include <file.h> and #include "file.h"?