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
Which predefined macro gives the line number in the source file?
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);
What is the purpose of #pragma pack() directive?
Which header file contains the definition of NULL macro?
What is the output of: #define ADD(x,y) (x+y) int main() { printf("%d", ADD(5,3)*2); return 0; }
What does #undef directive do?
What is the output of: #define MIN(a,b) ((a)<(b)?(a):(b)) int main() { printf("%d", MIN(10, 5*2)); return 0; }
Which of the following about preprocessor is TRUE?
What is the correct way to define a multi-line macro in C?
What will happen if we define a macro with the same name as a C standard library function?
Consider the macro: #define AREA(r) 3.14*r*r What is the issue and how to fix it?
Consider the preprocessor directive #define MAX 100. If this macro is used in multiple source files, which statement is TRUE?
Which of the following will correctly print the number of arguments passed to a variadic macro in C99?
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; }
What will be the result of executing the following? #define PRINT(x) printf(#x) int main() { int a = 10; PRINT(a); return 0; }
In C99, which of the following is a valid use of token pasting operator (##)?
What is the purpose of #line directive in C preprocessing?
Which header file is required to use assert() macro in C?
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");
What does the following preprocessor output? #define VERSION "2024" #define STR(x) #x printf(STR(VERSION));