Huawei
Company
Programming
Program
main()
{
int x=011|0x10;
printf("%d",x);
}
a). 13 b).19 c).25 d).20
Read Solution (Total 8)
-
- 011 octal number convert into decimal -9
0x10 hexa decimal number convert into decimal -16
perform bit wise or opr b/w 9 and 16 then answer 25
ans 25 - 10 years agoHelpfull: Yes(9) No(0)
- Ans will be c).25
bcoz......
011 is octal convert it into decimal--->1*8^1+1*8^0==9
0x10 is hexadecimal convert it into decimal--->1*16^1+0*16^0==16
now 9's binary format----->0000 1001
and 16's binary format---->0001 0000
011|0x10 means 9|16---->0001 1001 (combine both bcoz its OR operator) so now it will be------>25
011&0x10 means 9&16---->0000 0000 (nothing common from both) so it will give----->0
011^0x10 means 9^16----->0001 1001 (in this we neglect common digits so nothing common in this) so it will give----->25 - 9 years agoHelpfull: Yes(5) No(0)
- convert octel no.into decimal 011=9 and hexadecimal no.0x10=16 then bitwise or result come 25
- 10 years agoHelpfull: Yes(4) No(0)
- ox10 is hex so binary 00010000
0011|0001000 = 10011=19 - 10 years agoHelpfull: Yes(3) No(6)
- ans is 25 only
- 9 years agoHelpfull: Yes(1) No(1)
- it is c)25
- 9 years agoHelpfull: Yes(1) No(1)
- answr
25 - 9 years agoHelpfull: Yes(0) No(0)
x=011 | 10000
x=(10011) in binary
b. 19 in decimal- 8 years agoHelpfull: Yes(0) No(1)
Huawei Other Question