You are on page 1of 3

1a)

b)

Correction read(table1[i,j]) readln;/delete writeln; read(table2[i,j]); table2[i,j]):=table2[i,j]+table1[i,j]) begin for j:=1 to 4 do write(table2[i,j]:3); writeln end writeln(table2[i,1],table2[i,2,],); program Q1b; var P, RAMT, I, N, FLAG : real; begin readln(P); readln(RAMT); readln(I); /readln(P, RAMT, I); 3 N:=0; FLAG:=0; while FLAG=0 do begin P:=P+P*I; if not (P>RAMT) then FLAG:=1 else begin P:=P-RAMT; N:=N+1 end; end; writeln(N+1:4:0) end.

Line 100 120 180 190 245 246 250 255 256

1 1 1 2 1 2 2 2 7 1 1 1 1 1 1 1 1 1 1 1 1

/if P<= RAMT then

1 1 all correct

2a) NUM=5/ 130 NUM=5/ 130 2 b) set all elements of the two-dimensional array Bin to zero/initialize or all c) 100 times/ 100 2 d)(I) I Key 3 3 1 4 0 1 5 5 1 (ii) after pass 1; 20 23 43 15 37 .5 mark for each appropriate postion. 1 all correct e)(I) I 3 4 5 (ii) Inputted integer 37 23 43 20 15 (iii) After pass 2: 15 20 23 27 43 CS99IIMARKINGSCHEME Location in Bin where the integer is stored Bin[3,1] Bin[2,2] Bin[4,1] Bin[2,1] Bin[1,1] 1 all correct 1/3 Key 4 1 3

1 1 1

1 1 1 1 1

f)

3a)

b)

c)

change line 120 to : 120 const Digit=3; 1 change line 350 to: 350 2: Key := (Data[i] mod 100) div 10;/ 1 Key := (Data[i] div 10) mod 10; add line 355: 355 3: Key:= Data[i] div 100; 1 procedure init(var b:boxarray); var i :integer; begin for i := 1 to 6 do 1 b[i] :=2 1 end; 1 all correct procedure rules (var b:boxarray; num: integer); begin b[num]:=b[num]+2; 1 case num of 1: begin b[6]:=b[6]-1; 1 b[2]:=b[2]-1 end; 6: begin b[5]:=b[5]-1; 1 b[1]:=b[1]-1 end; 2..5 begin b[num-1]:=b[num-1] -1; 1 b[num+1]:=b[num+1]-1 1 end end end; 1 all correct procedure displaybox(b:boxarray); var i :integer; begin writeln('Box # : 1 2 3 4 5 6'); 1 write('Value : '); for i := 1 to 6 do 1 write(b[i]:3); writeln end; 1 all correct function endgame(b:boxarray):boolean; var I:integer; flag:boolean; begin flag:=false; 1 for I:=1 to 6 do 1 if b[I]<0 then flag:=true; 1 endgame:=flag end; begin init(box); displaybox(box turn:='Player' 1 1

d)

e)

CS99IIMARKINGSCHEME

2/3

while not (endgame(box)) do 1 begin if turn='Player' then begin writeln('Press <Enter> to roll the dice. '); readln end; n:=random(6)+1;/n:=trunc(random*6+1); rules(box,n); writeln(turn,' rolls a ', n,'.'); if turn='Player' then turn:='Computer' else turn:='Player' end; writeln(turn,' wins.') end. 4a)

1 1 1 1

WAN is needed to: communicate with systems in other shopping companies(overseas) share/exchange the data with other remote systems (overseas)

1 1

b) c) d)

e) f)

g)

LAN is needed to communicate with other workstations(local) 1 share system resources / exchange data on the same site(local) 1 use a portable barcode reader to read data on labels/remote/wireless/infrared 1 (appropriate device) 1 split DM into 3 fields to store the length, height and width 2/0 Moving the existing system: pros: reduce cost 1 cons: system migration will suspend operation 1 Installation a new system: pros: suspension of current service is avoided/existing system can be used as backup 1 cons: higher cost/need time for development and testing 1 feasibility study to identify problems and benefits in developing a new system 1 carry out system analysis and system design of the new system 2 parallel conversion: pros: thorough testing assured the accuracy and reliability of the new system 1 cons: double the manpower and operating cost to maintain both systems running simultaneously direct changeover: pros: cost and time savings 1 cons: risk of system defects/bugs, new system may not be working correctly 1 for system recovery 1 for system security audit 1

CS99IIMARKINGSCHEME

3/3

You might also like