You are on page 1of 4

l5y L>e-velop p sem.

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."•

trn .-'\c,·ept rhe value. ( 2 marks•

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:

(i) Prompt the use.r to enter an int~ger ( J mark

(ii) Read the integer and store in vurinhlc N ( J ·mark

(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

b) not. ze1,1 (0), n1ultiply N by 2 (N*2) and place the result in Y


( 3marks)

(v) Print the anS\vcr ( Y). (lmark }

(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:

(a) Prompt a user to enter an integer value ( 2 n1orks)

Cb) Store the value in a variahle 11nm ( 2 marks)

(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:

THE OUTPUT IS VERY LAR.GE ( 4 mark.!)

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 .

1 valu e I, value2: integer;


2 Min imu m: real;
3
4 val ue! = 30;
s valu e2 = 25.9;
6
7 IF (val ue I> value2)
8 TH EN read ('M inA is', value2)
9 ELS E wri teln ('M inB is', value2);
10

(a) Write the line num bers that contain code


to identify

(i) inpu t (l mark )

(ii) dec lara tion (2 marks)

(iii) output. (l ma rk)

(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

You might also like