Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

Answers were Sorted based on User's Feedback



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

Answer / raj

ans.

d*d will be replaced by 10+10*10+10

during runtime.

so answer is 10+100+10 = 120

Is This Answer Correct ?    89 Yes 0 No

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

Answer / hussain reddy

120

Is This Answer Correct ?    8 Yes 2 No

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

Answer / vrushali

This boils down to (10 +10 * 10 + 10)

so answer is 120 ... but if the same macro was rewritten as
#define d (10 + 10)

then d * d = (10 + 10 ) * (10 + 10)
= 20 * 20
= 400....

Pure macro concept....

Is This Answer Correct ?    15 Yes 13 No

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

Answer / jyothikrishna

Ex:1
#define A 10+10
void main()
{
int a;
a = A*A;
cout<<a<<endl;
}

Ans : 120

Explanation:
When you compile this program. A*A will be converted into 10+10*10+10. Here it follows BODMAS rule first it will perform multiplication and next it will perform addition.

First 10+10*10+10 = 10 + 100 + 10
next 10 + 100 + 10 = 120 (Answer)

Ex:2
#define A (10+10)
void main()
{
int a;
a = A*A;
cout<<a<<endl;
}

Ans : 400

Explanation:
When you compile this program. A*A will be converted into (10+10)*(10+10). Here it follows BODMAS rule first it will perform Bracket values and next it will perform multiplication.

First (10+10)*(10+10) = 20 * 20
next 20 * 20 = 400 (Answer)

Is This Answer Correct ?    2 Yes 1 No

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

Answer / mangal bhaldare

the value of d is 10+10
so the result is
(10+10)*(10+10)
=120

Is This Answer Correct ?    4 Yes 4 No

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

Answer / kumaran

400

Is This Answer Correct ?    3 Yes 46 No

Post New Answer

More C Interview Questions

how to swap two integers 1 and 32767 without using third variable

11 Answers   Microsoft, TCS,


what is difference between ++(*p) and (*p)++

17 Answers   Accenture, HCL, IBM,


which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above

0 Answers  


how to copy a string without using c function

5 Answers  


How can I ensure that integer arithmetic doesnt overflow?

0 Answers  


what is the difference between postfix and prefix unary increment operators?

3 Answers  


Where register variables are stored in c?

0 Answers  


main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }

3 Answers   ME,


difference between malloc and calloc

3 Answers   HCL, Wipro,


Write a program that takes a 5 digit number and calculates 2 power that number and prints it

5 Answers   ABS, Accenture, HCL, Infosys, Infotech, SoftSolve, Software India, TCS, Vertex, Vimukti Technologies,


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

0 Answers  


Given an array A[n+m] of n+m numbers, where A[1] ... A[n] is sorted and A[n+1] ... A[n+m] is sorted. Design a linear time algorithm to obtain A[1...n+m] sorted using only O(1) extra space. Time Complexity of your algorithm should be O(n) and Space Complexity O(1).

0 Answers  


Categories