Professional Documents
Culture Documents
k~odc and cltcn Lran,lare the ps('udocode to a srnKtun~d language for the:- fnll r,\vm_2
, equeoce of ~tep:-..
(~, Prompt the user for a value. :'\m1<:,unce that th.is value is a bid b~1nµ placed on a
~·aluable artifact ·· a 1751 antique v.:arch. ( 2 man."•
Con1pare the v81uc ,·eccivcd fron1 the user \•:ilh the 1ninirnu:m price of the item _ a
value rhaf' you have a!-: a part of your prograrn (antique watch .... 7 .000;. ( 2 marks)
td ) Indicate ro the user if his bid ha~ been successful (if lb~ bid is higher tJ1an the mi11imum
ii is a successful bid) .. lf the bid i~ not t,u~ces~ful tndacate lhal al~o. ( .i n,ark~,
Total 10 nmrks
11. (a) tn rt!pre.scnt the following algorithu1:
(iii > Divide the nu1nbcr by 2 and store the ren1aindcr in variable ANS ( J mark _
(iv) If ANS is
a) xero (0), 1nultiply N by itself (N*N) and pJace the result in variable y
(h) Calculate and \\-Tite the value that will be printed if the nurnber input is 13.
( 1 lmlriL )
Tutal8mad s
13. Write a stn1ctured progran1 using the following algorithn1:
(c) Multiply nont by num . and put the result in num~qr ( 2 mark~J
(d) Print the result if it is le~s than or equal to l 000. Othcrw i~o~ print the following me~sage:
Total 10 marks
12. (a) Exp lain the diff eren ce betw een a 'syntax.
erro r' and a 'log ic erro r' .
(l mar lu) 1
(b) Exp lain the diff eren ce in the exec utio n
of the TW O line s of cod e writ ten belo w:
(i) Lin e 1: If MA RK > 50 The n prin t "Go od"
(1 ma rk)
(ii) Lin e 2: IfMARK. >= 50 The n print ..Day ''
(1 ma rk)
( c) The num ber 50 was the valu e for MA RK.
{i) Stat e the line num ber corr espo ndin g to the
abo ve cod e that wou ld prin t a resu lt.
(I ma rk)
(ii) Wri te the resu lt that wou ld be prin ted.
(1 ma rk)
Tot al 6 mar lu
13. Ans wer the que stio ns belo w usin g the foll
owi ng part of a prog ram .
(b) The pro gra m contains FOU R errors. Fo.r EAC H erro r write the line number and the)
corr ecte d line of code. (4 m ■rlu