We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 20
PMT:
15
7 Ataxi firm is investigating replacing its drivers with self-driving cars.
(a) Explain why the self-driving system will use a real-time operating system,
- B]
ocr18 Turn overPMT
16
(b) The code for the seif-driving system has been written using an object-oriented programming
language.
Itrecognises obstacles in the road and then classifies them,
The class for Obstacle is shown below.
public class Obstacle
private moving //Boolean value
private distance //Real number given in metres
private direction //Integer given as between 1 and 360 degrees
public procedure new(givenMoving, givenDistance, givenDirection}
moving=givenMoving
distance=givenDistance
direction=givenDirection
endprocedure
public procedure updateDi stance (givenDistance}
distance=givenDistance
endprocedure
endclass
(i) Write a line of code to create an object called bol Lard of type Obstacle which is not
moving and is 7.8 metres away in a direction of 8 degrees.
(ii) Describe an example of encapsulation in the class definition code above
2}
Describe the advantages of using encapsulation
2]
ven2018PMT:
M7
(c) The self-driving program recognises people as a special type of obstacle and the class
Person should inherit the methods and attributes of obstacle. People are treated like other
obstacles except
+ when the updateDistance method is called, if the person is more than 2 metres away
but is 5 metres (or less) away, the method Cont ros .beepHorn () is called.
+ when the person is 2 metres away (or closer), the method Cont rols.apply3zakes ()
is called as well as Controls .beepHorn (}
Complete the class Person
class Person
public procedure updateDistance (givenDistance}
distance=givenDistance
endprocedure
endclass 15)
(d) Give one advantage and one disadvantage to the customers of the taxi using self-driving
cars rather than drivers.
Advantage
Disadvantage
2)
foca 018 Turn overPMT.
18
8 Astudent writes a program to apply a symmetric encryption algorithm to work on messages of up
to 25 ASCII characters,
(a) Describe what is meant by the term ‘ASCII’
[2]
‘The encryption algorithm works in the following way.
‘A message of up to 25 characters (spaces and punctuation are not included) is placed in a
‘5x5 array. Any leftover spaces are filled with random letters, The message | LOVE COMPUTER
‘SCIENCE becomes:
I/L E |
[elo PiU
rlelelsle
tfol«te[™
The key is a sequence of ten numbers,
In this example we will use 1 2 3 4 5 1 2 3 4 5. The first 5 numbers state how many spaces
the rows 0 to 4 must be rotated right.
Akey with the first 5 digits 12 3 4 5 would result in
ofv|
E/T}L
elolelolm|
eis|e|ris
elwlele|z
tlo[wials
The next 5 digits state how many spaces down the columns 0 to 4 should be rotated
Applying the last 5 digits 1 2 3 4 5 to the grid above would give
eT yelele
Riu|ulR19
Part of the pseudocode for the algorithm is written below.
global array grid[5,5)
addMessage()
// letters and random letters have been entered
// into the 2D array, grid
for i= 0 to 4
x = getNextDigitInkey()
shiftRow (i, x)
next i
for i= 0 to 4
x = getNextDigitInkey ()
shiftcolumn (i, x)
//Now reassemble array back into string.
(b) Show the result of running the algorithm on the grid and key below.
KEY:3333341111
tlol?|s|z
cjalelt|™
E[s[slale
je|y]r/elL
violelelo|
Grid after only the rows are shifted:
—
Grid after columns have also been shifted
Turn over
2]
PMT.(c) Write the procedure sii ftRow.
20
(4)
PMT:PMT
24
(d)* Modern encryption is much stronger than the method described in the first part of this,
question.
Discuss the impact of modem encryption on society. You should refer
The importance of asymmetric encryption and how it differs from symmetric encryption.
Different circumstances in which symmetric and asymmetric encryption may be used.
iO)
ocr ze Turn overPMT
22
9 (a) Demonstrate how the bytes below are added together. Show your working.
01101010
00111114+
(2
(b) Demonstrate how the bottom byte below is subtracted from the top byte, Show your working,
11001111
00111001 -
[2]
(c) Convert the binary number shown below to hexadecimal
0011011100001111
ica]
{d) The number below is represented in floating point format with a 5-bit mantissa in two's
complement followed by a 3-bit exponent in two's complement. Calculate the denary value of
the number, showing your working.
01001 o10
BIPMT
23
(e) The numbers below are represented in floating point format with a 5-bit mantissa in two's,
complement followed by @ 4-bit exponent in two's complement. Normalise the numbers
shown below, showing your working.
00011 0010
2)
11100 0110
2)
(f) Show the byte below after having an AND applied with the masking byte.
Byte 0 1 1 1 0 0 1 |
AND | 1 1 1 1 1 1 1 |
Result |
1
(g) Show the byte below after having an OR applied with the masking byte
Byte 0 1 1 1 |o 0 1 |
OR 1 1 1 1 |4 1 1
Result
nM
Turn overLd
SOURETD
(weow) srepdn poyjews ety yim payepdn aioje124y pue’- |
z ‘ayeaud si eoveastp aynqune ayj-| |
| |
uo\ke Se Yons seBendue|
Aq pasn se sojouieied 32s Jo asn 104 esijeued you og |
(8 ‘8°, 'estea) sT9eas0=p2eT (2 xew 10d yew 1)
£(g /8°L ‘@STBS]BTOBISGO = PIETTOG aTD2I800 sepi0 |
(g /e-¢ ‘estez)oToeasqo nouepzeTrea| (ZO) | P8109 ey) UI ‘UI sjueWiNBue Joeu409 ey) nd SEH -
sajduiex3 z Pue|0q paljes yalqo ajse1sqO palessg - q | |
Te XeW 180 EW 1)
‘9}2| 00} S11! yun puodsas you pue syse,
Jeuyjo yim Buljeap Asnq aq yUBIU SOLY UoU y -
“euiy asuodsas paajuerenb e Siejlo SOLU -
(a\dwexe aiaisuas s24j0
40) 489 Jo juo4) ul Buiddajs suoauios se yon’ -
(ZLov) ~-saBueyo
€ 0} Anueisul puodsei 0} 91g2 2q 0} spaeN - |
soueping | Hew TeMsuy
gh0z ounr eweyos weW LorreANd
sz
(2 xew '= 10d ew 1)
Aiequepiooe paBueyo aq 1,ued /ejep BujsajOrq -
aneyaq Pinoys joalqo ayy Moy
up quaysisuos exe se6ue49 Buunsu3 jpepueyUl
(zLov) | hem ay) ut paBueyo oq uo ues syoalgo seunsua -
.Buyajoud, se Guunses, peo 2|___seousjsisuoouysioise Jo eoueyo au seonpay -
aoueping | EW TOMSuy | wonsand |
e40z eunr owoyos EW borserHLie
ypu |
() uz0Hdeeq' stoxqU0D |
uaya Ge>souezstaueAT6 JTEsTS
() seyezadtdde-stoxquo3
()uzoHdeeq" sto13U09
ueu3 Z=>eouezstquent6 gt
Fypue
() saxezghtdde -stoxqU0D
usy3 Z=>sourastquenTS 37
sypu
uzopdeaq-sTor 40D
wey? G=>eouezstquent6 37
"mojaq
‘ale sejdusexe j901409 yons om, ‘2160) oy) Jo InJose9
8q ~ poujetu 24) Bunum Jo 3sixe SKM Jo Jequinu e GN
sseqopus
aanpacozdpus
sourystquenTb = eoueqsTp
3tpue
sypue
) soxexgAtdde-stozqu03
uoy2 Z=>sourysTaUeATS IT
() ux0Hdeeq" stox3U0D
ueu3 GeeoueastqueAT6 gt
(soueqstqueats) eoueystaeqepdn
eanpesosd ottand
(g xe ‘= sad sew 1)
Woy sieB6uj sexjew go) Jenbe40 ue ssoy - |
Woy sie661y saxjeu Z 0} Jenba JoueY soy =
ene1q
19664) senaw Z ueW) J9}e8J6 jou Ing 0} enbS ~
‘ayelg sie661y saxjeu Z Uy) sso -
poujsw auy uy
(2102 sqQ)uosieq
1 2)981890 : uosied
/ 2)9818G0 SpuaKXe UOSIag
J 8}981SAO SWOYUI UOSLEg
(eow) 83
21923S8q0 SITTeUUT Woszed sseTo §|__‘a}oeisqo Jo eoueyyayul jo asn se0I9 au Sil - 2 |
soueping | we Temsuy | ToRsenD |
810z eunr auiayos EW LoiseeHaz
‘OBEIUEAPESIP | KEW PUB SBEIUEAPE | XE
‘srewoisna
snonieu einsseei 0} ,soueseid UeUINY,,
Ou / J9Ap eu YM BIq)SSOd UOISSNoSIp ON,
(4e9 8) apisino ejdoad snoxewnu.
40 Seni] 24) anes 0} YSU Je JeBuossed uy ind
‘ew! yeuy suonoe aye1 Aew “6'9) “io6uassed oy
J0 eu} Jeno SueMsepad Jo Ajajes esnuoud Ae
syuspigoe a1ydoujsejeo esneo pinog epoo eu
Ul Bng e — 1 Buluuns wesBoid oxy se poob se AIUD
Buppey 0} aigeseuina
ayeiado ues
1 YDIUM UO Speod aly Jo SUE) UI paul] aq KEW -
‘yoseds jeimjeu pueysiepun 0} alge aq Jou Ae -
‘Aenuayod
S11] 818 Jenup payewioyne ue Jo sabejuenpesiq
“aynod Ulm SayeISIWN a¥EUL 0} AjO%!| 889] -
‘40n00 0} Bem ou se Jedeaya -
(o19 speeds
(@ZoW) | uonoees Jexoinb 0} anp) Jenup UeUNy e UeU JEJeS |
| Z| :Aienusjod si » aue Jonup pajewomne ue jo seBeluenpy
[ saueping | Hew — ToMsuy | woRsenD |
e10z eune eweyos EW Loser
ANdLd
8
OUEW 1) mojed se YIYS UUIN|OD,
ufo wala
o[z|alsla
(zL0v)
ovo z (HEWN L) mojag se ylus Moy
(Z xew '- 40d wel 1) |
JejoBseUD Jed Sg-B /S1A-L SOM) -
supjoe1eyo 0} Sanjen sdeyy -
yes sarpeveyo y -
(tow) aBueyoieruy
z Lonewoyul 40s @poo pepueIs LedVOWY - e|_¢
‘saueping | EW. Tomsuy woRsSnD |
8102 eunr ewisyos HEWN LoisretNd
ez
[asquaNnez FIBESS Bo
3S1y peoU919}91 q 0} SULUNIOD 404 mojje “SUORNIOS UILRIM :3}0N,
exnpecoxd pus
[C/xequaymoz) prx6=2due3
9 03 o= £ z03
‘o=2due9
(> ‘zequaynoz] prx5=1du03
seoetd 02 T=T 105
(seoeTd ‘sequngnoz) MOWIJTYS exrpedcad
uy
eanpesezdpus
Paxeu
[1]due3~[segnou’zequnnnoz | pT36
on se
ous eu SF ¥// 5 GOH(S0DeTrT) =soaneu
¥ 03 O=F 203
(7) ¢ue3
9 03 o=F 203,
(g)euea Aezze
(seDeTd ‘xequmnnox) mowasTYs exnpeDord
““@pnjoul suonnjos algissog
Ty fxoqunymo}
sanpssordpus
7 axou
[yfxequnysoz] prxS = (T+ ‘xequnynoz]pTI5
seoeTd 01 9 = ¥ 207,
{seortd ‘xequnymox) moyaz Tus exnpezord
pom TOT jm Buvnoyos aun ‘aidusexe |
40.4 Hom 0} suu9es anyen 228} UO S1amsue BUOIN Jo snoRNeD
2g ‘ebuaeyo pue yoiexjs Joyo 0} ueaU S! EW JeUY
‘SUL YaNOP 24} Jo waUEQ ay anG auNsUN UAYM “SnIsT|DX®
(p xew ‘49d YEW 1)
‘mou Yoee Sylus ANDBLIOD ~
no Bunesousb ynoyym Kewe
10] 40} JO ASN a\qisuss -
ue sauepunog doo} ay) seben6ue| awos ul yeu pun | (LOW) uy Sa}EINdIUEW BINPSOOIg - |
1 daey uondeoxe spunog jo 3no y 88s 0} Bupjoeys UeUNA % ‘suejoweed yum pauyep ANdaNI0D ainpeddIq 2|
aoueping EW TeMsuy uonsand
hoz aune ewayos EW LoisteHtLd
oe
‘pejoajepun os op ues sesodind
snolsesau 40} Buedtunwuuioo asou) sueatL Ose 3ng
‘foenud Jo sian] pejuapecaidun sjenpinlpul seni6 SIL
(MOU am Se Je} se) deaseyUI hay) SeBessewi paydAsoU
yoe10 Allseo 0} alge J8Bu0} au aie syUaUIUIAND
31 noua ajqissod @q ou pinom aoseUWOD-3
yeUIa}U! 84) UO pasn Ajapim
1 aPeW Sey UONdALOUe Jo asn Jo aseo pue yPBuE.!s Oy
£0v
yep dn Bunyoeq usu ajdwiexe 104
‘BundAisap pue BundAioua s| uosied
auies ay} USYM pains }Saq s! UoRdAIOUS oLjOWILAS
YOUIBIU] 24} 48N0 S|/BIBP Ped Ipa10 ajdulexe 4054
yep
SujGueyoxe uay% pasn usyo s| uoNdAious oUjeWLIKSY
(swayshs
BulGessow ‘S41 LH ‘6'9) paydArous Gutoq 5} eyep
sou} B1eMe Bq YEA JOU AeW Siasn UEYO ‘aBpe/mouy
ysileoeds moyym pasn oq ued uoRdA1oUe Wapoyy
zov
SUIYjHOB|e DIjawULUAS LeU) BuIsseo0.d
‘J0W enjonul 0} pual SULALOBje UoNdALoUe SUjeWLUASY
uondAioep pue
ondALous 104 Koy ewes ay) Sesn UONdAsoUD OLNSWLIKS
uondAioap pue uondAioue
10} sex uaseylp sasn uondAioue oureuituksy
‘B19 Jejndwod-aid & ul pesn
yeu) UeU) JeBUONS siapi0 Auew S| UoRdAIOUS WiepO,
Lov
(e)
e£0¥
(2)
Lzov
(2)
ZLov
(2)
blow
uuogeuejdxe 24) 0} weR9I01
‘Ayvonjduut ped ysow ay} Jo ase sajdwexayaoueping |
pessiw ae saniunyoddo omy 10 2UO,
UBnowe papinesd yxeyU00 4) 0} AHoduIp Buipuersiopun |
pue aBpaymouy say Ajdde 0} alge s! syepipues ay] |
padojenepiepun seu
We 1ng ojeundoe AjeseUs6 SI JeUE}eW ay) ‘oNdAIOUS
oljewUuAse pu DLJaUILUAS UBaNyaq eouELeYIp
‘uy; pue uondAlous WapoUl Jo BuIpuesiepun pue
abpeimouy ejqeuosess SajeNsuoUIOp sjepIpUED SUL
(seu g-p) 19007] PINZ PURE HEN
payenueysqns pue juene|al si paueseid
uoneULoJU! su “pasnanns AjjeoI60) pue see;
‘1 yoiym Buluosees Jo oul) padojenap-jjom @ s} 2104,
asapisuico-|jam pue UeAe|O1
‘Anuoysisuoo 812 s]uauILOD eAneN|eny ‘pedUEed [IM
S1 YIM UoISsnosip YBNosoU) & Sapinoid BIepIpUED BY,
uoneueldxe uy 0}
quensja1 Ajfolidxe aq jm seidwiexayeoueping ‘papinoid
yxaIUO9 24p 0} AUaIS!sUOD UE AnoeuIp BuIpuEyssepuN
ue abpaymouy slot Aide 0} alge si siepipues sy,
allelep pue ajeinode Aijesoueb si jeuoyeu!
au. “uondéioUe oujowUASe pue oLJeUIWIAS UZ@Mjeq
eoualey)p ain pue uoNdKious Wepolw Jo Buipuersiapun
ue abpeymouy yBnouoy) & SeleNSUOWISP aIepIpUeD au,
(sysewi 6-2) 19007 YBIH-¢ pueg EIN
P
‘eoueping:
we
t aeMsuYy
uonsan
loz eunr
eweyss ue,
LoraphHLid
be
pS JO Ayo
Jou s} esuodses 10 uonsenb ay Jemsue 0} IdWeNe ON
‘sysew! 0
‘seajo 2q yOu Kew eouapina ayy
0} diysuonejas auy pue eouepina payiul| Aq payoddns si
| vonewsoj sy “hem peumonyjsun ue ul peyeolunuwco
ue 918eq $1 UoN}eWiojU! ayy “payeNueysqnsun
pue yeam aie epeut y! suaUBpnr ‘snd9 Ul moweU
1 YoIym Uossnosip paliuil e seplnoud ayepIpUeD aL
Papinoid 1x9]U09 aug 0} Sulpueysipun pue
eBpayouy pauinboe Aidde 0) wen peyuul| e sexeU
aiepipueo 24 “SeioeinooeU! Auios SuleyUOD pue oISe¢q
SI eua}ew aij ‘uondAioue oujeuwitse pue oujeuLUAS
ua@mjeg souasoyyip ay) pue uondAroua wiapow
ebpaymouy oiseq e SeyeiisuoWsp ejepipued oy,
(sysew ¢-1) }2A97 Mo7-| pueg YEW.
‘ouapina auios Aq payoddns pue yuenajel
‘ved ysou auy ul si pajuasaid uojeWioju! ayy “ainjons
‘alos YI paluasaid BujUoseas jo ull e S| e104],
Passi a1e yuaLudojanap Jo} sanlunyoddo
‘ony 10 9u0 YBnouye ‘ayeudoidde ped ysou au) 10},
‘ale sjUaULOD eANjen|ery ‘pasnoo) S| YoIYM Jo AyUOfew
uy ‘UoIssnosip punos e sapinoud ajepipueo ouL
‘eoueping
ew
Temsuy
WoRsaND |
ghoz eunr
ewoyos en,
LoisAN
we
(e10v)
eo L LEbbbLue |
iow
oe 1 LOOLL LOL af
quauodxe 10} yew | 'essUeU! JO HEN L
(0010 00001
quouodxe 10} yew | 'essAUEU! JO} YEN |
(tow)
y 0000 00140 ®
ExeN = Fed WENT. |
szz 1 anjen-
(tow) 10°010 seuioseg essqueyy-
£ Z si quauodx3- p
OST WIP Oma ISET BU JO WENT
(Lov) (2¢ °81) SUBIP omy ysuy OU JO} WEI
z SOLE 2 |
weW | Vansuy > — oLTOTOOT
‘Set OU ‘pazetno|eo pue ALeusp 0} payaAuod J| TOOTILOO
(z1ow) TIT test
‘umous SHEN L 's1Iq pamouog > 220
Bupjiom yn pouyau pilen JoYjO Aule Joy SHEL Z MOY z L 4
(Lov) wen | “Siig Aueg > TUITrr |
z EW L FoMsUY > —_TO0TOTOT el 6
soueping | ve JaMSUY onsen
g1oz ounr awayos EW LoisreH