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

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

Q.82Hard

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

Q.83Medium

Which preprocessor directive is used to generate a compiler warning or error message at compile time?

Q.84Easy

What is the difference between #include <file.h> and #include "file.h"?

Q.85Medium

Consider nested macro expansion: #define A B #define B 5 printf("%d", A); What is printed?

Q.86Medium

Which statement about __VA_ARGS__ in variadic macros is CORRECT?

Q.87Easy

What happens when #if 0...#endif wraps a block of code?

Q.88Hard

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

Q.89Easy

What is the purpose of defined() operator in preprocessor conditionals?

Q.90Medium

Consider: #define DOUBLE(x) (2*(x)) int main() { int arr[DOUBLE(5)]; ... } What is the size of the array?

Q.91Easy

What is the primary purpose of the C preprocessor?

Q.92Easy

Which directive is used to conditionally compile code based on a logical condition?

Q.93Medium

What will be the preprocessed output of the following code? #define SQUARE(x) x*x int result = SQUARE(5+3);

Q.94Medium

Consider the following macro definition: #define ADD(x,y) ((x)+(y)) #define MULTIPLY(x,y) ADD(x,y)*ADD(x,y) What is MULTIPLY(2,3)?

Q.95Medium

What does the __VA_ARGS__ preprocessor feature allow in variadic macros?

Q.96Medium

What is the output of the following code? #define STR(x) #x printf(STR(Hello World));

Q.97Medium

Consider this preprocessor code: #define CONCAT(a,b) a##b int CONCAT(var,1) = 10; What is the actual variable name created?

Q.98Hard

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

Q.99Medium

Consider the following preprocessor directives: #define MAX 100 #define MIN 50 #undef MAX #define MAX 200 int main() { printf("%d", MAX); return 0; } What will be the output of this program?

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