Top

C Preprocessor

71.

Every C program will contain at least one preprocessor directive.

Answer: B

False, the preprocessor directive is not mandatory in any c program.

Enter details here

72.

Will the program compile successfully?

#include
#define X (4+Y)
#define Y (X+3)

int main()
{
    printf("%d\n", 4*X+2);
    return 0;
}

 

Answer: B

Reports an error: Undefined symbol 'X'

Enter details here

73.

 

The following program won’t compile because there’re space between macro name and open parenthesis.

#include "stdio.h"
 
#define MYINC   (  a  )  (  ( a )  +  1 )
 
int main()
{
 
 printf("GeeksQuiz!");
 
 return 0;
}

 

Answer: B

No answer description available for this question.

Enter details here

Answer: C

#error is a preprocessor directive which causes the preprocessor to report a fatal error. The tokens which form the rest of the line after #error are used as the error message.

Enter details here

75.

Identify the stringizing operator.

Answer: C

No answer description available for this question.

Enter details here

76.

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

Answer: A

Before compilation is the answer.

Enter details here

77.

Identify the trigraph sequence for .

Answer: A

The trigraph sequence for is ??/

Enter details here

78.

Which of the following are correct preprocessor directives in C?

1. #ifdef

2. #if

3. #elif

4. #undef

Answer: D

No answer description available for this question.

Enter details here

79.

What will be the output of the following C code if the value of ‘p’ is 10 and that of ‘q’ is 15?

#include
int main()
{
    int p,q;
    printf("Enter two numbers\n");
    scanf("%d",&p);
    scanf("%d",&q);
    #if(4<2>-1)
    printf("%d",q);
    #else
    printf("bye");
    #endif
}

 

Answer: B

The output of the code shown above is 15. The values given for ‘p’ and ‘q’ are 10 and 15 respectively. Since the condition given for #elif is true, the value stored in ‘q’ will be printed, that is 15.

Enter details here

80.

The preprocessor directive which is used to remove the definition of an identifier which was previously defined with #define?

Answer: B

#undef is used to remove the definition of any identifier which had been previously defined in the code with #define.

Enter details here

Loading…
Tags: C Preprocessor Questions and Answers || C Preprocessor MCQ Questions and Answers || C Preprocessor GK Questions and Answers || C Preprocessor GK MCQ Questions || C Preprocessor Multiple Choice Questions and Answers || C Preprocessor GK || GK on C Preprocessor || C Programming Questions and Answers || C Programming MCQ Questions and Answers || C Programming GK Questions and Answers || GK on C Programming