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

What does the following preprocessor directive do?
#define SQUARE(x) ((x)*(x))

Q.882Medium

What is the output of this code?
#define ADD(a,b) a+b
int result = ADD(5,3)*2;

Q.883Medium

What is the purpose of the #ifdef directive?

Q.884Medium

Which of the following shows the correct order of preprocessor directives in a C program?

Q.885Medium

What is the difference between #include <stdio.h> and #include "myheader.h"?

Q.886Easy

What is the output?
#define MAX(a,b) (a>b?a:b)
printf("%d", MAX(10, 5));

Q.887Medium

What will happen if you define the same macro twice with different values?

Q.888Easy

What is the purpose of the #undef directive?

Q.889Medium

What is the output of this code?
#define SWAP(a,b) {int temp=a; a=b; b=temp;}
int x=5, y=10;
SWAP(x,y);
printf("%d %d", x, y);

Q.890Medium

What does the ## operator do in a macro?

Q.891Medium

What is the output?
#define STR(x) #x
printf("%s", STR(hello));

Q.892Hard

Which statement about #define is TRUE?

Q.893Hard

What is the problem with this macro?
#define DOUBLE(x) x*x
int result = DOUBLE(2+3);

Q.894Hard

What will be the output?
#define MIN(a,b) ((a)<(b)?(a):(b))
int x=5; int y=10;
int z = MIN(x++, y++);

Q.895Hard

What is the difference between #if and #ifdef?

Q.896Hard

What preprocessor features should be avoided for safer code?

Q.897Easy

What is the primary role of the C preprocessor in the compilation process?

Q.898Easy

Which of the following is NOT a preprocessor directive?

Q.899Medium

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

Q.900Medium

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