given
unsigned int ui1=3,ui2=7;
what are the outputs of
a)ui1 & ui2
b)ui1 && ui2
c)ui1 | ui2
d)ui1 || ui2

i also need the justification for the answers
thank you

Answers were Sorted based on User's Feedback



given unsigned int ui1=3,ui2=7; what are the outputs of a)ui1 & ui2 b)ui1 && ui2 ..

Answer / swapna

a) 3
&:bitwise and operator

3-011
7-111
3&7-011->3
b)any positive value
&&-logical and
both numbers are are positive.so and operation results in
true-so any positive value
c)7
bitwise or
d)any positive value
logical or

Is This Answer Correct ?    3 Yes 0 No

given unsigned int ui1=3,ui2=7; what are the outputs of a)ui1 & ui2 b)ui1 && ui2 ..

Answer / subeetha

a) 3
&:bitwise and operator

3-011
7-111
3&7-011->3
b)1
&&:logical and
both numbers are non zero.So, operation Result is true
c)7
bitwise or
d)1
&&:logical Or
both numbers are non zero.So, operation Result is true

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C++ General Interview Questions

What is a catch statement?

0 Answers  


Is c++ a pure oop language?

0 Answers  


class basex { int x; public: void setx(int y) {x=y;} }; class derived : basex {}; What is the access level for the member function "setx" in the class "derived" above? a) private b) local c) global d) public e) protected

3 Answers   Quark,


How would you use the functions randomize() and random()?

0 Answers  


What happens if an exception is throws from an object's constructor and from object's destructor?

3 Answers   TCS,


What is guard code in c++?

0 Answers  


What is the standard template library (stl)?

3 Answers  


What does the ios::ate argument do?

0 Answers  


Name some pure object oriented languages?

1 Answers  


wap to accept 10 numbers & display the number of odd and even numbers??

1 Answers  


What is a type library?

0 Answers  


What are arithmetic operators?

0 Answers  


Categories