Top

C Preprocessor

1.

Will it result in to an error if a header file is included twice?

Answer: C

Unless the header file has taken care to ensure that if already included it doesn't get included again.

Turbo C, GCC compilers would take care of these problems, generate no error.

Enter details here

2.

Will the following program print the message infinite number of times?

#include
#define INFINITELOOP while(1)

int main()
{
    INFINITELOOP
    printf("IndiaBIX");
    return 0;
}

 

Answer: A

No answer description available for this question.

Enter details here

3.

Will the program compile successfully?

#include

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

 

Answer: A

No answer description available for this question.

Enter details here

4.

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

Answer: B

No, the header files have any kind of extension.

Enter details here

5.

Will the program compile successfully?

#include

int main()
{
    printf("India" "BIX\n");
    return 0;
}

 

Answer: A

Yes, It prints "IndiaBIX"

Enter details here

Loading…