CrazyEngineers Archive
Old, but evergreen and popular discussions on CrazyEngineers, presented to you in read-only mode.
@Neha Kochhar • 17 Jan, 2010
What is the value of the expression (3^6) + (a^a)?

a) 3 b) 5 c) 6 d) a+18 e) None

I am Unable to solve this Out?
Ans is 5 but how?
Explain the Process
@Kaustubh Katdare • 17 Jan, 2010 Is this a C programming question?
@Manish Goyal • 17 Jan, 2010
Neha Kochhar
What is the value of the expression (3^6) + (a^a)?

a) 3 b) 5 c) 6 d) a+18 e) None

I am Unable to solve this Out?
Ans is 5 but how?
Explain the Process
I think you want to solve this expression using c right?
ok
If you don't input the value of a then it will take garbage value..now in order to obtain output 5 in the expression it should be like this
(3^6)+(a^-a)
ie a's power is a negative value
@Neha Kochhar • 21 Jan, 2010
goyal420
I think you want to solve this expression using c right?
ok
If you don't input the value of a then it will take garbage value..now in order to obtain output 5 in the expression it should be like this
(3^6)+(a^-a)
ie a's power is a negative value
but how the value 5 is obtained?
Please explain it .I did not get what you said
@Hussanal Faroke • 25 Jan, 2010 is the 'a' defined, if no try it in another system? or u defined pls tell the value of a! u know in c 32767+1 is -32765
@rishita • 11 Jun, 2011 Nice Goyal. But, we want detail solution. How we get the answer. Can you give detail step by step process of solution.

Regards,
@vik001ind • 11 Jun, 2011 It doesn't matter whether a is defined or not.
^ stands for XOR. Xoring same bit return 0, different values return 1. Eg, 1^0 == 1 , 1^1 == 0
Any int variable in C is 16 bit (16 bit compiler) or 32 bit (32 bit compiler). So, in any case whether it is defined or not, a will be a 16/32 bit pattern.
Considering 16 bit compiler
Bit pattern of 3 is 0000 0000 0000 0000 0011
XOR
Bit pattern of 6 is 0000 0000 0000 0000 0110
Result is --> 0000 0000 0000 0000 0101 ---> 5

a^a will always be equal to 0. Since we have bit pattern same in both cases.
Therefore (3^6) + (a^a) = 5.
6.5k views

Related Posts

@ABCD ABCD · Sep 13, 2012

Why HMV/Trucks only use diesel? Why not Petrol? Also, why is it more cheaper than Petrol, even though it gives more mileage? How is CNG different from Petrol and Diesel?
5.8k views

@Satya Swaroop Dash · Apr 9, 2014

Ever since Microsoft acquired Nokia, people started speculating that Nokia would stop creating feature phones and concentrate on its smartphone line up but Nokia has since then put an end...
7.2k views

@Ankita Katdare · Jan 24, 2015

To think that it about time that Digital TV becomes available from the comfort of your smartphone or tablet, is an appropriate thing. At CES 2015, Sony launched a Digital...
6.2k views

@ashie · Jun 13, 2012

is it valid or it gave compilation errorpublic class test{int j;public void show();public void see()public static void main(string args[]){test test=new test();test.show();}public static void main(string args[]){test.see()}}
5.4k views

@Satya Swaroop Dash · Sep 4, 2014

A few minutes after HTC’s announcement, Microsoft Mobile took the centre stage at the Internationale Funkausstellung Berlin (IFA) to announce its mid range offering that promises high end features. The...
6.2k views