Preprocessor And Macros in C language MCQs

@T-Bone

This question paper focuses on the "Preprocessor And Macros" of the C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

This question paper focuses on the "Preprocessor And Macros" of the C programming. These Multiple Choice Questions (mcq) should be practiced to improve the C programming skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

Questions

1. What is the output of this program? #include <stdio.h> #define int char main() { int i=50; printf ("sizeof (i) =%d", sizeof (i)); }

Mark the correct option

2. What is the output of this program? #include <stdio.h> #define x 3 int main() { int i; i = x*x*x; printf("%d",i); return 0; }

Mark the correct option

3. What is the output of this program? #include <stdio.h> #include <stdlib.h> #define square(x) x*x int main() { int i; i = 27/square(3); printf("%d",i); return 0; }

Mark the correct option

4. What is the output of this program? #include <stdio.h> #define i 5 int main() { #define i 10 printf("%d",i); return 0; }

Mark the correct option

5. What is the output of this program? #include <stdio.h> #define clrscr() 17 int main() { clrscr(); printf("%d",clrscr()); return 0; }

Mark the correct option

6. What is the output of this program? #include <stdio.h> int main() { printf("%d",30); return 0; }

Mark the correct option

7. What is the output of this program? #include <stdio.h> #define p 17; int main() { printf("%d",p); return 0; }

Mark the correct option

8. Which statment is true about the given code ? #include <stdio.h> enum colors {lets,find,course}; int main() { printf("%d %d %d",course,lets,find); return 0; }

Mark the correct option

9. What is the Error of this program? #include <stdio.h> #define CONDITION(x) printf("letsfindcourse"); int main() { CONDITION(0); return 0; }

Mark the correct option

10. How will you free the memory allocated by the following program? #include <stdio.h> #define CONDITION(x) printf("letsfindcourse"); int main() { CONDITION(0); return 0; }

Mark the correct option

11. What is a preprocessor directive

Mark the correct option

12. Which of the following are correctly formed #define statements?

Mark the correct option

13. A macro must always be written in capital letters.

Mark the correct option

14. A macro should always be accommodated in a single line.

Mark the correct option

15. After preprocessing when the program is sent for compilation the macros are removed from the expanded source code.

Mark the correct option

16. Macros with arguments are not allowed.

Mark the correct option

17. Nested macros are allowed.

Mark the correct option

18. Tn a macro call the control is passed to the macro.

Mark the correct option

19. All macro substitutions in a program are done?

Mark the correct option

20. In a program the statement: #include "filename" is replaced by the contents of the file "filename"?

Mark the correct option

21. Identify the trigraph sequence for .

Mark the correct option

22. Identify the trigraph sequence for^.

Mark the correct option

23. What is the output generated by the following code? ÂÂÂÂ#define square (a) (a*a) ÂÂÂÂprintf("%d", square (4+5) ) ;

Mark the correct option

24. Undefined function calls in a C program.

Mark the correct option

25. Identify the macro(s) defined in stdarg.h.

Mark the correct option

26. va_list is

Mark the correct option

27. The following line in a program # represents

Mark the correct option

28. Identify the stringizing operator.

Mark the correct option

29. The EOF character can be included in a file as part of its data

Mark the correct option

30. The NULL character indicates an end of a string and a file.

Mark the correct option