m m m m m m
Timem2mhour
s
Paper
reference 1CP2/02
mmm
Computer Science m
PAPER 2: Application of Computational Thinking
m m m m m
Yoummustmhave:
• amcomputermworkstationmwithmappropriatemprogrammingmlanguagemcodem
editingm softwarem andm tools,m includingm anm IDEm thatm youm arem familiarm withm th
atmshowsmlinemnumbers
• am‘STUDENTm CODING’mfolderm containingm codem andm datam files
• printedmandmelectronicmcopiesmofmthemProgrammLanguagemSubsetm(PLS
)mdocument.
Instructions
• Answer all questions on your computer.
m m m m m
• ‘COMPLETED
Save the new or amended code using the file name provided and place it in the
m
CODING’ folder.
m m
m
m
m
m m m m m m m m m m m
• You must notm use the internet at any time during the examination.
m m m m m m m m m m
Information
• The ‘STUDENT CODING’ folder in your user area includes all the code and dat
m
a files you need.
m m m
m m m m m m m m m m m m
•• The total mark for this paper is 75.
m m m
The marks for each question are shown in brackets.
m m m
m
m
m m
m
m
m m m
Advice
• Read each question carefully before you start to answer it.
m m m m m m m m m
• Check yourwork
Save your regularly
m m m
• answers and work if you have time at the end.
m m m m m m m m m m m
.
Turnmover
P71103A
©2022m Pearsonm Educationm Ltd.
Q:1/1/1/1/
, AnswermALLmquestions.
Suggestedmtime:m15mminutes
1 Am programm ism requiredm tom convertm numbersm enteredm bym them userm tom theirm alphabeti
cmequivalent.mOnlymnumbersmfromm5mtom30maremvalid.
Addingm60mtomthemnumbermandmthenmapplyingmthemfunctionmchr()mgeneratesmth
emequivalentmASCIImcodemformanmuppercasemletter.
Themtablemshowsmaccuratemtestm datamformamfunctionalmprogram.
Input Output
4 Invalidminput
5 5mismequalmtomA
22 22mismequalmtomR
30 30mismequalmtomZ
31 Invalidminput
OpenmfilemQ01.py
Amendmthemcodemto:
• createm anm integerm variablem namedmnummandmsetmitm tom 0
• takemthem inputmfrommthem userm andmconvertm itm tom anminteger
• checkmthatmtheminputtedmnumbermismbetweenm5mandm30
• addm60mtomthemvariablemnummandmassignmthemresultmtomthemvariablemdecimalCode
• joinm stringsm togetherm withm concatenation
• displaym anm errorm message.
Dom notm addm anym additionalm functionality.
SavemyourmamendedmcodemfilemasmQ01FINISHED.py
m (TotalmformQuestionm1m=m10mmarks)
2
, Suggestedmtime:m15mminutes
2 Amprogrammusesmturtlemgraphicsmtomdrawmamsimpl
emimage.mThism ism them imagem thatm mustm bem produce
d.
Bothmthem circlem andm them outsidem squarem aremcentredm
onm them horizontalm andm verticalm gridm lines.mThem outsid
e
squaremism400mm 400.mThemcirclemism200macross.mThemcirclemou
tlinemismcolouredmgold.mAllmothermlinesmaremblack.
Them programm hasm errorsm andm doesm notm workm correctly.mOpe
nmfilemQ02.py
Amendmthemcodemto:
• addm am commentm tom identifym them datam typem ofm them argumentm tom th
emturtle.modem()msubprogrammcallmonmoriginalmlinem19
turtle.modem("standard")
• fixm them NameErrorm onm originalm linem 23
screen.setupm(WIDTH,mHIGHT)
• fixmthemAttributeErrormonmoriginalmlinem28
theTurtlem=mturtle.turtlem()
• fixmthemTypeErrormonmoriginalmlinem36
theTurtle.pendownm(200)
• fixmthemlogicmerrormthatmcausesmthemverticalmaxismtombemtoomfarmrightmo
nmoriginalmlinem42
theTurtle.setposm(100,m200)
• fixmthem logicm errorm thatmcausesm them verticalm axismtom bem drawnm toomshortm o
nmoriginalmlinem48
theTurtle.forwardm(100)
• fixmthemlogicmerrormthatmcausesmthemoutsidemsquaremtomtiltmleftmofmthemverticalmax
ismonmoriginalmlinem56
theTurtle.setheadingm(95)
• addmamlinemtomsetmthemsizemofmthempenmtomthemconstantmBIGmonm originalmlinem 68
• addmamlinemtomsetmthemcolourmofmthempenmtomgoldmonmoriginalmlinem71
• addmamlinemtomhidemthemturtlemonmoriginalmlinem78.
Dom notm changem them functionalitym ofm them givenm linesm ofm code.m
Domnotmaddmanymadditionalmfunctionality.
SavemyourmamendedmcodemfilemasmQ02FINISHED.py
m (TotalmformQuestionm2m=m10mmarks)
3
Turnmover