Wednesday, 8 November 2017

Output Preprocessor Questions


More Preprocessor Catagories:

Simple Preprocessor Questions
Fill The Blanks Preprocessor Questions

--------------------------------------------------------------------------------------

1.
What is the output of this C code?
#include
    int main()
    {
        int one = 1, two = 2;
        #ifdef next
        one = 2;
        two = 1;
        #endif
        printf("%d, %d", one, two);
    }

A. 1, 1
B. 1, 2
C. 2, 1
D. 2, 2


Answer: B
-----------------------------------------------------------------------------------------

2.
The #include directive

A. Tells the preprocessor to grab the text of a file and place it directly into the current file
B. Statements are typically placed at the top of a program
C. both a & b
D. None of a & b

Answer: C

-----------------------------------------------------------------------------------------

3.
Find the output?

#include
#define int char 
void main()
{
      int i = 65;
      printf("sizeof(i)=%d", sizeof(i));
}

A. sizeof(i)=2
B. sizeof(i)=1
C. Compiler Error
D. None

Answer: B
------------------------------------------------------------------------------------------

4.
What will be the output of the following program?

#include
#define square(x) x*x 
void main()
      int i; 
      i = 64/square(4); 
      printf("%d", i); 
}

A.
B. 64
C. 16
D. None

Answer: B
--------------------------------------------------------------------------------------------

5.
Find the Output?

#include
#define a 10
void main()
{
      #define a 50
      printf("%d", a);
}

A. 50
B. 10
C. Compile Error
D. None

Answer: A
-------------------------------------------------------------------------------------------


100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...