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
What is the output of this code? #define ADD(a,b) a+b int result = ADD(5,3)*2;
What is the purpose of the #ifdef directive?
Which of the following shows the correct order of preprocessor directives in a C program?
What is the difference between #include <stdio.h> and #include "myheader.h"?
What will happen if you define the same macro twice with different values?
What is the output of this code? #define SWAP(a,b) {int temp=a; a=b; b=temp;} int x=5, y=10; SWAP(x,y); printf("%d %d", x, y);
What does the ## operator do in a macro?
What is the output? #define STR(x) #x printf("%s", STR(hello));
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);
What will be printed? #define DEBUG 1 #if DEBUG printf("Debug mode ON"); #else printf("Debug mode OFF"); #endif
What does the following macro do? #define CONCATENATE(a,b) a##b
What is the output of: #define STR(x) #x printf("%s", STR(HELLO));
What happens when you use #undef on a macro?
Which of the following will correctly find the maximum of two numbers using a macro?
Which of the following is the correct way to prevent multiple inclusion of a header file?
What is the output of the following code? #define SQUARE(x) x*x int a = SQUARE(5+3);
What will be the output of this preprocessor code? #define ADD(a,b) a+b int result = ADD(2,3)*2;
What happens when you use stringification operator (#) in a macro? #define STRINGIFY(x) #x
What is the token pasting operator (##) used for in C preprocessor?