Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.


Please wait...

C Programming :: C Preprocessor

Home > C Programming > C Preprocessor > General Questions

21. Consider the macro definitions

#define square (x) x*x
and #define square (x) (x*x)

when used in a program statement B=++square(C)

Answer: Option D

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

22. The output of the following program is

#define two (x) 2*x
#define ddouble (x) x + x

void main()
{
int num, sum, product;
num = 1;
sum = - two (num); sum = -(sum + 1);
product = - ddouble (num);

printf ("%d%d/n" ,sum,product);
}

Answer: Option A

Explanation:

Here is no explanation for this answer

Workspace


Tags:  No Tags on this question yet!

Answer: Option A

Explanation:

Pre-processor directive cannot end with a semicolon so the option D is correct here. Because pre-processor directives are lines included in a program that begins with the character #.

Workspace


Tags:  No Tags on this question yet!

24. What are the value sprinted by the following program?

#define dprint(expr)printf(#expr "=%d\n",expr)
main() {
int x=7;
int y=3;
dprintf(x/y);
}

Answer: Option C

Explanation:

It will simply give value after division of x/y which is 2. Because, in #define dprint(expr) expr is (x/y=?). So, the final answer will be x/y=2.

Workspace


Tags:  Wipro

25. #include
#define maxval 5
int main (void)
{
int i=1;
if(i-maxval)
{
printf("inside");
}
else
{
printf("out?");
}
}
What will be printed.

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Cisco

26. #include
#define a 3+3
#define b 11-3
void main()
{
printf("%d",a*b);
}
What will be printed.

Answer: Option A

Explanation:

Here, in #define a 3+3 & #define b 11+3 it will take only first values from both i.e. 3 & 11. So, a*b value will be 3*11=33.

Workspace


Tags:  Cisco

27. Macros and function are related in what aspect?

Answer: Option B

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Cisco

28. Preproconia does not do which one of the following

Answer: Option C

Explanation:

Here is no explanation for this answer

Workspace


Tags:  Cisco

29. Find the output for the following C program

#define d 10+10
main()
{
printf("%d",d*d);
}

Answer: Option A

Explanation:

d*d will be replaced by 10+10*10+10 during run-time. So, answer is 10+100+10 = 120

Workspace


Tags:  Cisco

30. #include
#define max(a,b) (a>b?b:a)
#define squre(x) x*x
int main()
{
int i = 2, j = 3, k = 1;
printf ("%d %d", max(i,j), squre(k));
return 0;
}

Answer: Option A

Explanation:

Here, in max(i,j)=max(2,3) or #define max(2,3) we check 2>3? It is not correct so 'a' will be value which is 2 & In square(x)=x*x we will get k*K=1*1=1. So, the final value will be 2 1.

Workspace


Tags:  No Tags on this question yet!



Most Popular Qs.

Latest MCQ Qs.