Unit 6 - Data Types Flashcards
1
Q
What is the difference between ASCII and Unicode? (3)
A
- ASCII uses 7 bits to represent a character, whereas Unicode uses a varied number of bits.
- ASCII can represent 128 different characters, whereas Unicode allows for over 1 million different characters.
- ASCII only represents the English language, numbers, and some symbols, whereas Unicode can represent different languages, numbers, symbols, and emojis.
2
Q
Explain the two ways to represent a negative number in binary.
A
- Two’s Complement: invert all bits and add one. Can be used for arithmetic.
- Sign & Magnitude: the MSB changes to a sign bit where 0 and 1 mean positive and negative, respectively. Cannot be used for arithmetic.
3
Q
Explain what happens when a 9-bit number is represented using 8 bits.
A
- Overflow error: extra bits are discarded, leaving inaccurate values.
4
Q
Explain the ways to represent a fractional number in binary.
A
- Floating point: a binary number with a decimal point. The numbers on the right of the point are 2^n, the numbers on the left of the point are 2^-n
- Mantissa & Exponent: a binary number (mantissa) is multiplied by 2 to the power of another binary number (exponent).
5
Q
A