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

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

Q.902Medium

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

Q.903Easy

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

Q.904Medium

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

Q.905Hard

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

Q.906Medium

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

Q.907Easy

Which statement about preprocessor is TRUE?

Q.908Medium

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

Q.909Hard

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

Q.910Medium

What happens when you use #undef on a macro?

Q.911Medium

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

Q.912Hard

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

Q.913Easy

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

Q.914Hard

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

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

Q.916Hard

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

Q.917Medium

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

Q.918Easy

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

Q.919Medium

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

Q.920Easy

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