DATA TYPES Flashcards
(15 cards)
Increasing the number of bits used for the mantissa increases the __________ of the number that can be stored
Increasing the number of bits used for the exponent increases the __________ of the number that can be stored
- Precision
- Range / size
Describe the advantages of storing values using two’s complement instead of sign and magnitude
- Calculations are more easily performed on two’s complement
- Two’s complement allows for a (negligible) larger range of numbers to be stored
- Two’s complement only has one representation for 0
Describe what is meant by the term ‘character set’
- List/mapping of characters that can be understood by the computer
- Each character is given a unique binary code that is stored instead of the character
State why a programmer would prefer to use hexadecimal numbers rather than binary numbers
- Hexadecimal values are shorter than binary as 4 bits/nibble can be represented by one hex character
- Hexadecimal values are faster /more reliable to communicate/enter/write down/read
Describe the similarities between ASCII and Unicode
- Both use binary to represent characters (are character sets)
- The first 7 bits of Unicode is the same as ASCII
Describe the differences between ASCII and Unicode
- ASCII has fewer characters (128)
- Unicode has more characters
- ASCII is 7 bits whereas Unicode can be larger (16/32) / can have variable sized characters
- ASCII limited to English characters whereas Unicode can represent other symbols (e.g. Chinese, Emojis)
State why computers store data in binary
- Computers use binary logic for on/off (1/0)
- Computer systems are based on switches/transistors
- Having additional states would make the components more difficult to build and more prone to error
- Binary is high tolerance
Given that computers store everything in binary, explain how they are able to represent text
- Computers use a character set
- To map binary values to characters
- Each character is represented by a unique value
How do you convert positive numbers into negative numbers using two’s complement
- Write out the positive version of the number
- Starting from the least significant bit, copy each of the digits exactly as they appear, up to and including the first 1
- From this point on, swap every 1 for a 0 and every 0 for a 1
What is hexadecimal used to represent
- Colours
- Memory addresses
- MAC addresses
What are the different ways bit patterns can be represented and why can we never assume what they represent
- Numeric
- Text
- Image
- Sound
- There is no way of knowing what a particular pattern of bits represents until you know how to interpret that data
What does masking allow us to do to bit patterns
- Isolate and extract bit values in a sequence of bits
- Toggle and set bit values in a sequence of bits
How does an AND mask work
- In all instances where the mask is set to 0, the original binary sequence is blanked out
- In all instances where the mask is set to 1, the original binary sequence is copied
How does an OR maks work
- In all instances where the mask has been set to 1, the values are set
- In all instances where the mask has been set to 0, the values are kept the same
How does an XOR mask work
- In all instances where the mask has been set to 1, the bit shave been toggled
- In all instances where the mask has been set to 0, the bits have remained the same