+91-6376366224     Send message / ask question on our official What's App Number .

Yes / No Questions

Question 1 :

Will the program compile successfully?

#include < stdio.h >
#define X (4+Y)
#define Y (X+3)

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


A). Yes
B). No
Answer : Option B

Explanation :

Reports an error: Undefined symbol 'X'


Question 2 :

Would the following typedef work?
typedef #include l;


A). Yes
B). No
Answer : Option B

Explanation :

Because typedef goes to work after preprocessing.


Question 3 :

Will the program compile successfully?

#include < stdio.h >
int main()
{
    printf("India" "Parinam\n");
    return 0;
}


A). Yes
B). No
Answer : Option A

Explanation :

Yes, It prints "India Parinam"


Question 4 :

It is necessary that a header files should have a .h extension?


A). Yes
B). No
Answer : Option B

Explanation :

No, the header files have any kind of extension.


Question 5 :

Will the program compile successfully?

#include < stdio.h >
int main()
{
    #ifdef NOTE
        int a;
        a=10;
    #else
        int a;
        a=20;
    #endif
    printf("%d\n", a);
    return 0;
}


A). Yes
B). No
Answer : Option A

Explanation :

Yes, this program will compile and run successfully and prints 20.

The macro #ifdef NOTE evaluates the given expression to 1. If satisfied it executes the #ifdef block statements. Here #ifdef condition fails because the Macro NOTE is nowhere declared.

Hence the #else block gets executed, the variable a is declared and assigned a value of 20.

printf("%d\n", a); It prints the value of variable a 20.