CS P2-Mocks
CS P2-Mocks
Rehan |671|
CANDIDATE NAME: Adeena STUDENT ID:
0478/22
COMPUTER SCIENCE
|7 Mar-2024
Paper 2 V2 Algorithms, Programming and Logic
Candidates answer on the Question Paper. Obtained
No Additional Materials are required. Q.no. Marks Marks
No calculators allowed. 2
1
INSTRUCTIONS 2 4
" Use a black or dark blue pen. You may use an HB pencil
for any diagrams or graphs. 5
Moderator's Signature:
JEDDAN
Exeellence Ia Educetien
Invigilator's Signature:
Exam Depart:nent
or egualto 3 .F o uprs e u d o c
(/)one one
1. a)Tick Draw
N oa
t lp
l se
(a)
A OR
<
B
<=
procedure.
be passed to a
() one box to
show howa value can
b) Tick
A function
B parameter
returm
subroutine [1]
datathat could be used to
data and one pjece of erroneous test
Z. Give one piece of normal test
validate the input of an emailaddress.
State the reason for your choice in each case.
[4)
Y10-CS 0478 Mock Exam-2023-24 P2V2
JIDDA
3
(a) Draw one line to link cach pseudocode statement to the most
appropriate pseudocode use.
Not all pseudocode uses will be required.
Pseudocode statement
Pseudocode use
CALL Colour (NewColour)
counting
Value (A1 + A2 + A3) / 3 finding an average
totaling
Loop1 t Loopl + 1
using a conditional
statement
IF Count > 7 THEN X1 0
using a procedure
[4]
.spesits...ar.....ogramn,..a.broughout....he...proqam..
h..wale.Ldata. stoud within .a..ariade..can...chag.haout,..the. ..n.pram.
Constant....constan.s....*Aningtel..dentihr..in..prog a m.
which.. stoEs.apeati..latasncd.ays...onsisteat.thnughou.
the -prgam..E does....no.varg...a.. al.
14]
I N T ENATION,
A
lion
Exrellencela duce
(a) ldentify the four errors in the pseudocode and suggest corrections.
Error 1 ......5.
Correction REPEAT.
Error 2 o7
Correction ..JNPUT.Gity.Cont,.1]..
|2
Error 3
Error 4
[4)
SCHOO,
JEDDA
Y10-CS 0478Mock Exam-2023-24 P2V2 Excellence la E ducetion
Ex:nDenrnent
5
name of a
to the corrected algorithm to allow the
(b) Describe the changes you should make
stored cities from that country.
country to be input and to display only the
Youdo not need to rewrite the algorithm.
city, .using. variables.
lWe..ull .ouLpo.the..name...the.
...he...ename....the..coUny.s..entered.in. CCount,2]..as inine..
04
the variahle ount to..output the....
then..we......4N,. USe
ás....... ..wod..betonespondng.
3....h..y..ame... Can be taken as.
Inine. ......
thou ghat......rgTArt:.
..
while
Difference 2 local.. yargbles. are...made...doring..he..program.
[41
ExamDepart:nent
6
START
successful y.
Accept c 0
Reject + 0
INPUT PartOK
No
IS PartOK Reject + Reject + 1
= 'Y!?
|Yes
Accept Accept + 1
No
IS Accept
= 10 ?
Yes
IS Reject Yes
> 1? Error
Reject/Accept * 100
No
OUTPUT
QUTPUT "Too many rejected
"Success" Error, " error"
STOP
INTE
(a) Complete the trace table using this data:
33$ N
NTER
NATION
N
JEDDAN
Excellence Ir fduce tion
Exnn Depar.nent
Too many rejected
20 7. error.
[5]
(b) Describe how the algorithm should be changed to accept Yor 'y' for a successfully
manufactured part.
As Soon .4s..h..inpu...is.laken.th UCASE Funcion can
[3]
02 Reading[Count] 0
03 NEXT Count
04 Count 1
06 INPUT Value
07 REPEAT
11 ELSE
14 ENDIF
15 IF Count <= 50
16 THEN
18 IN PUrYalue.
19 ENDIF
JEDDA
Excellence In tducetion
9 Consider the logic expression
(a) Drawa logic circuit for this logic expression. Exan1 [Depart.ncnt
Each logic gate must have a maximum of two inputs.
Do not simplify this logic expression.
N
B
(b) Complete the truth table from the given logic expression.
N
A B C Working space
0 1
1 1
1 1
1 0
1 1 1
where black
(SQL)
the lower statement:
birds
ellce are halE
TLONA,NTE
JEDDAIn
t
dwcerian 008)> [2]
[4]
Y10-CS 11.
The For The and The quotation:array
DELARE R.
.RLength.0.
kenge.l.. You voutput
store Mnput
theVcalculate theVoutput Vinput
calculate Write type The Quotations]
koom. inputsAll You done. You mustcontinue check " " "
do calculated room choice
woodexample,index rom floor price length
" area" width
0478 Widh.0... wil aand data Customers). A
not all the
the an
a WOod
and need use to
that newprogramprice are
choices
measurementsof
measurements of of of of of
Mock th
data choicee theerroreach any
to
outputs pseudocode
need accept customer's stored a wood woodwood room room
price price
in areacustomer's in flooring
:"STRING"
Name initialise to the message that their customer A
xam-2023-24 of
measurement availablecustomer's requiredrequired (one (one
declare of of of Index index
must
the relevant wood 3 2 1 two-dimensional
the the the meetsarrays two in
decimal company
WoodType[] quotation
next must(room decimal
contain or wood wood and room and name, 1D are: named data (whole
in
(rounded
any customer. e
thshare
program array find arrays be dollars
length
arrays needed requireby room isfollowing stores
P2V2
required to Wood
type between
number) place)place)
TPice .9.-Room..9..
Wood.Choice. its
multiplying valid the Laminate inthe is
up
.. loomHrea osutable and include: named Oak Pine index and (two
or
code price the length same same to
(2D) the
Pricel]
variables; measurement requirements: 5 decimal next
4 1.room
per
arraynames
messages. and the and WoodType] index in
of and
square together both whole 12
add name room Quotations]
number.
Customers/] 10.0width)places). of
you Price up
comments of metre the width arrays. are number)
may to and inclusive. to
the taken
length be per 100
assume customer, Price[]. corresponds stores
re-entered 54.99 39.99 29.99square in
woodPriceTotal-
&o to of customers
explain the The metres. details
that the metre
room until index
this hoW choice to All oalnsioneendim- (1D) ina
of
and it ($) the each
has your is of floors
the valid the data
already of customer's
code wOod width wood are
in
index
rectangles
works.
been and of
4
of
JEDDA
ISTANN,
NTER
TIONA,
..... wHILE
CoPLS Price.L23s
S29.q9
39.44 Pricel1]CJsLaminate
Wood Abod lNoygeod
Y10-0S
OUT
Tape ype
UNTIL INPUT INPUT
REPEAKe04 Name
0478 REPEAT
Room.Lengt.s.RoUN!
ENSIF
IFRomLeng OUT PUT
LSl- [21<
I/UNTIL PUT Roorm
INoUI THEN Customers /
Mock ENOIF OUT OT
RoomidHhoR sa).5IE Room INPUT
S Ronwidth Keom,
THEN PUT efRoom- Enter "Oak""Ping"
-2023-24 "IANalid
OUTAUT length Plea
WidthR-width Length
Lengt.
Enter Rasm t Length se name
OUTPUT"d < is enter
*Rootwidt width ,
RoUNO he ]:5 ot to is
P2V2 A o t t a n rtnter C....0Unaling.to..4..decim ls
KLength 1) room your.nan.. be to
\nvalia(Ruidth, idh AND.Room-Length.
Room.Length
lo.00 OR be
Room.width lo.00
AMD measurenents.re-ent.. input,
Room-width of taken 13
orements,
meas
1) the rounded
rom input
0.00 al to1
place lo.00
***.
deima
and
place.
validation
andwaliduted
n ErrrlEllseoerinceenIa
JEDDAM
Y10-CS
ENDIE. ENDwHILE.
IE..Customers....loo4.
OUTPUr"
wocd0UTPUT.
OUPUCustom Quotatians
Qucta Quotation
THEN Qotition!3...Kon-Length.
Quotations..El9,Stoing.
Calculating...he.
IPrice.s.Rom-Area.Price.btalwWad [und. OUTPUT" **..*..
0478 1/ UNTIL ENDIE.
....eking....n.pu.... REPEAT
INPUTchaise..f..
tions OUTPU Rom-eUPUI Reom
Mock loo, Lloo, s THEN
hechasen.4A.e.isi.y..ocl The Lloo,
Pice.....RoUNSCI wod-Choe
Wod.Choic..<...0R
Choie....3. Areg
Lloo the. Price...of...wocdis"
wbod- bdade Area.RoUNPfA-Ro/
A.lam
Custoners.e.
2023-24 s] 2] k
4]bPe.Wd-Chice
er..Name...is.44stoer
ota!prige l]. 3] OUPUTEnter.....494....
4 data.in..the..anay heice ROuNDUP k
>=1
Total. Room Rcom ROUN Reom
total
-width
.Ne...cwthin (A-Room)
P2V2 AND Leng
WoYice .Pris..c.swoocl...and.undns..
rea Pie,deimal..plae 2 (WodChoice,.O). choiwsodce ef
he Prie th
sood. Wacd-Choje..
2.)... [ubd-Choice Room
rarge. Room
is:Total. and.fnding..pre.
wood
3. Width. Aea. 14
erter numbers
mhdlein
yp..Load. J. valve
calulation
ubd
betwpen
Pice.Choicg,. randina....neat.bwhole
nvbe
end.
ence
DDAM
la and.3" 1
duca
tiem