programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
• Campbell Ritchie
• Jeanne Boyarsky
• Ron McLeod
• Paul Clapham
• Liutauras Vilda
Sheriffs:
• paul wheaton
• Rob Spoor
• Devaka Cooray
Saloon Keepers:
• Stephan van Hulst
• Tim Holloway
• Carey Brown
• Frits Walraven
• Tim Moores
Bartenders:
• Mikalai Zaikin

# What is the value of 8|9&10^11? (scjp07-Q100)

Ranch Hand
Posts: 77
• Number of slices to send:
Optional 'thank-you' note:
Q100 What is the value of 8|9&10^11?
A 8
B 9
C 10
D 11
the given ans is .
my procedure of the question is:
int n0=8|9=9.
int n2=8|9&10=9&10=8.
int n3=8|9&10^11=n2^11=3.
Above code of procedure is wrong ,pls correct me!!

Ranch Hand
Posts: 464
• Number of slices to send:
Optional 'thank-you' note:

Originally posted by Gong James:
Q100 What is the value of 8|9&10^11?
A 8
B 9
C 10
D 11
the given ans is .
my procedure of the question is:
int n0=8|9=9.
int n2=8|9&10=9&10=8.
int n3=8|9&10^11=n2^11=3.
Above code of procedure is wrong ,pls correct me!!

Ans: D
Order of Eval: AND XOR OR
Enjoy
Ragu

Greenhorn
Posts: 4
• Number of slices to send:
Optional 'thank-you' note:
According to Mughal's book, order of operation should be "&" first, then "^", and finally "|".
MH

Ranch Hand
Posts: 38
• Number of slices to send:
Optional 'thank-you' note:
Hi,
(8|9)&10^11 = 3;
(8|9)&(10^11) = 1;
(8|9&10)^11 = 3;
8|(9&10^11) = 11;
8|(9&(10^11)) = 9;
Answer is 11. And important point here is operators precedance.

Q100 What is the value of 8|9&10^11?
A 8
B 9
C 10
D 11

------------------
Alex J.Grig
[This message has been edited by Alex Grig (edited October 29, 2001).]

Ranch Hand
Posts: 18944
• Number of slices to send:
Optional 'thank-you' note:
(8|((9&10)^11))
In this operation, the operator & has the highest precedence followed by ^ and then by |
Therefore,

Hope this helps
Shyam
[This message has been edited by Shyamsundar Gururaj (edited October 29, 2001).]

Gong James
Ranch Hand
Posts: 77
• Number of slices to send:
Optional 'thank-you' note:
I caught what you mean.
Thanks every person a lot for your kind!!!

 Don't get me started about those stupid light bulbs.