0% found this document useful (0 votes)
13 views53 pages

Revision - Part 2

The document provides an overview of data representation in computing, focusing on binary and decimal systems, and how binary numbers are used to represent text, images, and sound. It explains the concepts of binary addition, ASCII encoding, and file compression types (lossy and lossless). Additionally, it covers programming fundamentals, including variables, constants, and programming techniques.

Uploaded by

oliver.norman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views53 pages

Revision - Part 2

The document provides an overview of data representation in computing, focusing on binary and decimal systems, and how binary numbers are used to represent text, images, and sound. It explains the concepts of binary addition, ASCII encoding, and file compression types (lossy and lossless). Additionally, it covers programming fundamentals, including variables, constants, and programming techniques.

Uploaded by

oliver.norman
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 53

Data Representation

Binary Numbers
The language of computers

Before we start you need to know an important fact. Anything to the


power 0 is worth 1. You will need to remember this for later!

10110100010110101010011010010110101000101101101111001
The Binary System
In binary there are only two digits. Which two would you
choose?

0 and 1
In binary code we only have the digits 0 and 1. Can you see why
these might be the most important digits to use?
To create larger values you need to combine 0s and 1s. How can
we write 2? To help us, lets look at how we generate large
numbers in decimal.
The Decimal System
Dec means 10, such as in decade, decathlon or decagon

• We have 10 different digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9

• We use a place value system, where the number is effects its value ie) 421
The digit 2 represents both 20 and 2000. 2365

In the decimal systems the columns are important. They represent:

Did you spot Thousands Hundreds Tens Units Names of column

the power 0?
remember for 1000-9000 100-900 10-90 0-9 Range of values

later
10³ 10² 10¹ 10° Powers of 10
The Binary System
To count up in binary we can start with, 0, 1 and then what?

Using Columns 22 21 2°
Remember: 2° = 1 so 0 is 0
the first column
acknowledges whether
1 is 1

there are any 1s. 1 0 is 2 This is (1 x 21) + (0 x 2°)

1 1 is 3 This is (1 x 21) + (1 x 2°)

1 0 0 is 4 This is (1 x 22) + (0 x 21) +(0 x 2°)

1 0 1 is 5 This is (1 x 22) + (0 x 21) +(1 x 2°)


It’s all about the
1 1 0 is 6 This is (1 x 22) + (1 x 21) +(0 x 2°)
powers of 2!
and so on.....
Binary  Decimal
Look at this number in binary:

1 0 0 1 1 1

1 x 25 0 x 24 0 x 23 1 x 22 1 x 21 1 x 20

32 + 0 + 0 + 4 + 2 + 1 =

39
Binary  Decimal
Calculate the value of this binary number:

1 1 0 0 1 0

1 x 25 1 x 24 0 x 23 0 x 22 1 x 21 0 x 20

32 + 16 + 0 + 0 + 2 + 0 =

50
Binary  Decimal
Calculate the value of this binary number:

1 0 1 1 0 0 1

1 x 26 0 x 25 1 x 24 1 x 23 0 x 22 0 x 21 1 x 20

64 + 0 + 16 + 8 + 0 + 0 + 1 =

89
Binary  Decimal
Calculate the value of this binary number:

1 1 1 0 1 1

1 x 25 1 x 24 0 x 23 0 x 22 1 x 21 1 x 20

32 + 16 + 8 + 0 + 2 + 1 =

59
TASK 6 Watch this video if you still
don’t understand Binary
Conversion.
Ta
sk
Binary  Decimal
TASK 7
2

Convert the following binary codes into decimal numbers:

1011010 1101100
= 90 = 108
1010101 111000
= 85 = 56

1101011 1000001
= 107 = 65
Decimal  Binary
TASK 8

Let’s try it the other way round. How would you


write the following in binary code?

36 100100

63 111111

72 1001000

21 10101
BINARY ADDITION

R U L E S

10 1011 0101 0+0=0


+0 1 +0110 +1 0+1=1
11 1000 101 00 10 11 1+0=1
1 01 1 + 1 = 0  carry 1
BINARY ADDITION EXAMPLE: 0110 + 1101
INSTRUCTIONS
S T E P 1 : Write the given binary number one over the another 
STEP - 1 Write the two binary numbers. Write one number in the top to the another 0110
number. The alignment should be properly made.
1101

STEP - 2 Start from the right side. Then add the two numbers.
S T E P 2 : Start from right side.

STEP - 3 If [RULE 1+ 1 = 0] carry 1  then it must be added to the next digit numbers.
S T E P 3 : By using the rules add the two numbers 
0110
STEP - 4 Use binary addition rules 1101
1 ( Rule : 0 + 1 = 1 )

S T E P 4 : Add the next two numbers   


0110
R U L E S 1101
1 1 ( Rule: 1 + 0 = 1 )
0 + 0 = 0
0 + 1 = 1
S T E P 5 : Add the next two numbers   
1 + 0 = 1 0110
1 + 1 = 0  carry 1 1101
0 1 1 ( Rule: 1 + 1 = 0 + carry 1 )

S T E P 6 : Add the next two numbers   


0110
1101
1 0 0 1 1 ( Rule: 1 + 1 = 0 + carry 1 )

256 128 64 32 16 8 4 2 1
Answer: 1 0 0 1 1
TASK
TASK 99

Use the rules on the


previous slide to help
you add these binary
numbers.

This video tutorial is


useful too.
Representing Texts &
Characters
When any key on a keyboard is pressed, it needs to be converted
into a binary number so that it can be processed by the
computer and the typed character can appear on the screen.
ASCII
(American Standard Code for Information Interchange)
The ASCII code takes each character on the keyboard
and assigns it a binary number.

• the letter ‘a’ has the binary number 0110 0001 (this is the
denary number 97)

• the letter ‘b’ has the binary number 0110 0010 (this is the
denary number 98)
Representing Images
Images also need to be converted into binary in order for a computer to
process them so that they can be seen on our screen. Digital images are made
up of pixels. Each pixel in an image is made up of binary numbers.

If we say that 1 is black (or on) and 0 is white (or off), then a simple black and
white picture can be created using binary.
TASK 10

1. Work out the code for this monster 2. Fill in the monster for this code
Representing Sound
Sound needs to be converted
into binary for computers to
be able to process it. To do
this, sound is captured -
usually by a microphone -
and then converted into
a digital signal.

An analogue to digital converter will sample a sound wave at regular time intervals. For
example, a sound wave like this can be sampled at each time sample point:
Why compress files?
• Processing power and storage space is very valuable on a computer.
• Higher resolution or quality of a file will result in larger file size,
which will take a lot longer to load, download or upload, when using
the Internet.
• We need to reduce the file size of text, image and audio data in order
to transfer the file more quickly and so that it takes up less storage
space.

io n
e ss se
There are two main types of pr he
o m es t .
compression: lossy and lossless. C lv e s
so issu
Lossy
• This is when the file is compressed but loses some of it’s
quality when this happens.
• This might mean reducing the numbers of colours in an
image or reducing the number of samples in a sound file.
• The most common way is to reduce the colour depth from 24
Original image
bits to 8 bits but this can make the image appear granulated
or have unusual colour blocks showing.
• JPEG and MP3 are lossy file compression type

Once a file has been compressed using lossy compression, the discarded Compressed image
data cannot be retrieved again.
Lossless

• Lossless compression doesn’t reduce the quality of the file at


all as no data is lost
• so lossless compression allows a file to be recreated exactly The space savings of
as it was when originally created. lossless
• The most common algorithm usually looks for patterns in the compression are not
data that are repeated. as good as they are
• BMP, PNG and Zip files are an example of lossless compression. with lossy
compression.
TASK 11 Summarise the difference between Lossy & Lossless using the information
from the previous slides.

Lossy ….

Lossless ……
Programming
Language
Complete a quick
Examples of Programming
TASK 12 search on Google and
list at least 5 different
Languages Programming
Languages.

You used Python


in Code Combat
this year

Note:
Pseudocode is not a programming
language. It is a notation resembling a
simplified programming language, usually
used in program design.
Programming Key Facts
• Programming is writing computer code to create a program, to solve a problem;
also known as coding.

Link between programs


• Programs are created to implement algorithms. and algorithms

• Algorithm is a plan, a logical step-by-step process for solving a problem. I can be


represented as pseudocode or a flowchart, and programming is the translation of
these into a computer program.
• We use programming languages to communicate with machines who speak
binary because it is easy for a human to understand and write, as it is closer to
our own natural language.
Programming Techniques/Concepts
This year (Lent term) you learnt how to use/code:
• Input & Output
• Variables
• Constants
• Sequence For the End of Year exam, you should
know the description of each
• Selection technique and be able to identify and
• Iteration explain the Block code for each.
Input & Output
Variable & Constant

Remember:
It is important for variables to have
meaningful names so that ...programs
are understandable to others.
Sequence
Selection & Iteration
A count-controlled loop that repeats
a section of code a fixed number of
FOR-loop times.

NOTE:
index is the variable
used to count the
number of iterations
TASK 12a
Complete the table by placing the blue text boxes into the
Data Types blank places.

String

Boolean
4

To store decimal numbers


3.142

Integer

To store a single character


TASK 13 Review the Block code below and move the callout tails so that they point
to the correct programming techniques and then attempt the questions.
Variable

Sequence Casting Iteration Selection

1. How many variables can you spot?

2. Name them.

3. Can you spot the following


programming concepts:
a) Input
b) Sequence

Challenge Q:
Explain the IF section of this code.
TASK 13

Answers
1. There are 4 variables

2. bird, emptyObstacleY, index


and obstacles
3. a) Input

b) Sequence

Challenge:

If the variable index is not equal


to the value stored in the
emptyObstacleY variable, then
create and add obstacle sprites
to the end of the obstacles
structure.
TASK 13a

Answer these questions:


Q2
Q1

a) What is the variable name within this


block code?
a) Identify the variable in this block code.
b) Is it a meaningful name? Explain why. b) Is it a meaningful name? Explain why.
c) If you were to rename this variable, what
would you call it?

Q3 What is the difference between a variable and a constant?


TASK 13a
Answers
Q1.
a) Variable is Temp.
b) It is a meaningful name because it refer to the value temperature that is
being used in the program.
Q2.
c) Variable is x
d) It is not a meaningful name because it does not refer to the value it holds
e) could be called value
Q3. A named data store that contains a value
that may change during the program.

A named data store that contains a


value that does not change during the
program.
Spreadsheet
Modelling
What is a Spreadsheet?

A software used for


calculations,
modelling solutions
and presenting data.

It is made of rows,
columns and cells.
Key Terms
Worksheet – Page of spreadsheet you are working on
Row – Cells that go across the spreadsheet page
Column – Cells that go down the spreadsheet page
Cell – An individual spreadsheet box where you enter data
Cell Reference – Names of individual cells (A5 for example)
Active Cell – The individual cell you are currently using
Label – Text used to describe certain values
Value – Numbers entered in individual cells
Formula – Used to calculate numbers.
Columns Rows

Cells
TASK 14
In this spreadsheet, cell A1 contains the number 3 and cell C4
contains the number 2.
Use the spreadsheet to answer the questions:

1. How many columns are there?

2. How many rows are there?

3. What are the contents of the following cells?


a) B2 ______
b) C4 ______
c) D1 ______
d) A1 ______

4. Which cells have the value of 3 in them?

5. How many cells are contained in spreadsheet that has 3 columns


4 rows?
TASK 14
ANSWERS

1. How many columns are there? 4

4
2. How many rows are there?

3. What are the contents of the following cells?


a) B2 _1_
b) C4 _2_
c) D1 _9_
d) A1 _3_

4. Which cells have the value of 3 in them? A1, D2, D4

5. How many cells are contained in spreadsheet that has 3


columns 4 rows? 12
Labels, Data & Formula
 Data:
• Three types of information stored: labels,
values and formulas
Labels Labels • Data can be formatted to hold different
information

 Label:
• Words and numbers not used in
calculation
• Used to describe what the values in the
Data Data cells represent
• May be used as a title of the spreadsheet

Formula: =SUM (F4:F7)  Formula


• Are equations
• Always starts with a =
• Can be used with a Range (F4:F7)
• Follows the order or BIDMAS /
BODMAS / Please Excuse My Dear Auntie
Formula is used in a
Spreadsheet to

Formulas complete
calculations
IF Statements
The IF Statement tests a given condition and returns one value for a TRUE result
and another value for a FALSE result.
For example, if sales total more than £5,000, then return a “Yes” for Bonus –
Otherwise, return a “No” for Bonus.

Product Sales Bonus Condition: Sales is


more than £5000
Mobile £5010 Yes
Tablet £5000 No
=IF(Sales > £5000, “Yes”, “No”)
Charger £4590 No

If condition is If condition is
TRUE FALSE
TASK 15
Explain the IF statement used in the spreadsheet model below
IF Statements
Consequences of
Uses of Computing
Cybercrime is any crime
committed using a computer,
Cybercrime computer networks or other form
of information communications
technology (ICT).

• Hacking:
• this involves gaining access into someone’s computer network without their permission, and
then taking control and/or taking information from other people’s computers.
• Examples: accessing the secure area on the school’s computer network and looking for test
paper answers or trying to change test scores.
• Making, supplying or obtaining malware (malicious software).
• These programs allow criminals to get into other people’s computers to carry out illegal
activities.
• Examples: viruses, spyware, botnets and Remote Access Trojans.
• Carrying out a DDoS (Distributed Denial of Service) attack or ‘booting’.
• A DDoS is when a website is attacked by sending it lots of internet traffic. This means anyone
who wants to visit that site won’t be able to access it.
• Example: Booting someone offline whilst playing online games may seem like a harmless joke,
but is still illegal.
TASK 16 Plan an essay on Teleworking using a mind map

Information technology has led to many changes in how we


work, where we work and even when we work. It has had a
dramatic effect on our working lives.

You plan should include:


• Teleworking definition
• Technological devices required
• Jobs that could be done through teleworking
• Advantages and Disadvantages of teleworking
for the community, employees and employers
• Barriers of teleworking (e.g. why would an
Reading Resources:
individual have difficulties working from home) • BBC Bitesize
• Teach ICT

You might also like