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

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

Q.182Hard

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

Q.183Hard

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

Q.184Hard

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

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

Q.186Hard

What is the output of: #define MULTIPLY(x,y) x*y int ans = MULTIPLY(3+2, 4+5);

Q.187Hard

How many times is the argument evaluated in this macro? #define CUBE(x) ((x)*(x)*(x)) int result = CUBE(a++);

Q.188Hard

What is a dangling macro problem in C?

Q.189Hard

Consider the following macro: #define SWAP(a,b) {int temp=a; a=b; b=temp;} What issue might occur with this macro?

Q.190Hard

What will happen if we define a macro with the same name as a C standard library function?

Q.191Hard

Consider the macro: #define AREA(r) 3.14*r*r What is the issue and how to fix it?

Q.192Hard

Which of the following will correctly print the number of arguments passed to a variadic macro in C99?

Q.193Hard

Consider: #define SWAP(a,b) {int temp=a; a=b; b=temp;} If used in an if-else without braces, which problem occurs? if(condition) SWAP(x,y); else printf("No swap");

Q.194Hard

What does the following preprocessor output? #define VERSION "2024" #define STR(x) #x printf(STR(VERSION));

Q.195Hard

What will be the output of: #define MAX(a,b) ((a)>(b)?(a):(b)) int main() { printf("%d", MAX(5++, 10)); return 0; }

Q.196Hard

Which of the following will cause infinite recursion when used? #define RECURSE() RECURSE()

Q.197Hard

What will happen if a macro is defined multiple times with different definitions in the same compilation unit? #define SIZE 10 #define SIZE 20

C Programming MCQs & Practice Tests – Free | iGET | iGET