C Preprocessor Test 11) In which stage the below code gets replaced by the contents of the file #include<stdio.h>
The correct option is (c). Explanation: During preprocessing stage the line #include<stdio.h> with the system header file of that name gets replaced by the contents of file stdio.h. Therefore the entire text of the file 'stdio.h' replaces with #include directive. 2) C preprocessor directive #undef can be used with a macro that has been #define earlier.
The correct option is (a). Explanation: True, the directive #undef can be used only with a macro that has been #define earlier in a program. For Example: #define PI 3.14 We can undefine PI macro by #undef PI 3) C preprocessor directive #ifdef...#elif?#endif is used for conditional compilation.
The correct option is (a). Explanation: True, the C macros like #ifdef...#elif?#endif are used for performing conditional operation in C program. The syntax of C preprocessor directive is: 4) What will be the output of the below program?
The correct option is (b). Explanation: The macro statement SWAP(x, y) int t; t=x, x=y, y=t; swaps the value of given two variable. Step 1: int x=10, y=20; The variable x and y are declared as an integer type and initialized to 10, 20 respectively. Step 2: SWAP(x, y);. Here the macro is substituted and it swaps the value to variable x and y. Hence the output of the program is x=20, y=10. 5) Which of the following are correctly formed #define statements in C language?
The correct option is (d). Explanation: The syntax for macro definition with argument is:
Next TopicC Preprocessor Test 2 |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India