1.4.1 Data Types Flashcards
Convert this binary to denary in two’s complement: 01000011
67
Convert this binary to denary in two’s complement: 10111100
-68
Convert this denary to binary in two’s complement: -47
1101 0000
Convert this denary to binary in two’s complement: 86
0101 0110
How many available values are there for each digit in hexadecimal?
16
Convert the unsigned binary number 11110000 to hexadecimal
F0
Common Data Types (5)
Character. Real (float). Integer. Boolean. String.
What is a pointer? (2)
A pointer is a built-in data type in some low-level languages. It will hold the address of a value or object located in computer memory.
Memory requirements of each data type (5)
Character (4 bytes), String (4 bytes for each character), Boolean (1 bit), Integer (4 bytes), Real (4 bytes).
What are the rules of binary addition?
0+0=0. 1+0=1. 0+1=1. 1+1=0 and carry 1. 1+1+1=1 and carry 1.
How do we represent signed binary integers?
The most significant bit becomes a sign digit. 0 represents positive. 1 represents negative.
How do we represent binary integers in two’s complement?
The most significant bit becomes the neative of that number.
How do you add 2 floating point numbers? [3]
- Normalise both numbers 2. Equalise the exponents by increasing the smaller one to match the larger one 3. Add the mantissas
How do you subtract 2 floating point numbers? [5]
- Normalise both numbers 2. Equalise the exponents by increasing the smaller one to match the larger one 3. Find the two’s complement negative value of second number 4. Subtract by adding the two mantissas 5. Normalise the result
What happens during a left shift? [3]
All the bits in the number are shifted to the left by a specified number of places [1] For every 1-bit shift: The most significant bit is discarded [1] A 0 is put into the empty space on the right [1]
What happens during a right shift? [3]
All the bits in the number are shifted to the right by a specified number of places [1] For every 1-bit shift: The least significant bit is discarded [1] A 0 is put into the empty space on the right [1]
Why can’t logical shifts be applied to signed numbers? [1]
The sign bit must not be shifted [1]
What is a 1-bit left shift equivalent to? [1]
Multiplying by 2 [1]
What is a 1-bit right shift equivalent to? [1]
Dividing by 2 [1]
What is the difference between an arithmetic and logical shift? [1]
The most significant bit is not shifted during an arithmetic shift [1]
In what case of an arithmetic shift are the empty places padded with a 1? [1]
Right shift of a negative number [1]
What is a cyclical shift? [1]
A shift where the discarded space is placed into the empty space on the other side of the number [1]
Denary to Binary [1]
Divide number by 2, account for result and remainder. Repeat until 0. [1]
Binary to Hexadecimal [1]
Convert each group of 4 bits into 1 denary digit [1]
Hexadecimal into Binary [1]
Convert each digit into denary and convert into 4 bits [1]