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
Consider the following code: #define MAX 100 #define MAX 200 What will be the result?
What will be the output of the following code? #define SQUARE(x) x*x int result = SQUARE(2+3); printf("%d", result);
Which preprocessor directive is used to conditionally compile code based on whether a macro is defined?
What will be printed? #define DEBUG 1 #if DEBUG printf("Debug mode ON"); #else printf("Debug mode OFF"); #endif
Consider the macro: #define ADD(a,b) (a)+(b) What is the result of: int x = ADD(3,4) * 2;
What does the following macro do? #define CONCATENATE(a,b) a##b
Which statement about preprocessor is TRUE?
What is the output of: #define STR(x) #x printf("%s", STR(HELLO));
Consider: #define MAX(a,b) ((a)>(b)?(a):(b)) Which advantage does this provide?
What happens when you use #undef on a macro?
Which of the following will correctly find the maximum of two numbers using a macro?
What will be output? #define PRINT(x) printf(#x " = %d\n", x) PRINT(5+3);
Which preprocessor directive should be used to check if a macro is NOT defined?
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++);
Which header file is included using angle brackets in standard C library?
What does the following preprocessor do? #define OFFSET(type, field) ((size_t)&(((type *)0)->field))
Which of the following is the correct way to prevent multiple inclusion of a header file?
Which preprocessor directive is used to define a constant that cannot be changed during program execution?
What is the output of the following code? #define SQUARE(x) x*x int a = SQUARE(5+3);
Which of the following is a difference between #include <file.h> and #include "file.h"?