End of unit assessment
Topic: Number systems
Convert the following numbers into binary:
a) 120 | Answer: 01111000
b) 150 | Answer: 10010110
C) 30 | Answer: 00011110
a) 180 | Answer: 10110100
b) 210 | Answer: 11010010
C) 24 | Answer: 00011000
a) 4E | Answer: 10110100
b) D0 | Answer: 11010010
C) E0 | Answer: 00011000
Please use the resources below to help you tackle the number system questions. Make sure you watch at least one video from the list below.
1. When doing conversions i.e. from binary to hex, always check your workings. The image labelled A shows that the student hasn't used the right conversion method and, in addition, they are using the letter D to represent 11. For the second nibble, they have the value 6 and this should be 7 as they have missed a 1. The correct answer should be B7.
2. The image labelled B makes better use of this and they have added the values correctly. They could have simplified this by using 8421 but this method works equally well if you know the values of Hex.
3. The image labelled C shows an incorrect way of doing denary to binary conversion. The example shows the student has created the table however the mistake they have made is starting from 2 instead of doing 128 64 32 16 8 4 2 1. This has meant any answer they provide will be incorrect. This method will also yield an incorrect answer for binary to denary conversion as their table can only cater for 7 bits instead of 8.
4. The image labelled D makes better use of the table. The binary values are clearly placed under the headings and they have used 8 bits. A step further could be to show workings to ensure the answer is correct.
Decimal to binary
Binary is a number system consisting of a 0 and a 1. It is base two as we only have two digits. The table below shows 8 bits (one byte) and the values it is representing. The bit, furthest to the right is called the least significant bit and the bit, furthest left is called the most significant big. This is highlighted within the table.
Create a table with eight columns. Start from the right-hand side with the value 1, keep doubling the value, as you move to the left until you get to 128.
Our table is created and we are now going to convert 50 into binary. We will start with the most significant bit. We are going to ask the following questions:
- Does 128 fit into 50? If the answer is no, we put a 0
- Does 64 fit into 50? No, so we put a 0
- Does 32 fit into 50? Yes, so we put a 1 underneath 32 and subtract 32 from 50 = 18
- Does 16 fit into 18? Yes, so we put a 1 underneath 16 and subtract 16 from 18 = 2
- Does 8 fit into 2? No, so we put a 0 underneath 8
- Does 4 fit into 2? No, so we put a 0 underneath 4
- Does 2 fit into 2? Yes, so we put a 1 underneath 2 and subtract 2 from 2 = 0
- Does 1 fit into 0? No, so we put a 0 underneath 1
The denary number 50 converted into binary is 00110010.
Binary to hexadecimal
We know that 1 hexadecimal digit can represent 4 bits i.e. a nibble. To convert an 8 bit binary number, we can break it up into two nibbles and workout the hex value. The steps below will show you how to convert 10101010 into hexadecimal.
Create a table with 8 columns and put 8421 8421 in each column.
Try to place the 8-bit binary number underneath the headings.
We are not going to count the nibble on the left first, i.e. the first 4 bits. Every time we see a 1, we add the column heading. This means we have 8 + 2 = 10. As we are converting this to hex, the number 10 has to be represented as A. The second nibble is 8 + 2 = 10. The second nibble is also A. This means that 1010 1010 binary is equal to AA in hex.
Q4. A student's answer to the question "Why is hexadecimal often used instead of binary?" is shown in below.
"Because it uses fewer digits it will take up less space in a computer's memory."
Explain why the student's answer is incorrect.
Answer: 1 mark: The answer is incorrect because number will be represented using binary in a computer’s memory; 1 mark: so, it will take up the same amount of memory space;
Tip: The key thing you want to remember is that everything is stored in binary format. This means that it doesn't matter how many values there are in hex, the storage it will use will be the same. It is just easier to read and write in hex.
Q5. PAN and LAN are two different types of network. Describe one difference between a PAN and a LAN.
Answer: PANs are centred around one person, LANs cover a limited geographical area / LANs cover a larger area;
PANs have one user, LANs (normally) have more than one user; PAN uses Bluetooth, LAN uses alternative protocols / connection methods (A. by example); Note: answer must cover both PAN and LAN to be awarded a mark.
Q6. Give one example of where a PAN could be used.
- Wearable computing devices;
- Connecting headphones to a music player;
- Connecting pedometer to a mobile phone;
Q7. Most schools have a computer network.
Some schools allows teachers to access the schools network from their home computers.
Give one reason why some schools allow this and one reason why some schools do not allows this.
- Teachers can access resources on the school network to allow them to plan lessons at home;
- Teachers can teach lessons from home (using videoconferencing) if they are not able to get into work (e.g. travel difficulties);
- Teachers can access electronic copies of student work so that they do not have to carry marking home;
Q8. Used to make a payment securely when purchasing goods from a website.
Q8. Used to send an email from a client machine to an email server.
Please use the resources below to help you tackle the questions related to protocols.
Q8. Which statement will produce an error?.
- b) This is because we have two open speech marks and we haven’t concatenated the variable
- c) This will produce an error as it is missing the closing speech mark
Q11. Explain the difference between a while loop and a for loop.
For: The for loop is used when we have an idea of the number of iterations in advance. It is used in counter-controlled loops. The condition checking, iteration statements are written at the top of the loop.
While: The while loop is used when the number of iterations are determined by a condition and this cannot be predicted beforehand. This can be known as an open-ended loop. A while loop can be set to run infinitely. The condition checking, within the while loop, is done at the top of the loop.
Q12. The program below needs to print the word Hi, 3 times. How would you fix the code below? Write your solution in the answer section.
print(“Hi” * 3)
counter = 0
while counter <3:
counter = counter + 1
for i in range(3):
Q13. A dog that is 5 years old is equivalent to a 42-year-old human. You need to write a program that converts the age of a dog to the equivalent age of a human.
Write an algorithm in pseudocode which:
- Asks for the age of the dog in years
- If the age is 2 or less, the human equivalent is 12 times the age
- If the age is more than 2, the human equivalent is 24 for the first 2 years, plus 6 for every additional year
IF dog_age <=2
human_dog_years = dog_age * 12
extra_years = dog_age - 2
human_dog_years = 24 + ( 6 * extra_years)
Q13. An isosceles triangle is one which has at least two equal sides.
Write an algorithm in pseudocode which:
- Asks the user to enter the lengths of a triangle
- works out if the triangle is isosceles
- Outputs a message stating whether the triangle is isoceles or not
INPUT length1, length2, length3
IF length1 = length2 Then
IF length2 == length3 Then
OUTPUT "Not Isosceles"
Please use the resources below to help you tackle the questions related to algorithms. The video goes through flowcharts and the skills needed to structure algorithms using pseudocode.