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

What is the issue with this macro: #define MAX(a,b) a>b?a:b int x = MAX(2, 3); int y = MAX(++i, ++j);

Q.942Medium

What is the purpose of #pragma pack() directive?

Q.943Easy

Which header file contains the definition of NULL macro?

Q.944Medium

What is the output of: #define ADD(x,y) (x+y) int main() { printf("%d", ADD(5,3)*2); return 0; }

Q.945Easy

What does #undef directive do?

Q.946Medium

What is the output of: #define MIN(a,b) ((a)<(b)?(a):(b)) int main() { printf("%d", MIN(10, 5*2)); return 0; }

Q.947Medium

Which of the following about preprocessor is TRUE?

Q.948Medium

What is the correct way to define a multi-line macro in C?

Q.949Hard

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

Q.950Hard

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

Q.951Medium

Consider the preprocessor directive #define MAX 100. If this macro is used in multiple source files, which statement is TRUE?

Q.952Hard

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

Q.953Medium

What is the output of the following code? #define SQUARE(x) x*x int main() { int a = 5; printf("%d", SQUARE(a+1)); return 0; }

Q.954Medium

What will be the result of executing the following? #define PRINT(x) printf(#x) int main() { int a = 10; PRINT(a); return 0; }

Q.955Easy

In C99, which of the following is a valid use of token pasting operator (##)?

Q.956Medium

What is the purpose of #line directive in C preprocessing?

Q.957Easy

Which header file is required to use assert() macro in C?

Q.958Hard

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

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

Q.960Medium

Which of the following correctly uses #pragma once for header file protection in 2024 standards?