iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

972 questions | 100% Free

Q.901Easy

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

Q.902Medium

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

Q.903Medium

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

Q.904Easy

Which statement about preprocessor is TRUE?

Q.905Medium

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

Q.906Hard

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

Q.907Medium

What happens when you use #undef on a macro?

Q.908Medium

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

Q.909Hard

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

Q.910Easy

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

Q.911Hard

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

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

Q.913Hard

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

Q.914Medium

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

Q.915Easy

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

Q.916Medium

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

Q.917Easy

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

Q.918Easy

Consider the following code: #define PI 3.14 #undef PI #define PI 3.14159 What is the value of PI after execution?

Q.919Medium

What happens when you use stringification operator (#) in a macro? #define STRINGIFY(x) #x

Q.920Medium

What is the token pasting operator (##) used for in C preprocessor?