C Questions and Answers Part-27

1. What will be the output of the following C code?
#include < stdio.h >
int main()
{
auto i = 10;
const auto int *p = &i;
printf("%d\n", i);
}
a) 10
b) Compile time error
c) Depends on the standard
d) Depends on the compiler

Answer: a

2. Property which allows to produce different executable for different platforms in C is called?
a) File inclusion
b) Selective inclusion
c) Conditional compilation
d) Recursive macros

Answer: c

3. What is #include < stdio.h >?
a) Preprocessor directive
b) Inclusion directive
c) File inclusion directive
d) None of the mentioned

Answer: a

4. C preprocessors can have compiler specific features.
a) true
b) false
c) Depends on the standard
d) Depends on the platform

Answer: a

5. What will be the output of the following C code?
#include < stdio.h >
#define foo(m, n) m * n = 10
int main()
{
printf("in main\n");
}
a) In main
b) Compilation error as lvalue is required for the expression m*n=10
c) Preprocessor error as lvalue is required for the expression m*n=10
d) None of the mentioned

Answer: a

6. C preprocessor is conceptually the first step during compilation.
a) true
b) false
c) Depends on the compiler
d) Depends on the standard

Answer: a

7. Preprocessor feature that supply line numbers and filenames to compiler is called?
a) Selective inclusion
b) macro substitution
c) Concatenation
d) Line control

Answer: d

8. #include < somefile.h > are _______ files and #include “somefile.h” ________ files.
a) Library, Library
b) Library, user-created header
c) User-created header, library
d) They can include all types of file

Answer: d

9. What is a preprocessor?
a) That processes its input data to produce output that is used as input to another program
b) That is nothing but a loader
c) That links various source files
d) All of the mentioned

Answer: a

10. Which of the following are C preprocessors?
a) #ifdef
b) #define
c) #endif
d) all of the mentioned

Answer: d