0% found this document useful (0 votes)
15 views18 pages

Data Representation - Worksheet

The document covers essential concepts of data representation, including binary and denary number systems, floating point numbers, extended ASCII, and image storage methods (bitmaps and vectors). It explains how to convert between binary and denary, identifies mantissa and exponent in floating point numbers, and describes how text and images are stored in computers. Additionally, it includes tasks for practice and understanding of these concepts, which are relevant for National 5 exams.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views18 pages

Data Representation - Worksheet

The document covers essential concepts of data representation, including binary and denary number systems, floating point numbers, extended ASCII, and image storage methods (bitmaps and vectors). It explains how to convert between binary and denary, identifies mantissa and exponent in floating point numbers, and describes how text and images are stored in computers. Additionally, it includes tasks for practice and understanding of these concepts, which are relevant for National 5 exams.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 18

Part 1: Data Representation

Binary Numbers
You know from the software development topic that an integer is a whole number - e.g. 11, 34, 118.

The computer stores these numbers using binary. Binary numbers only use the digits 1 and 0.

For National 5, you need to be able to convert whole numbers from denary (‘normal’ numbers with
10 digits, what we use) to binary. You also need to convert binary numbers back to denary.

 Binary - what the computer uses (10011101)


 Denary - what we use (= 157)

The binary numbers you work with use eight place values/columns, starting (right) at 1, and doubling
each time:

By placing 1s and 0s in these columns, we can write out the binary number 10011101.

10011101

To convert this number to denary, we add up all the columns with a 1 in them.
These are 128 + 16 + 8 + 4 + 1, so the total is = 157.

In this example, we write out the binary number 01011100

128 64 32 16 8 4 2 1

0 1 0 1 1 1 0 0

Again, we add up all the columns with a 1 in them.


This becomes 64 + 16 + 8 + 4, which is = 92.
You also need to be able to write a denary number in binary.
There are a few methods to do this - I will use this, which I think is the simplest.

I want to convert the denary number 87 to binary.

First, write out the table with the eight place values (from right: 1 to 128).

128 64 32 16 8 4 2 1

Which of these columns, when added up, would make 87?

We know that 128 doesn’t go into 87, so there must be a 0 in that column.
64 does go into 87, so we can write a 1 in the 64 column.

128 64 32 16 8 4 2 1

0 1

This leaves us with 23.


Which remaining columns, when added up, would make 23?
We could make it by adding together 16 + 4 + 2 + 1, so we should put a 1 in those columns.

128 64 32 16 8 4 2 1

0 1 1 1 1 1

Finally, we fill in the empty columns with 0s.

128 64 32 16 8 4 2 1

0 1 0 1 0 1 1 1

We can check our working by adding all the columns with a 1 in them: 64 + 16 + 4 + 2 + 1 = 87.

These questions come up in most


National 5 exams. You need to be able
to convert both ways - from binary to
denary, and denary to binary.
You aren’t given the table for your working in test or exam questions, so you will have to remember
the order (from right: 1 to 128) yourself.

These questions are usually worth 1 mark.

Task 1 - Binary Numbers


Convert the following 8-bit binary numbers to denary.

11010011

128 64 32 16 8 4 2 1

Answer:

00111001

128 64 32 16 8 4 2 1

Answer:

10101010

128 64 32 16 8 4 2 1

Answer:

01010101

128 64 32 16 8 4 2 1

Answer:

11000011
128 64 32 16 8 4 2 1

Answer:

Task 2 - Binary Numbers


Convert the following denary numbers to 8-bit binary.

25

128 64 32 16 8 4 2 1

84

128 64 32 16 8 4 2 1

133

128 64 32 16 8 4 2 1

94

128 64 32 16 8 4 2 1

76

128 64 32 16 8 4 2 1

119
128 64 32 16 8 4 2 1
Task 3 - Binary Numbers
This task has a mix of binary-to-denary and denary-to-binary.
In these questions, like in the exam, you will have to write out the place values (from right: 1 to 128)
yourself.

Convert the binary number 11010100 to denary.

Answer: ____

Convert the denary number 172 to binary.

Convert the binary number 11110000 to denary.

Answer: ____

Convert the denary number 113 to binary.

Convert the denary number 198 to binary.


Floating Point Numbers

You know from the software development topic that a floating point number is one with a decimal
point.

0.5571257

Inside the computer, floating point numbers are stored with a mantissa and an exponent.

If you are asked how floating point numbers are stored, you would say that it is with a mantissa and
an exponent.

You need to be able to identify which part is the mantissa, and which part is the exponent.

The floating point number is stored in something that looks a bit like scientific notation.
Exponent
0.58125 x 104

Mantissa

In this example, the mantissa is 58125 and the exponent is 4.


We remove the decimal point when writing the mantissa.
We remove the ‘10’ when writing the exponent.

Mantissa 58125

Exponent 4

This question has come up in the same way in every N5 exam. You have to be able to pick out the
two parts.
Tasks - Floating Point NUmbers
Describe how a floating point number is stored in two parts.

For each of these floating point numbers, identify the mantissa and the exponent.

1. Floating point number: 0.1258 x 105

Mantissa

Exponent

2. Floating point number: 0.8741 x 103

Mantissa

Exponent

3. Floating point number: 0.5512 x 104

Mantissa

Exponent

4. Floating point number: 0.1701 x 106

Mantissa

Exponent

5. Floating point number: 0.1192 x 108

Mantissa

Exponent
Extended ASCII
For National 5, you need to know that text is represented using extended ASCII. Extended ASCII uses
8 bits to store each character. Each character has a unique number associated with it.

For example, A is 65 and the Space key is 32.

Extended ASCII is made up of printable characters and control characters. Printable characters are
the letters, numbers and symbols that you see on the screen. Control characters are signals that do
not appear as printed symbols in the text (messages like “escape” and “delete”).

Printable characters (examples) Control characters (examples)

A z # Escape
4 ? Y Delete

Because extended ASCII uses 8 bits for each character, we can calculate how much space is needed
to store a particular message:

Space needed (in bits) = Length of the message x 8

For example:

Space needed (in bits) = Length of “Hello” x 8

= 5 x 8 bits

= 40 bits

We could also convert this to bytes (dividing by 8), meaning 40 bits is 40 ÷ 8 bytes, which is 5 bytes.

What you need to know:

 Extended ASCII uses 8 bits for each character in a text file


 Extended ASCII is made up of printable and control characters
 Each character (letter, number, symbol, or control character) has an ASCII number
 To calculate the size needed to store text, times the length of the message by 8 bits
 Sometimes, you might need to convert the size in bits to a size in bytes
This question from the 2018 specimen paper asks for an example of a control character and a
printable character.
A question from the
2019 exam asks
which code is used
to store text (ASCII)
and the number of
bits it uses per
character (8 bits).

You could also be asked to use this


number (8 bits) to calculate how
much space it would take to store a
piece of text. In this question from the
2018 exam, you would multiply 8 bits
(1 mark) by the length of the message
(1 mark). The message has 8
characters, so the answer is 8 x 8 = 64
bits.
Tasks - Extended ASCII
1. How many bits are used for each character of text written with extended ASCII?

2. State one example of a printable character and one of a control character in extended ASCII.

Printable character

Control character

3. The message “hello world” is 11 characters long.


Calculate the space needed to store the message in bits, using extended ASCII.

4. Calculate the space needed to store the message “welcome to computing” in bits, in
extended ASCII.

5. Calculate the space needed to store the message “have fun with ascii” in extended ASCII.
Convert your answer into bytes.
Images - Bitmaps and Vectors
You need to know how images are stored as bitmaps and vectors.

A bitmap is a grid of pixels. Each pixel has a colour associated with it.

Bitmaps can be black and white, or have lots of colours. The important
point is that it is made up of a grid of individual squares called pixels.

Bitmap made up of
pixels

You learn more about bitmaps during the web topic, later in the course.

A vector graphic isn’t stored as pixels.


In a vector, the image is made up of shapes called objects. Each object has a list of attributes.

You need to know about four types of objects. Each type of object has attributes:

 Fill colour = the colour the object is ‘filled in’ with


 Line colour = the colour of the line/border around the object, if there is one
 X and Y coordinates = the position of the object in the graphic

The SQA have also accepted answers that name the length of a line, line/border thickness,
or rotation/angle of an object.

Rectangle Line colour


Fill colour
X and y coordinates
Ellipse Line colour
(oval/circle) Fill colour
X and y coordinates

Line Line colour


X and y coordinates

Polygon Line colour


(other shapes) Fill colour
X and y coordinates
For example, in this vector image, there are three objects - a line, an ellipse and a polygon.

The circle is an ellipse. The fill colour of the ellipse is green.


The line colour of the polygon is orange. The line colour of the line object is blue.

All of the objects in the image have X and Y coordinates.


Line colour

Fill colour Fill colour

These questions ask how a bitmap image would be stored. You would answer that it is a grid of
pixels (1 mark), and each pixel has a colour (1 mark).

In questions about vector


graphics, you can be asked
about the objects and their
attributes. The object in the
first question is an ellipse
(the name for an oval).
Attributes could include the
line thickness, line colour, fill
colour or the coordinates.

Be careful when answering


questions about a line - it
doesn’t have a fill colour!
Tasks - Bitmaps and Vectors
1. In a question that is worth two marks, describe how a bitmap image is stored in the
computer.

2. For two marks, describe how a vector image is stored.

3. The image below is a vector graphic. State the name of the object, and two attributes it has.

Name of the object

Attribute 1

Attribute 2

4. The image below is a vector graphic. State the name of one of the objects, and two
attributes it has.

Name of one object

Attribute 1

Attribute 2

5. The image below is a vector graphic. State the name of one of the objects, and two
attributes it has.

Name of one object

Attribute 1
Attribute 2

You might also like