End of unit assessment (October 2018)

 

Topic: Number systems

 

Question 1

Convert the following numbers into binary:

a) 120 | Answer: 01111000

b) 150 | Answer: 10010110

C) 30 | Answer: 00011110

 

Question 2

a) 180 | Answer: 10110100

b) 210 | Answer: 11010010

C) 24 | Answer: 00011000

 

Question 3

a) 4E | Answer: 10110100

b) D0 | Answer: 11010010

C) E0 | Answer: 00011000

 

Support

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.  

 

   

 

Student responses

 

A: 

hexadecimal

 B:

hex new

 C:  denary to binary errors   D: denary to binary correct

 

Key points:

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.

Step 1:

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.  

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64 32 16 8 4 2 1

Step 2

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: 

2^7 2^6 2^5 2^4 2^3 2^2 2^1 2^0
128 64 32 16 8 4 2 1
 0 1  1  0  0  1 0

  • 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. 

Step 1

Create a table with 8 columns and put 8421 8421 in each column.

8 4 2 1 8 4 2 1
1 0 1 0 1 0 1 0

 

Step 2

Try to place the 8-bit binary number underneath the headings.

 

Step 2

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.

 

Question 4

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.

 

Answer1 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.

 

Question 5

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.

 

Question 6

Q6. Give one example of where a PAN could be used. 

 

Answer: 

  • Wearable computing devices;
  • Connecting headphones to a music player;
  • Connecting pedometer to a mobile phone;

 

Question 7

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.

Answer: 

  • 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;

 

Question 8

Q8. Used to make a payment securely when purchasing goods from a website.

 

Answer: 

  • HTTPS

 

Question 9

Q8. Used to send an email from a client machine to an email server. 

 

Answer: 

  • SMTP.

 

Support

Please use the resources below to help you tackle the questions related to protocols.   

  

 

Question 10

Q8. Which statement will produce an error?. 

 

Answer: 

  • 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

 

Question 11

Q11. Explain the difference between a while loop and a for loop. 

 

Answer: 

  • 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.

 

Question 12

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.

While True:
    print(“Hi”)

 

Answer: 

Method 1

print(“Hi” * 3)

Method 2

counter = 0
while counter <3:
    print(“Hi”)
    counter = counter + 1

Method 3

for i in range(3):
    print(“Hi”)

 

Question 13

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

Answer:

INPUT dog_age

IF dog_age <=2

     human_dog_years = dog_age * 12

ELSE

    extra_years = dog_age - 2

    human_dog_years = 24 + ( 6 * extra_years)

 

Question 14

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  

Answer:

INPUT length1, length2, length3

IF length1 = length2 Then

    OUTPUT "Isosceles"

ELSE

    IF length2 == length3 Then

    OUTPUT "Isosceles"

    ELSE

        OUTPUT "Not Isosceles"

END IF

 

 

Support

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.   

  

 

Login Form

Take me to the top
JSN Gruve 2 is designed by JoomlaShine.com | powered by JSN Sun Framework