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

In competitive programming for graph problems, if adjacency list uses dynamic arrays, what is the time complexity of adding an edge?

Q.442Medium

What is the correct way to store variable-length strings dynamically?

Q.443Medium

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

Q.444Medium

What is the purpose of the #ifdef directive?

Q.445Medium

Which of the following shows the correct order of preprocessor directives in a C program?

Q.446Medium

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

Q.447Medium

What will happen if you define the same macro twice with different values?

Q.448Medium

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

Q.449Medium

What does the ## operator do in a macro?

Q.450Medium

What is the output? #define STR(x) #x printf("%s", STR(hello));

Q.451Medium

Consider the following code: #define MAX 100 #define MAX 200 What will be the result?

Q.452Medium

What will be the output of the following code? #define SQUARE(x) x*x int result = SQUARE(2+3); printf("%d", result);

Q.453Medium

What will be printed? #define DEBUG 1 #if DEBUG printf("Debug mode ON"); #else printf("Debug mode OFF"); #endif

Q.454Medium

What does the following macro do? #define CONCATENATE(a,b) a##b

Q.455Medium

What is the output of: #define STR(x) #x printf("%s", STR(HELLO));

Q.456Medium

What happens when you use #undef on a macro?

Q.457Medium

Which of the following will correctly find the maximum of two numbers using a macro?

Q.458Medium

Which of the following is the correct way to prevent multiple inclusion of a header file?

Q.459Medium

What is the output of the following code? #define SQUARE(x) x*x int a = SQUARE(5+3);

Q.460Medium

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