Bits and Bytes Flashcards
What is a byte?
It is a group of 8 bits that can be individually addressable.
What is a bit?
Holds 0 or 1
What is a word?
● It is a group of 4 bytes (32 bit architecture) or
● It is a group of 8 bytes (64 bit architectures)
● The address of a word is aligned to either 4 or 8 bytes respectively (multiple of 4 or 8 bytes).
What is memory mapped I/O?
When device registers are mapped to
memory.
A bit can represent the state of the device.
What are 3 examples of Character Encodings broken question
Who created Extended Binary Coded Decimal Interchange Format?
● It was created by IBM in the 1960s
● No longer in use except in some IBM
mainframes
What does ASCII stand for?
American Standard Code for Information
Exchange
How many bits/values does ASCII use?
It uses 7 bits or 128 values
What does ascii encode?
The English alphabet
How many bits does Unicode use?
16 bits (2 bytes)
What does unicode encode?
Languages from all around the world
What languages use unicode internally for strings?
Java and C#
How does Pascal represent strings?
The first byte is the length of the string
How do you perform math in binary? (Addition, Subtraction, Multiplication, Division)
Same as decimal, just with binary digits
What ways are Negative Binary numbers represented?
● Sign and Magnitude
● 1-complement
● 2-complement
How does Sign and Magnitude
Representation work?
What is the value of 10000101?
1 bit for sign, 1 means negative, rest of the bits for absolute value.
Value of 10000101 is -5. first one means negative
How does 1-Complement work?
What is the value of 11111110
Negative numbers are obtained by inverting all bits.
11111110 is -1. invert all 00000001, neg of that
How does 2-Complement work?
What is the value of 5 in binary for 2-Com?
Negative numbers are obtained by
subtracting 1 from the positive number and inverting the result.
11111011
Why is 2-Complements widely used?
because the same piece of hardware used
for positive numbers can be used for negative numbers:
How does right shift»_space; change for signed vs unsigned ints?
if signed and the int is negative, 1s will be added, this is called “signed extension”
What do bitwise operations |, &, ^, ~ all do?
bitwise or, and, xor, not on each bit
How to check if bit x is set?
shift bit 1 x units to the left. Use & on shifted bit and comparing int.
Then take result and shift x right, if equal to 1 return true, found set bit
How to set bit?
Use | with desired bit
How does floating point representation work?
Store both the exponent and mantissa
ex” 1.101x2^-010