Lesson 1.1.3a Resource - Worksheet 3 Data Storage (Text)
Lesson 1.1.3a Resource - Worksheet 3 Data Storage (Text)
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’?
_______________________________________________________________________
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.
_______________________________________________________________________
_______________________________________________________________________
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).
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
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
_______________________________________________________________________
2
Worksheet 3 ASCII
Data Representation