skip to main |
skip to sidebar
###
practice for bitwise operators

p = 1001 1010

q = 0110 0110

r = 1011 0001

^ means and

v means or

~ means not

Order of operations: parentheses first, otherwise left to right

Find the following values.

a) p v q

b) p ^ r

c) p v ~q

d) ~p v q

e) r ^ ~q

f) ~(r ^ q)

Answers in the comments.

## 2 comments:

Prof. Hubbard, in question b should the answer been 1001 0000 not 1000 0000. I thought that since both bin numbers 1001 and 1011 both end and begin with 1 that the 1 should stay in an and equation. Also, question e confused me with the answer as well. Should the bin number for q be reversed to 1001 1001 which would make the answer 1001 0001?

Thanks to the anonymous poster above. Here are the corrected answers.

p = 1001 1010

q = 0110 0110

r = 1011 0001

^ means and

v means or

~ means not

Order of operations: parentheses first, not (~) done to the bitstring that immediately follows it, otherwise left to right

Find the following values.

a) p v q

_1001 1010

v0110 0110

__________

=1111 1110b) p ^ r

_1001 1010

^1011 0001

__________

=1001 0000c) p v ~q

_1001 1010

v1001 1001

__________

=1001 1011d) ~p v q

_0110 0101

v0110 0110

__________

=0110 0111e) r ^ ~q

_1011 0001

^1001 0110

__________

=1001 0000f) ~(r ^ q)

_0110 0110

^1011 0001

__________

=0010 0000

~(0010 0000)

=1101 1111Post a Comment