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

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

Q.942Medium

Which of the following about preprocessor is TRUE?

Q.943Medium

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

Q.944Hard

What will happen if we define a macro with the same name as a C standard library function?

Q.945Hard

Consider the macro: #define AREA(r) 3.14*r*r What is the issue and how to fix it?

Q.946Medium

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

Q.947Hard

Which of the following will correctly print the number of arguments passed to a variadic macro in C99?

Q.948Medium

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

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

Q.950Easy

In C99, which of the following is a valid use of token pasting operator (##)?

Q.951Medium

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

Q.952Easy

Which header file is required to use assert() macro in C?

Q.953Hard

Consider: #define SWAP(a,b) {int temp=a; a=b; b=temp;} If used in an if-else without braces, which problem occurs? if(condition) SWAP(x,y); else printf("No swap");

Q.954Hard

What does the following preprocessor output? #define VERSION "2024" #define STR(x) #x printf(STR(VERSION));

Q.955Medium

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

Q.956Hard

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

Q.957Medium

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

Q.958Easy

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

Q.959Medium

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

Q.960Medium

Which statement about __VA_ARGS__ in variadic macros is CORRECT?