Memory & Storage: Lesson 5 Storing Numbers, Slides of Computer science

A lesson on storing numbers in memory and storage. It covers topics such as binary, denary, and hexadecimal conversions, binary addition, and binary shifts. examples and exercises for students to practice. It also explains the advantages of using hexadecimal over binary for programmers and computer scientists. intended for students studying computer science or related fields.

Typology: Slides

2021/2022

Available from 10/26/2022

UKComputerScienceGuides
UKComputerScienceGuides ๐Ÿ‡ฌ๐Ÿ‡ง

26 documents

1 / 25

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Memory & Storage: Lesson 5
Storing Numbers
Starter
1. What is 7 in binary?
2. What is 1001 in denary?
Memory & Storage: Lesson 5
Storing Numbers
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19

Partial preview of the text

Download Memory & Storage: Lesson 5 Storing Numbers and more Slides Computer science in PDF only on Docsity!

Memory & Storage: Lesson 5

Starter

  1. What is 7 in binary?
  2. What is 1001 in denary?

Memory & Storage: Lesson 5

Storing Numbers

Learning Outcomes:

  1. Convert positive denary whole numbers (0-255) into 2 - digit hexadecimal numbers and vice versa
  2. Convert between binary, denary and hexadecimal equivalents of the same number
  3. Add two 8 - bit binary integers and explain overflow errors which may occur
  4. Understand the use of binary shifts

Memory & Storage: Lesson 5

Storing Numbers

Memory & Storage: Lesson 5

Hex to denary conversion

  • You will only need to translate one- or two-digit hexadecimal numbers
  • Multiply the left-hand digit by 16, then add the units
  • What is hex 27 in denary? 16s Units 2 A 2x16 + 10 = 42 in denary

Memory & Storage: Lesson 5

Denary to hex conversion

  1. Divide the denary number by 16 to get the number of 16s (the left-hand hex digit)
  2. The remainder gives you the units Denary 18 becomes: 18 / 16 = 1 remained 2 so the hex value for 18 is 1 2 ( Spoken, โ€˜One Twoโ€™, not โ€˜Twelveโ€™ )
  • What is denary 27 in hex?
  • What is denary 44 in hex?

Memory & Storage: Lesson 5

Binary to hex conversion

  1. Take a binary word of 8 bits 1 1 1 0 0 1 0 1
  2. Divide into two nibbles of 4 bits 1 1 1 0 0 1 0 1
  3. Convert each nibble into its hex value and re-join 1 1 1 0 = 14 = E in Hex + 0 1 0 1 = 5 in Hex So 1 1 1 0 0 1 0 1 = E5 in Hex

Memory & Storage: Lesson 5

Hex to binary conversion

What is 3B in hex? Split the two hex characters 3 = 0011 in binary and B = 1011 So 3B = 0011 1011 in binary

  • What is hex 21 in binary?
  • What is hex A5 in binary?

Memory & Storage: Lesson 5

Why use hex?

  • There are advantages for programmers and Computer Scientists in using hex rather than binary - It is much simpler to remember a hex value than a binary value - It is quicker to write or type since a hex digit only takes up one digit rather than 4 bits - People are less likely to make an error with fewer digits - It is easy to convert between hex and binary

Memory & Storage: Lesson 5

Task 1:

Hexadecimal

Complete Task 1 on the worksheet Navigation: ๐Ÿ € Student G-Suite ๐Ÿ € Computer Studies ๐Ÿ € GCSE Computer Science ๐Ÿ € Unit 1: Computer Systems ๐Ÿ € 1.2: Memory & Storage ๐Ÿ € Lesson 5: Storing Numbers ๐Ÿ € Worksheet 1

Memory & Storage: Lesson 5

Binary addition

Use binary to add two numbers together

Memory & Storage: Lesson 5

Simple denary addition

Work right to left :

  1. Add the Units
  2. If Over 9, Carry Tens
  3. Add Tens 1 4 1 7 3 1

= 1

Memory & Storage: Lesson 5

Adding binary values

0 1 0 1 1 1 1 1 1 0 0

= 1 1 1 1 1 Carry

Memory & Storage: Lesson 5

Adding numbers

  • Computers work with a fixed number of bits at a time
    • This can cause problems
    • What problem will arise when adding the following bytes and storing the result in one byte? 1 1 1 1 0 0 0 0
  • 1 0 0 1 1 1 1 1

Memory & Storage: Lesson 5

Task 2:

Binary Sums

Complete Task 2 (Q1-9) on the worksheet Navigation: ๐Ÿ € Student G-Suite ๐Ÿ € Computer Studies ๐Ÿ € GCSE Computer Science ๐Ÿ € Unit 1: Computer Systems ๐Ÿ € 1.2: Memory & Storage ๐Ÿ € Lesson 5: Storing Numbers ๐Ÿ € Worksheet 1

Memory & Storage: Lesson 5

Logical binary shift operations

  • A binary shift left of one bit moves all the bits one place to the left
    • The vacant bit spaces are filled with zeros
  • Looking at the table above, what effect does a shift left of one place have on the binary value? What effect would a shift right of two places have? 0 0 1 1 1 1 0 0 0 1 1 1 1 0 0 0