Data Representation 1
Learning Outcomes:
- To know what ASCII code is.
- To be able to explain how ascii code is used to encode characters.
- To understand what is meant by the term encryption.
Tasks:
- Create a new powerpoint called 'Data Representation'. Save it into your area in your computer science folder. All the work you do on data representation needs to be saved in this folder.
- ASCII code stands for the American Standard Code for Information Interchange. Add this definition to your powerpoint along with the table shown on this link: https://www.bbc.co.uk/bitesize/guides/zthbgk7/revision/3
- Add the following information to your powerpoint (use bbc bitesize and reliable google sources)....
Explain how many ASCII characters there are.
Explain what the term 'character set' means.
Add a character to binary table.
Giving examples explain that each character can be represented in an 8 bit binary number.
Explain why computers only understand 1's and 0's.
Explain what is meant by the term Encryption.
Ext:
Copy and paste the code below into python. Run it and check that the ASCII codes it generates correspond with the values on your ASCII table.
# Program to find the ASCII value of a given character
char = input("Enter a Character:")
print("The ASCII value of " + char + " is", ord(char))
The code below is a bit more complex it allows you to enter your name and then gives you the ASCII code of all the characters in your name. This code makes use of lists (asciiname=[] ....note this is square brackets) and a for loop. Run the code and check it produces the right values.
# Program to find the ASCII value of a your name
name = input("Enter your name: ")
asciiname=[]
for i in name:
print(i)
asciiname.append(ord(i))
print("The ASCII values of your name",asciiname)
How could this code be developed to add encryption? Try to develop the code further to generate encrypted values.
ord('c') returns the ascii code number for c, whilst chr(100) returns the character that corresponds with the ascii value 100 which is d. See if you can create a code using chr to return characters.
Add annotated screenshots of your codes into your data representation powerpoint.
Data Representation 2
Learning Outcomes:
- To know how images are represented and stored as binary code.
- To be able to explain how colour depth affects picture quality.
- To be able to calculate the file size of different images.
Tasks:
- Continuing your powerpoint called 'Data Representation'. Find a definition of the word 'pixel' and add it to your document.
- Image size is usually written as two numbers (pixels along the width x pixels of height). Find examples of low pixel and high pixel images and add and annotate them on your powerpoint.
- Look at some of the images saved in your pictures folder. Look at the properties of the image to find out the picture size. Add 2 images to your powerpoint and annotate with their size.
- If one bit is used to encode each pixel then the colours are black and white. Colour depth is the number of bits used to encode each pixel. Find examples of different colour depths and add these to your powerpoint: 24bit, 8 bit, 4 bit, 2 bit and 1 bit.
- File size is calulated by Width x Height x Colour Depth. An image with 4288 (width) x 2848 (height) x 24 bit colour depth has a file size of 293093376 bits. or 36636672 bytes or just under 37 megabytes. Copy and complete the table below...
Width | Height | Colour Depth | File size (bits) | File size (bytes) |
5000 | 5000 | 256 | ||
600 | 980 | 24 | ||
70000 | 55000 | 256 | ||
6500 | 3400 | 8 | ||
1200 | 800 | 4 |
Data Representation 3
Learning Outcomes:
- To know how sound is represented.
- To be able to explain what factors effect the size of a sound file.
- To be able to calculate the file size of sound files.
Tasks:
- Continuing your powerpoint called 'Data Representation'. Find out how sound is represented from this site: https://www.bbc.co.uk/bitesize/guides/z7vc7ty/revision/1 Add information from this site to your revision notes in powerpoint.
- Find out what is meant by the following key terms and add them to your notes..... Sampling, Analogue recording, Digital recording, fidelity, bit depth, sampling precision, sample rate.
- Find out what factors affect the size of a digital audio sound file.The bit rate of a file tells us how many bits of data are processed every second. Bit rates are usually measured in kilobits per second (kbps).
-
Calculating bit rate
The bit rate is calculated using the formula:
Frequency × bit depth × channels = bit rate
A typical, uncompressed high-quality audio file has a sample rate of 44,100 samples per second, a bit depth of 16 bits per sample and 2 channels of stereo audio. The bit rate for this file would be:
44,100 samples per second × 16 bits per sample × 2 channels = 1,411,200 bits per second (or 1,411.2 kbps)
A four-minute (240 second) song at this bit rate would create a file size of:
14,411,200 × 240 = 338,688,000 bits (or 40.37 megabytes)
- Now: Calculate the file size for a 3 minute stereo recording with a sample rate of 44,100 and a bit depth of 24 bits.
- Create a program in python to calculate sound file sizes.
Next Task: Past the past paper questions below into your notes then use the internet to research model answers.