Question 1191545: Find the result of each operation assume A = 11110001 and B = 10101010
a. A AND B
b. A NAND B
This is my last question for the day! Can you explain me the steps of this question and after, I'll do others by myself? Thanks again!
Answer by math_tutor2020(3835) (Show Source):
You can put this solution on YOUR website!
Part (a)
We'll be doing a bitwise "AND" operation here.
If the inputs are both 1, then the output is 1. Otherwise the result is 0.
It helps to set up a table or grid like this to line up the digits.
| A | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | | B | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | | A AND B (bitwise) | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
Answer: 10100000
============================================================================
Part (b)
The "NAND" operator means "NOT AND".
What we do is first use the "AND" like normal, but then negate the result.
Here's a reference table
| A | B | A AND B | A NAND B | | 0 | 0 | 0 | 1 | | 0 | 1 | 0 | 1 | | 1 | 0 | 0 | 1 | | 1 | 1 | 1 | 0 |
The last two columns are complements of one another (aka opposites)
Note the first two columns represent the sequence 00, 01, 10, 11 which is counting from 0 base 10 to 3 base 10 in binary.
Therefore we can form this bitwise NAND table for the given inputs
| A | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | | B | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | | A NAND B (bitwise) | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 |
As you can see, the bottom row for NAND is the flipped version of the result of part (a) earlier.
Answer: 01011111
I'm keeping the leading zero because it helps retain the same string length as all the other binary numbers (and it helps show the connection to part a better).
Though of course you could easily remove that first 0.
|
|
|