C Language MCQ’S | C Preprocessor 5

21.
What will be the output of the program?

#include<stdio.h>
#define FUN(i, j) i##j

int main()
{
int First = 10;
int Second = 20;

char FirstSecond[] = “Catalyst”;

printf(“%s\n”, FUN(First, Second) );

return 0;
}

A. 10
B. 20
C. 1020
D. Catalyst

 

22.
What will be the output of the program?

#include<stdio.h>
#define FUN(arg) do\
{\
if(arg)\
printf(“Catalyst…”, “\n”);\
}while(–i)

int main()
{
int i=2;
FUN(i<3);
return 0;
}
A. Catalyst…
Catalyst…
Catalyst
B. Catalyst… Catalyst…
C. Error: cannot use control instructions in macro
D. No output

 

23.
What will be the output of the program?

#include<stdio.h>
#define MAX(a, b) (a > b ? a : b)

int main()
{
int x;
x = MAX(3+2, 2+7);
printf(“%d\n”, x);
return 0;
}

A. 8
B. 9
C. 6
D. 5

 

24.
What will be the output of the program?

#include<stdio.h>
#define MIN(x, y) (x<y)? x : y;
int main()
{
int x=3, y=4, z;
z = MIN(x+y/2, y-1);
if(z > 0)
printf(“%d\n”, z);
return 0;
}

A. 3
B. 4
C. 0
D. No output

 

25.
What will be the output of the program?

#include<stdio.h>
#define str(x) #x
#define Xstr(x) str(x)
#define oper multiply

int main()
{
char *opername = Xstr(oper);
printf(“%s\n”, opername);
return 0;
}
A. Error: in macro substitution
B. Error: invalid reference ‘x’ in macro
C. print ‘multiply’
D. No output