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

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

Q.462Medium

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

Q.463Medium

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

Q.464Medium

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

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

Q.466Medium

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

Q.467Medium

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

Q.468Medium

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

Q.469Medium

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

Q.470Medium

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

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

Q.472Medium

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

Q.473Medium

What is the output of: #define MIN(a,b) ((a)<(b)?(a):(b)) int main() { printf("%d", MIN(10, 5*2)); return 0; }

Q.474Medium

Which of the following about preprocessor is TRUE?

Q.475Medium

What is the correct way to define a multi-line macro in C?

Q.476Medium

Consider the preprocessor directive #define MAX 100. If this macro is used in multiple source files, which statement is TRUE?

Q.477Medium

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; }

Q.478Medium

What will be the result of executing the following? #define PRINT(x) printf(#x) int main() { int a = 10; PRINT(a); return 0; }

Q.479Medium

What is the purpose of #line directive in C preprocessing?

Q.480Medium

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