Log In Register

Units


C-preprocessor - Questions and Answers

 

Practice these C-preprocessor under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on C-preprocessor for following purpose.


– Anyone who is wishing to increase their perfect knowledge of C-preprocessor of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically C-preprocessor.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on C-preprocessor under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  C-preprocessor topic of C Programming:

 

1.

C preprocessors can have compiler specific features.

Answer: Option D

Explanation:

#pragma is compiler specific feature.

2.

A preprocessor is a program

Answer: Option C

Explanation:

A preprocessor is a preprocessor is a program that processes its input data to produce output that is used as input to another program.

3.

#include <stdio.h> is called

Answer: Option C

Explanation:

4.

What is the output of this C code?

  1.     #include <stdio.h>
  2.     int main()
  3.     {
  4.         int one = 1, two = 2;
  5.         #ifdef next
  6.         one = 2;
  7.         two = 1;
  8.         #endif
  9.         printf("%d, %d", one, two);
  10.     }

Answer: Option C

Explanation:

5.

Which of the following are C preprocessors?

Answer: Option D

Explanation:

6.

The C-preprocessors are specified with _________symbol.

Answer: Option D

Explanation:

The C-preprocessors are specified with # symbol.

7.

#include statement must be written

Answer: Option C

Explanation:

Using these directives before main() improves readability.

8.

The preprocessor provides the ability for _______________

Answer: Option D

Explanation:

The preprocessor provides the ability for the inclusion of header files, macro expansions, conditional compilation, and line control.

9.

#include <somefile.h> are _______ files and #include “somefile.h” ________ files.

Answer: Option A

Explanation:

Both of these statement can be used to select any file.

10.

If #include is used with file name in angular brackets

Answer: Option C

Explanation:

With the #include, if the filename is enclosed within angle brackets, the file is searched for in the standard compiler include paths.

11.

What is the output of this C code?

  1. #include <stdio.h>
  2. #define foo(m, n) m * n = 10
  3. int main()
  4. {
  5.     printf("in main\n");
  6. }

Answer: Option C

Explanation:

Preprocessor just replaces whatever is given compiler then checks for error at the replaced part of the code. Here it is not replaced anywhere.
Output:
$ cc pgm1.c
$ a.out
in main

12.

C preprocessor is conceptually the first step during compilation

Answer: Option D

Explanation:

13.

#pragma exit is primarily used for?

Answer: Option B

Explanation:

It is primarily used for running a function upon exitting the program.

14.

Property which allows to produce different executable for different platforms in C is called?

Answer: Option B

Explanation:

Conditional compilation is the preprocessor facility to produce different executable.

15.

The #include directive

Answer: Option C

Explanation:

The #include directive tells the preprocessor to grab the text of a file and place it directly into the current file and are statements are typically placed at the top of a program.