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

Which of the following is a difference between #include <file.h> and #include "file.h"?

Q.42Medium

What will be the output of this preprocessor code? #define ADD(a,b) a+b int result = ADD(2,3)*2;

Q.43Easy

Consider the following code: #define PI 3.14 #undef PI #define PI 3.14159 What is the value of PI after execution?

Q.44Medium

What happens when you use stringification operator (#) in a macro? #define STRINGIFY(x) #x

Q.45Medium

What is the token pasting operator (##) used for in C preprocessor?

Q.46Medium

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

Q.47Hard

What is the output of: #define MULTIPLY(x,y) x*y int ans = MULTIPLY(3+2, 4+5);

Q.48Medium

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

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

Q.50Easy

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

Q.51Hard

What is a dangling macro problem in C?

Q.52Medium

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

Q.53Easy

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

Q.54Medium

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

Q.55Hard

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

Q.56Easy

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

Q.57Medium

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

Q.58Medium

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

Q.59Easy

What does the ## operator in preprocessor do?

Q.60Medium

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