iGET

C Programming - MCQ Practice Questions

Practice free C Programming multiple-choice questions with detailed answers and explanations. Perfect for competitive exam preparation.

972 questions | 100% Free

Q.921Medium

Which of the following macro definitions will correctly compute the absolute value? #define ABS(x) ((x)<0?-(x):(x))

Q.922Medium

What will be the result of this code? #define MAX(a,b) (a>b?a:b) int x = MAX(MAX(2,5), MAX(3,4));

Q.923Hard

How many times is the argument evaluated in this macro? #define CUBE(x) ((x)*(x)*(x)) int result = CUBE(a++);

Q.924Easy

Which header file must be included to use the NULL macro?

Q.925Hard

What is a dangling macro problem in C?

Q.926Medium

What will happen when this code is compiled? #define SIZE 10 int arr[SIZE]; #undef SIZE int arr2[SIZE];

Q.927Easy

Which of the following correctly demonstrates the use of conditional compilation?

Q.928Medium

What is the purpose of predefined macros like __LINE__ and __FILE__?

Q.929Hard

Consider the following macro: #define SWAP(a,b) {int temp=a; a=b; b=temp;} What issue might occur with this macro?

Q.930Easy

What is the output of the following code? #define PI 3.14 int main() { printf("%f", PI); return 0; }

Q.931Medium

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

Q.932Medium

Which of the following correctly defines a macro with multiple statements?

Q.933Easy

What does the ## operator in preprocessor do?

Q.934Medium

What is the output of: #define STR(x) #x int main() { printf("%s", STR(Hello)); return 0; }

Q.935Easy

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

Q.936Medium

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

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

Q.938Easy

Which header file contains the definition of NULL macro?

Q.939Medium

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

Q.940Easy

What does #undef directive do?