C Preprocessor-3
1. What is the C Preprocessor directive to be used to add a header file or any file to existing C program?
a) #add
b) #present
c) #include
d) $include
Answer: C
#include
2. What does #include stdio.h does in c language?
a) It includes stdio.h into existing C program
b) #include increases the size of C program by including the specified file contents like functions, constants etc
c) #include includes specified file before compilation
d) All the above
Answer: D
No explaination is given for this question.
3. What is the abbreviation of C STDIO in stdio.h?
a) Standard Input Output
b) String Terminating Operations Input Output
c) Store Input Output
d) None of the above
Answer: A
No explaination is given for this question.
4. What is a Pragma in C language?
a) A Pragma may be an instruction to build tool to process or generate comments
b) A Pragma may be an instruction to compiler to execute specific functions at specific times say startup or exit of program.
c) A pragma may be an instruction to tell compiler to ignore certain warnings.
d) All the above
Answer: D
No explaination is given for this question.
5. At what stage of building a C program does Pragma work?
a) Before Compilation
b) After compilation
c) After Linking
d) None of the above
Answer: A
A Pragma works before compilation and after Preprocessing. It tells compiler to follow or ignore certain things.
6. Which of the following is not true about preprocessor directives
a) They begin with a hash symbol
b) They are processed by a preprocessor
c) They form an integral part of the code
d) They have to end with a semi colon
Answer: D
No explaination is given for this question.
7.The purpose of the preprocessor directive #error is that ______
a) It rectifies any error present in the code
b) It rectifies only the first error which occurs in the code
c) It causes the preprocessor to report a fatal error
d) It causes the preprocessor to ignore an error
Answer: C
No explaination is given for this question.
8. atoi() function is used for
a)convert ASCII character to integer value
b)convert a character string to its equivalent integer value
c)gets index value of character in an array
d)converts an array of characters to array of equivalent integers
Answer: B
No explaination is given for this question.
9. Macro is generally written in
#include <stdio.h>
#define max 100
int main() {
clrscr();
printf("%d", clrscr());
return 0;
}
a) Compilation error
b) Runtime error
c) 17
d) none of the above
Answer: C
No explaination is given for this question.
10. We can define macros with argument?
#include <stdio.h>
int main() {
printf("%d", 30);
return 0;
}
a) Runtime Error
b) Garbage value
c) Compilation error
d) 30
Answer: C
No explaination given for this question.