C Question

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

Replies

  • Kaustubh Katdare
    Kaustubh Katdare
    Is this a C programming question?
  • Manish Goyal
    Manish Goyal
    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
    Neha Kochhar
    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
    Hussanal Faroke
    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
    rishita
    Nice Goyal. But, we want detail solution. How we get the answer. Can you give detail step by step process of solution.
    Thanks for your solution.

    Regards,
  • vik001ind
    vik001ind
    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.

You are reading an archived discussion.

Related Posts

hello everybody, I want to know if there is a way to plot multiple polar graphs on the same figure using matlab, the function "polar" does not support this ability,...
HI guys, In my friend's Laptop, While Booting time, a message is displaying that "Booting Manager is Not available" and it is staying like that without processing..! What happened to...
[FONT="]"K! Conclave - The Confluence of Minds "[/FONT] [FONT="]What role does technology play in helping shape a better tomorrow? How is the press and media responsible for instigating a reform?...
Hey guys i am in 4th sem. and looking for doing internship in coming summers holidays.Can anybody tell me which company would be better for me and what is the...
Just for now Im building a Rover 200 Hybrid race car (of sorts) one engine is a 2.1 petrol around 240bhp. And a 10-15kw 240v 3 phase ac motor on...