PAPER 2: Application of Computational Thinking
You must have:
• a computer workstation with appropriate programming language code editing software
and tools, including an IDE that you are familiar with that shows line numbers
• a ‘STUDENT CODING’ folder containing code and data files
• printed and electronic copies of the Programming Language Subset (PLS) document
(enclosed).
Instructions
•• Answer all questions on your computer.
Save the new or amended code in the ‘COMPLETED CODING’ folder using the
name given in the question.
•• Do not overwrite the original code and data files provided to you.
You must not use the internet at any time during the examination.
Information
•• The total mark for this paper is 75.
The marks for each question are shown in brackets
– use this as a guide as to how much time to spend on each question.
• The ‘STUDENT CODING’ folder in your user area includes all the code and data files
you need.
Advice
•• Read each question carefully before you start to answer it.
Save your work regularly.
• Check your answers and work if you have time at the end.
, Answer ALL questions.
Suggested time: 10 minutes
1 A program is being developed to show the average daily temperature and add up the
costs of buying ice cream.
• It displays each temperature stored in an array of temperatures.
• It adds up all the ice cream costs entered by the user, until the user enters 0.
• It then calculates a discount. When the total cost is over 100.00, the discount is
10%. Otherwise, the discount is 5%.
Open file Q01.py
Amend the lines at the bottom of the code to give the:
• name of a constant used in the program
• name of an array used in the program
• line number of an initialisation of a variable with a real number
• line numbers for a selection construct
• line numbers for a repetition construct
• line numbers for an iteration construct
• line number for an instruction that outputs information to the screen.
Do not add any additional functionality.
Save your amended code file as Q01FINISHED.py
(Total for Question 1 = 7 marks)
P72596RA 3
Turn over
, Suggested time: 15 minutes
2 A program is written for an exercise routine. It displays the names of warm-up
exercises, stored in an array. The user enters a number. That number of exercises is
selected randomly from the array and displayed.
Open file Q02.py
Amend the code to:
• fix the syntax error on original line 4
import randum
• fix the syntax error on original line 16
for exercise in exerciseTable
• complete original line 20 to generate a random number between 0 and 4
index = random.
• complete original line 8 to make the exercise names be string data types
exerciseTable = [ "squats", "planks", pushups,
"lunges", "burpees"]
• fix the IndexError on original line 21
name = exerciseTable[index + 1]
• fix the NameError on original line 22
print (naime)
fix the logic error on original line 19 that causes one less exercise to be printed
•
than is asked for
for count in range (numExercises - 1):
• use white space to improve the readability of the code.
Do not change the functionality of the given lines of code.
Do not add any additional functionality.
Save your amended code file as Q02FINISHED.py
(Total for Question 2 = 8 marks)
4 P72596RA
Voordelen van het kopen van samenvattingen bij Stuvia op een rij:
Verzekerd van kwaliteit door reviews
Stuvia-klanten hebben meer dan 700.000 samenvattingen beoordeeld. Zo weet je zeker dat je de beste documenten koopt!
Snel en makkelijk kopen
Je betaalt supersnel en eenmalig met iDeal, creditcard of Stuvia-tegoed voor de samenvatting. Zonder lidmaatschap.
Focus op de essentie
Samenvattingen worden geschreven voor en door anderen. Daarom zijn de samenvattingen altijd betrouwbaar en actueel. Zo kom je snel tot de kern!
Veelgestelde vragen
Wat krijg ik als ik dit document koop?
Je krijgt een PDF, die direct beschikbaar is na je aankoop. Het gekochte document is altijd, overal en oneindig toegankelijk via je profiel.
Tevredenheidsgarantie: hoe werkt dat?
Onze tevredenheidsgarantie zorgt ervoor dat je altijd een studiedocument vindt dat goed bij je past. Je vult een formulier in en onze klantenservice regelt de rest.
Van wie koop ik deze samenvatting?
Stuvia is een marktplaats, je koop dit document dus niet van ons, maar van verkoper premiumpapers. Stuvia faciliteert de betaling aan de verkoper.
Zit ik meteen vast aan een abonnement?
Nee, je koopt alleen deze samenvatting voor €5,53. Je zit daarna nergens aan vast.