InterviewSolution
Saved Bookmarks
This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.
| 1. |
#include <stdio.h>#define PRINT(i, limit) do \{ \if (i++ < limit) \{ \printf("GeeksQuiz\n"); \continue; \} \}while(1)int main(){PRINT(0, 3);return 0;}How many times GeeksQuiz is printed in the above program?(A) 1(B) 3(C) 4(D) Compile-time error |
| Answer» | |
| 2. |
Output?#include<stdio.h>#define f(g,g2) g##g2int main(){int var12 = 100;printf("%d", f(var,12));return 0;}(A) 100(B) Compiler Error(C) 0(D) 1 |
| Answer» None | |
| 3. |
#include <stdio.h>#define ISEQUAL(X, Y) X == Yint main(){#if ISEQUAL(X, 0)printf("Geeks");#elseprintf("Quiz");#endifreturn 0;}Output of the above program?(A) Geeks(B) Quiz(C) Any of Geeks or Quiz(D) Compile time error |
| Answer» | |
| 4. |
What is the output of following program?#include <stdio.h>#define macro(n, a, i, m) m##a##i##n#define MAIN macro(n, a, i, m)int MAIN(){printf("GeeksQuiz");return 0;}(A) Compiler Error(B) GeeksQuiz(C) MAIN(D) main |
| Answer» | |
| 5. |
Which file is generated after pre-processing of a C program?(A) .p(B) .i(C) .o(D) .m |
| Answer» | |
| 6. |
#include <stdio.h>#if X == 3#define Y 3#else#define Y 5#endifint main(){printf("%d", Y);return 0;}What is the output of the above program?(A) 3(B) 5(C) 3 or 5 depending on value of X(D) Compile time error |
| Answer» | |
| 7. |
#include <stdio.h>#define X 3#if !Xprintf("Geeks");#elseprintf("Quiz");#endifint main(){return 0;}(A) Geeks(B) Quiz(C) Compiler Error(D) Runtime Error |
| Answer» None | |
| 8. |
What is the output for the following code snippet?#include<stdio.h>#define A -B#define B -C#define C 5int main(){printf("The value of A is %d\n", A);return 0;}This question is contributed by Aastha Anand.(A) The value of A is 4(B) The value of A is 5(C) Compilation Error(D) Runtime Error |
| Answer» | |
| 9. |
Output of following C program?#include<stdio.h>#define max abc#define abc 100int main(){printf("maximum is %d", max);return 0;}(A) maximum is 100(B) abcimum is 100(C) 100imum is 100(D) abcimum is abc |
| Answer» None | |
| 10. |
#include <stdio.h>#define get(s) #sint main(){char str[] = get(GeeksQuiz);printf("%s", str);return 0;}(A) Compiler Error(B) #GeeksQuiz(C) GeeksQuiz(D) GGeeksQuiz |
| Answer» | |
| 11. |
What is the use of “#pragma once”?(A) Used in a header file to avoid its inclusion more than once.(B) Used to avoid multiple declarations of same variable.(C) Used in a c file to include a header file at least once.(D) Used to avoid assertions |
| Answer» | |
| 12. |
Predict the output of following program?#include <stdio.h>#define MAX 1000int main(){int MAX = 100;printf("%d ", MAX);return 0;}(A) 1000(B) 100(C) Compiler Error(D) Garbage Value |
| Answer» None | |