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

Which of the following is NOT a preprocessor directive in C?

Q.2Easy

What is the output of the following code? #define MAX 5 int arr[MAX];

Q.3Easy

Which preprocessor directive is used to include standard library files?

Q.4Easy

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

Q.5Medium

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

Q.6Medium

What is the purpose of the #ifdef directive?

Q.7Medium

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

Q.8Medium

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

Q.9Easy

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

Q.10Medium

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

Q.11Easy

What is the purpose of the #undef directive?

Q.12Medium

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.13Medium

What does the ## operator do in a macro?

Q.14Medium

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

Q.15Hard

Which statement about #define is TRUE?

Q.16Hard

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

Q.17Hard

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.18Hard

What is the difference between #if and #ifdef?

Q.19Hard

What preprocessor features should be avoided for safer code?

Q.20Easy

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