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

Which predefined macro gives the line number in the source file?

Q.62Medium

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

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

Q.64Easy

Which header file contains the definition of NULL macro?

Q.65Medium

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

Q.66Easy

What does #undef directive do?

Q.67Medium

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

Q.68Medium

Which of the following about preprocessor is TRUE?

Q.69Medium

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

Q.70Hard

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

Q.71Hard

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

Q.72Medium

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

Q.73Hard

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

Q.74Medium

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

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

Q.76Easy

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

Q.77Medium

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

Q.78Easy

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

Q.79Hard

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

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