C Language MCQ’S | C Preprocessor

1.
What will be the output of the program?

#include<stdio.h>
#define SQR(x) (x*x)

int main()
{
int a;
a = SQR(2);
printf(“%d\n”, a);
return 0;
}

A. 4
B. 2
C. Error
D. Garbage value

 

2.
What will be the output of the program?

#include<stdio.h>
#define SQR(x) (x*x*x)

int main()
{
int a;
a = SQR(2);
printf(“%d\n”, a);
return 0;
}

A. 4
B. 8
C. Error
D. Garbage value

 

3.
What will be the output of the program?

#include<stdio.h>
#define SQR(x) (x*x)

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

A. 5
B. 25
C. 11
D. Garbage value

 

4.
What will be the output of the program?

#include<stdio.h>
#define SQR(x) (x*x)

int main()
{
int a;
a = SQR(2-3);
printf(“%d\n”, a);
return 0;
}

A. 5
B. -7
C. 1
D. Garbage value

 

5.
What will be the output of the program?

#include<stdio.h>
#define SQR(x) (x*x*x)

int main()
{
int a;
a = SQR(2-3);
printf(“%d\n”, a);
return 0;
}

A. 25
B. -1
C. -13
D. Garbage value

 

Visitor Counter

0142227