Vidyalelo
C Programming · all questions

C Preprocessor
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

93

Questions

4/5

Page

Pick an option on a question to see the right answer and solution.

What will be the output of the following C code?
#define display(text) printf(#text "@")
main()
{
    display(hello.);
    display(good morning!);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#define p( n ) printf( "t%%\n" #n " = %d", t##n )
int t3=10;
int main()
{
    int x;
    x=p(3);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#define p( n,m ) printf( "%d", m##n )
#define q(a,b) printf("%d",a##b)
main()
{
   p(3,4);
   q(5,6);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
#define hello 10
void main()
{
    printf("%d",hello);
    #undef hello
    printf("%d",hello);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#define display( n ) printf( "a" #n " = %d", a##n )
int main()
{
   display(3);
}

Select an option to see the answer and solution.

The preprocessor directive used to give additional information to the compiler, beyond which is conveyed in the language . . . . . . . .

Select an option to see the answer and solution.

Which of the following operators is used to concatenate two strings without space?

Select an option to see the answer and solution.

#pragma GCC poison should be followed by a list of identifiers that are . . . . . . . .

Select an option to see the answer and solution.

In the directive, #pragma pack(n), which of the following is not a valid value of n?

Select an option to see the answer and solution.

What will be the output of the following C code?
#include <stdio.h>
#define a 2
main()
{
    int r;
    #define a 5
    r=a*2;
    printf("%d",r);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
#define max 100
main()
{
    #ifdef max
    printf("hello");
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
#define hello 10
main()
{
    #ifdef hello
    #undef hello
    #define hello 100
    #else
    #define hello 200
    #endif
    printf("%d",hello);
}

Select an option to see the answer and solution.

Which of the following is not a preprocessor directive?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

The function of __attribute__((packed)); can also be performed using . . . . . . . .

Select an option to see the answer and solution.

The preprocessor directive which checks whether a constant expression results in a zero or non-zero value . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
void f()
{
    #define sf 100
    printf("%d",sf);
}
int main()
{
    #define sf 99;
    f();
    printf("%d",sf);
}

Select an option to see the answer and solution.

What will be the output of the following C code?
#define HELLO(a) #a
main()
{
    printf(HELLO(good        morning)); 
}

Select an option to see the answer and solution.

The purpose of the preprocessor directive #error is that . . . . . . . .

Select an option to see the answer and solution.

What will be the output of the following C code?
#include<stdio.h>
#define ram 10
main()
{
    #ifdef ram
    #define ram 20
    #endif
    printf("%d",ram);
}

Select an option to see the answer and solution.