0% found this document useful (0 votes)
17 views

Lesson 1.1.3a Resource - Worksheet 3 Data Storage (Text)

Uploaded by

technabooks
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Lesson 1.1.3a Resource - Worksheet 3 Data Storage (Text)

Uploaded by

technabooks
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Worksheet 3 ASCII

Data Representation

Worksheet 3: ASCII
Task 1

1. Write your initials in binary digits below using the ASCII table:

2. Using the 8-bit ASCII set, what would be the total size in bytes of the words ‘Computer
Science’?

_______________________________________________________________________

3. What is meant by a character set?

A collection of characters

4. How many characters can be represented with the 7-bit ASCII character set?

128

5. The eighth bit is used to give an extra 128 characters. Any character in the ASCII table can
be typed using the ALT key in combination with its ASCII code.
For example, if you type ALT + 065 on the numeric keypad, the letter A will appear.

What is the binary representation of the letter A?

_______________________________________________________________________

Typing ALT + 0233 will produce é.


What is the binary representation of the letter é?

_______________________________________________________________________

6. The function ord(a) returns the denary value of the ASCII representation of the character a.
The function chr(i) returns the character whose ASCII code is the integer i .
The ASCII representation for A is 65 (denary).

What will be printed when the following program is run?

x = ord(‘C’)
y = x + 3
z = chr(y)
print (x,y,z)

1
Worksheet 3 ASCII
Data Representation

Task 2

7. A programmer writes the following lines of code in Python. All data is input as ASCII
characters.
print("Please input an integer x: ")
x = input()
print("Please input a second integer y:")
y = input()
z = x + y
print ("x + y = ", z)

The user enters 7 and 4. What will be printed? Explain your answer

_______________________________________________________________________

_______________________________________________________________________

The programmer changes the second and fourth lines to read


x = int(input())
y = int(input())

The user enters 7 and 4. What will be printed?

_______________________________________________________________________

The programmer changes the program to the following:

print("Please input an integer x: ")


x = input()
print("Please input a second integer y:")
y = input()
z = x - y
print ("x - y = ", z)

What will happen when the program is run? Why?

_______________________________________________________________________

_______________________________________________________________________

_______________________________________________________________________

2
Worksheet 3 ASCII
Data Representation

You might also like