3.3 Data Rep Flashcards
How is all data stored in a computer (2 marks)
- In a computer, all data is stored in binary form.
- A binary digit has two possible states, 1 and 0.
What base is binary
Base 2
What is data - simply (3)
- Units of information
- In computing there can be different data types, including integers, characters and Boolean. - Data is often acted on by instructions.
Binary digit:
- name
- how big
A binary digit is known as a bit.
A bit is the smallest unit of data a computer can use
What can a bit be
0 or 1
Symbol of a bit
b (lower case b)
How many bits in a byte
A byte if a group of 8 bits
What is the fundamental unit of information
A bit
Symbol of byte
B (upper case B)
All the quantities in the binary unit system :
8 bits 1 byte (B)
1,000 bytes (1,000 B) 1 kilobyte (KB)
1,000 kilobytes (1,000 KB) 1 megabyte (MB)
1,000 megabytes (1,000 MB) 1 gigabyte (GB)
1,000 gigabytes (1,000 GB) 1 terabyte (TB)
1,000 terabytes (1,000 TB) 1 petabyte (PB)
What’s a nibble?
Four bits or half a byte is known as a nibble.
When calculating storage space for disk drives, it is common to use multiples of __.
These are shown in the table above as ?
When calculating storage space for disk drives, it is common to use multiples of 1,000. These are shown in the table above as kilobytes, megabytes etc.
Decimal system is base what?
10
The digits in the decimal system:
0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
How computers use decimal numbers
Decimal numbers must be converted into their binary equivalent before a computer can use them.
Denary
Decimal
The first eight binary place values are:
128 64 32 16 8 4 2 1
binary number 1111100
In decimal?
128 64 32 16 8 4 2 1
0 1 1 1 1 1 0 0
Result - (0 × 128) + (1 × 64) + (1 × 32) + (1 × 16) + (1 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 124
What would these binary numbers be in decimal?
1001
10101
11001100
9
21
204
In words - to convert binary to decimal…
To convert binary to decimal, simply take each place value that has a 1, and add them together.
In words, to convert decimal to binary…
To convert from decimal to binary, start by subtracting the biggest place value possible from the decimal number, then place a 1 in that place value column. Next, subtract the second biggest place value possible, and place a 1 in the column. Repeat this process until zero is reached. Finally, place a 0 in any empty place value columns.
84 in decimal in binary?
Result - 84 in decimal is 01010100 in binary.
To check that binary conversion is right?
To check that this is right, convert the binary back to decimal:
(0 × 128) + (1 × 64) + (0 × 32) + (1 × 16) + (0 × 8) + (1 × 4) + (0 × 2) + (0 × 1) = 84
Alternative way to convert a decimal number to binary
Another way to convert a decimal number to binary is to divide the starting number by two. If it divides evenly, the binary digit is 0. If it does not and there is a remainder, the binary digit is 1. Finally, reverse the digits and you have the correct number.
What would these decimal numbers be in binary?
12
42
188
1100
101010
10111100
When two numbers are added together in decimal, we take the first number, add the second number to it, and get an answer. For example, 1 + 2 = 3.
When we add two binary numbers together the process is different.
There are four rules that need to be followed when adding two binary numbers. These are:
0 + 0 = 0
1 + 0 = 1
1 + 1 = 10 (binary for decimal 2)
1 + 1 + 1 = 11 (binary for decimal 3)
adding 01010011 + 01110110
1 + 0 = 1
1 + 1 = 0, carry 1
1 + 0 + 1 = 0, carry 1
1 + 0 + 0 = 1
1 + 1 = 0, carry 1
1 + 0 + 1 = 0, carry 1
1 + 1 + 1 = 1, carry 1
1 + 0 + 0 = 1
Result in binary - 11001001 (which is decimal 201). You can check your answers by converting each binary number into decimal and checking your addition. In this example, 01010011 is 83 in decimal and 01110110 is 118 in decimal. So, 83 + 118 is 201.
Overflow:
When does unit occur?
Overflow occurs when the result of a calculation requires more bits - place values - than are in the available range.
Example of an overflow error?
For example, when using eight bits, the largest number that can be recorded is 11111111 (decimal 255). When adding together two eight-bit numbers, a situation may occur when the result requires more than eight bits to hold it. For example, adding the binary numbers 11111110 (decimal 254) and 00000010 (decimal 2) would give:
Binary addition: 1 1 1 1 1 1 1 0 plus 0 0 0 0 0 0 1 0 equals 0 0 0 0 0 0 0 0
The result is actually 10000000 (decimal 256), which requires nine bits. However, as only eight bits are available to hold the number, the result would be 00000000 (decimal 0).
Consequences of overflow? - key word
The answer refers to last card
As you can see, overflow can have serious consequences for the validity of calculations.
How are binary numbers multiplied and divided - name
Binary shifts
Binary numbers are multiplied and divided through a process called shifting.
Multiplication
To multiply a number, a binary shift moves all the digits in the binary number along to the __ and (does what with the gaps?)
- to multiply by two, ?
- to multiply by four, ?
- to multiply by eight, ?
Multiplication
To multiply a number, a binary shift moves all the digits in the binary number along to the left and fills the gaps after the shift with 0:
- to multiply by two, all digits shift one place to the left
- to multiply by four, all digits shift two places to the left
- to multiply by eight, all digits shift three places to the left
and so on
1100 (decimal 12) × 2
Result - shifting one place to the left gives 11000 (decimal 24)
Example - 10110 (decimal 22) × 4
Result - shifting two places to the left gives 1011000 (decimal 88)
Quick note for binary addition on the spec - regarding what maximum number of bits for exam
‘answers will be a maximum of 8 bits in length and will not involve carrying beyond the 8th bit’
Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by __.
Shifting left by n bits on a signed or unsigned binary number has the effect of multiplying it by 2^n.
To divide, the digits are moved one place to the __, and the rightmost digit (?).
To divide, the digits are moved one place to the right, and the rightmost digit is discarded.
Effect of losing digits in right binary shift - key word
losing precision. It can happen with too much shifting.
Too much division means losing precision
The number is divided by 4
Loss of accuracy …
… the bits on the right are removed
What is the name of the binary shift we do in gcse
Logical binary shift
Hexadecimal
- what base
- how many units
- what are the units
Base 16
Hexadecimal, also known as hex, is the third commonly used number system.
It has 16 units - 0-9 and the letters A, B, C, D, E and F.
Decimal vs binary vs hex
0 0000 0 1 0001 1 2 0010 2 3 0011 3 4 0100 4 5 0101 5 6 0110 6 7 0111 7 8 1000 8 9 1001 9 10 1010 A 11 1011 B 12 1100 C 13 1101 D 14 1110 E 15 1111 F
Why is hex useful (2), with examples
Hex is useful because large numbers can be represented using fewer digits. For example, colour values and MAC addresses are often represented in hex.
Additionally, hex is easier for humans to understand than binary. Programmers often use hex to represent binary values as they are simpler to write and check than when using binary.
Does hex save memory? Why?
Hex does not save memory as it must be converted to binary for the computer to understand it.
What powers are hex place values - with examples of the first 5
Whereas decimal place values are powers of 10, and binary place values are powers of 2, hex place values are powers of 16.
65,536 4,096 256 16 1
HEX:
Each place value can be represented by the units ?
Each place value can be represented by the units 0 through to F.
Hex to decimal ?
hex number 7C
65,536 4,096 256 16 1
——————————. 7 C
(7 × 16) + (C × 1) = (7 × 16) + (12 × 1) = (112) + (12) = 124
What would these hex numbers be in decimal?
11
2B
FA
17
43
250
In words - to convert from decimal to hex (2)
- If the decimal number is bigger than 16, divide it by 16. Take the hexadecimal equivalent of this result - this represents the first digit. Take the hexadecimal equivalent of the remainder - this represents the second digit.
- If the decimal number is smaller than 16, take the hexadecimal equivalent of the decimal number.
Example - convert decimal 22 to hexadecimal
16 goes into 22 once with 6 left over, so 22 ÷ 16 = 1 remainder 6
1 = hex 1
6 = hex 6
Result - 16