Question: I'm sorry for this problem being so long, but it includes information needed to understand the problem. Sadly I'm not understanding the order in which
I'm sorry for this problem being so long, but it includes information needed to understand the problem. Sadly I'm not understanding the order in which to perform the calculations still.
Binary Operations
Though the text discusses shift operations, it does not really address binary operations. There are four major binary operations that I believe you should understand: NOT, AND, OR, and XOR (exclusive or).
Operations can be on single bits. When done with multiple bits, only the bits of the corresponding 'places' (2, 4, 8, ...) are compared.
The NOT operation is unary. It takes the value of a bit and flips (or negates) it. This is the one's complement.
NOT 1 is 0, NOT 0 is 1
NOT 01 is 10, NOT 01010111 is 10101000, NOT 11110000 is 00001111.
The AND, OR, and XOR operations are binary.
The AND operation is true (1) only if << both >> values are true (1).
0 AND 0 is 0, 1 AND 0 is 0, 0 AND 1 is 0, 1 AND 1 is 1
0011 AND 0101 is 0001
The OR operation is true (1) if << either >> value is true (1).
0 OR 0 is 0, 1 OR 0 is 1, 0 OR 1 is 1, 1 OR 1 is 1
0011 AND 0101 is 0111
The XOR (exclusive OR) is true if << one but not both >> values are true (1).
0 XOR 0 is 0, 1 XOR 0 is 1, 0 XOR 1 is 1, 1 XOR 1 is 0
0011 XOR 0101 is 0110.
Precedence refers to the order in which operations are executed. Operations in parentheses ('(' and ')') are done first. In C++, the precedence of the four operators (barring the use of parentheses) from first to last is NOT (~), AND (&), XOR (^), and OR (|). Hence NOT 0101 AND 1100 may be correctly rewritten as (NOT 0101) AND 1100. Also NOT A OR B AND C XOR D would be properly rewritten as [(NOT A) OR ({B AND C} XOR D)] since the order of execution is NOT, AND, XOR, and then OR. I believe this is the most common order of precedence. Lastly, operations that are the same (or of equal precedence) are commonly executed from left to right.
10) Considering the information above, what are the following values (in binary). Show all steps.
a) 10101001 OR NOT 10101010
b) 10101010 OR 11100001 AND 10100001
c) NOT (10101000 OR 00111010 XOR 10001001)
d) 01010111 AND 10010011 XOR 10101010
Step by Step Solution
There are 3 Steps involved in it
To solve these problems follow the precedence rules provided perform NOT operations first followed b... View full answer
Get step-by-step solutions from verified subject matter experts
