edited by
526 views
0 votes
0 votes

The value of $\color{green}{ab}$, if $\color{red}{ab}$ & $\color{red}{0x3f}$ equals $\color{red}{0x27}$ is __________?

  1. $\color{blue}{\text{047}}$
  2. $\color{blue}{\text{0x0f}}$
  3. $\color{blue}{\text{0xf3}}$
  4. $\color{blue}{\text{0x27}}$
edited by

2 Answers

3 votes
3 votes

Hexadecimal format is given

0 x 27 = ( 0010 0111 )2

0 x 3f = ( 0011 1111 )2

ab & 3f = 27

ab & ( 0011 1111 ) = ( 0010 0111 )

a & ( 0011 ) = ( 0010 )

b & ( 1111 ) = ( 0111 )

if a = ( 0010 ),  then  a & ( 0011 ) will give (0010 )

if b = ( 0111 ), then b & ( 1111 ) will give ( 0111 )

so the value of a and b are ( 0010) and (0111)

ab = (0010 0111) = (0 x 27 ) 16  

0 votes
0 votes

binary value of 0x3f = 111111

binary value of 0x27 = 100111

(ab & ox3f ) = 0x27 

ab & 111111 = 100111

so ab = 100111

since bitwise and is applied with ab and 111111 whatever result you are given that is ab because one operand contains all 1's.

hex value of 100111 is 0x27.

so answer is D

Related questions

5 votes
5 votes
1 answer
1