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

Consider the macro: #define ADD(a,b) (a)+(b) What is the result of: int x = ADD(3,4) * 2;

Q.27Medium

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

Q.28Easy

Which statement about preprocessor is TRUE?

Q.29Medium

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

Q.30Hard

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

Q.31Medium

What happens when you use #undef on a macro?

Q.32Medium

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

Q.33Hard

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

Q.34Easy

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

Q.35Hard

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

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

Q.37Hard

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

Q.38Medium

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

Q.39Easy

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

Q.40Medium

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