ZXTape! 2 !O-Level Computer Science - Side B GCE Tutoring1984English EducationalUnknownNoneOriginal;TZXed by Andrew Barker For Gary Poole Released August 1984ch5 _.m8kh$(20,32 ):t$(7,7,16,32 ):w(25,8):5000:2000 ch5  G C E Tutoring  Aug 1984 6:6:0:  r(10 ) t(5):9069m# Lscrhdr=9300T$:qsthdr=9350$:endsec=9400$:getans=9450$ fig2=8950":fig=9030F#:axes2=9000(#:eg=9040P#:axes=9100#:triangle=9150#:diagram=218:praise=9720% 5br=8100:squrec=8850":squpar=8900" ?:"COMPUTER STUDIES help ch5"::"PROBLEM SOLVING TECHNIQUES" :" GCE Tutoring Aug 1984" 2z:"Hello, what's your name ?":n$:n$:"OK, ";n$;",":"I'll begin by telling you how touse this computer studies tape." 4q:"This tape covers 4 subjects which all come under the headingof effects of problem solving techniques." :>:"Press the key marked C so I can type the next screenfull" <a$=:a$="c"62> = 60< >:z=1100d:z AF:"Thanks. From now on when I want you to press the C key, I'll say" D:" Hit C to continue" F1:"Here's the list of subjects on this tape": Hq"writing a program structured analysis diagnostic aids documentation" K2:"Which subject do you want to try ?":s$: Lc$=s$ N'(s$)>3s$=s$(13) Ps$="wri"200 Rs$="str"400 Ts$="dia"600X Vs$="doc"800  _ 70F c     x=15 z=116 t$(1,x,z) z scrhdr x ,qsthdr 19"What is the first stage in writing a program ?": 6 a$:a$ ;Da$(12)="br"a$(12)="Br""OK":325E @,"No. You first break down the problem." E9"What is the last stage in writing a program ?": Ja$:a$ OIa$(12)="de"a$(12)="De""Correct":345Y T$"No. Debugging is the last stage." 2start=200:return=398:n$=c$:endsec       x=14 z=116 t$(2,x,z) z scrhdr x qsthdr O"What is the structure that structured analysis gives to a problem ?": a$:a$ Na$(12)="Tr"a$(12)="tr""That's right":525  $"No. It gives a 'tree structure'."  !"Structured analysisallows :": "1. a group of programmers to work on one problem 2. The partioning of a problem into simpler sub-units. 3. Both of these." 4egc=3:exp=3:return=540:getans U2start=400:return=598V:n$=c$:endsec V X Z ] ` gx=14 lz=116 qt$(3,x,z) vz {scrhdr x qsthdr 2"How many stages does debugging consist of ?": 4egc=3:exp=2:return=715:getans V"Printing instructions and data at points throughout a program is called ... ?": a$:a$  a$=a$+" " Da$(12)="tr"a$(12)="Tr""OK":735 "No, it is called tracing." f"One technique of error etection is to print the entire contents of storage. What is this called?": a$:a$  a$=a$+" " a$=a$(12) 8a$="Du"a$="du"a$="St"a$="st""Correct.":755 "No, it is a 'storage dump'." 2start=600X:return=798:n$=c$:endsec    " % ( /x=14 4z=116 9t$(4,x,z) >z Cscrhdr Hx qsthdr 3"What are the two types of documentation ?" a$:a$ ="The algorithm a program uses is likely to be found in :": W"1. user documentation 2. technical documentation 3. both of these ?" 4egc=3:exp=2:return=925:getans 2start=800 :return=998:n$=c$:endsec      x=17 z=116 t$(5,x,z) z  scrhdr z Lqsthdr QE"A spelling error in English corresponds to which of these ?": VU"1. lexical error 2. syntax error 3. semantic error" [5egc=3:exp=1:return=1120`:getans `E"A grammatical error in English corresponds to which of these ?": eU"1. lexical error 2. syntax error 3. semantic error" j5egc=3:exp=2:return=1135o:getans oE"An untrue statement in English corresponds to which of these ?": tU"1. lexical error 2. syntax error 3. semantic error" yU"1. lexical error 2. syntax error 3. semantic error" ~5egc=3:exp=3:return=1155:getans 4start=1000:return=1198:n$=c$:endsec     x=17 z=116 t$(6,x,z) z scrhdr  u3start=400:return=1398v:n$=c$:endsec v x z }  =4start=1400x:return=1598>:n$=c$:endsec @ B H Jh$(18): 4start=1600@:return=1798:n$=c$:endsec       h$(19): 4start=1800:return=1998:n$=c$:endsec   x$="": o=1̱x$ n=18 #w(o,n):x$(oo)+n-1,w(o,n) n o  H24,16,16,32 ,16,16,24,0 C24,8,8,4,8,8,24,0 F0,0,62>,64@,64@,64@,62>,0 E0,0,124|,2,2,2,124|,0 G0,66B,66B,66B,66B,66B,44,,0 G0,44,,66B,66B,66B,66B,66B,0  G0,0,60<,64@,124|,64@,60<,0 I240,8,120x,128,248,0,0,0 C0,0,0,4,126~,4,0,0 I248,136,136,136,0,0,0,0 C4,4,228,4,0,0,0,0 G240,8,240,8,240,0,0,0 G28,20,16,16,8,8,40(,568  E4,68D,228,68D,0,0,0,0 "G16,16,16,0,0,480,72H,480 %E12 ,18,18,12 ,0,0,0,0 (E7,4,4,8,8,144,80P,32 *G4,8,16,16,16,32 ,32 ,32 ,G32 ,32 ,32 ,16,16,16,8,4 /C32 ,16,8,8,8,4,4,4 2C4,4,4,8,8,8,16,32 4   save screen  ptr2=0 z=16384@22528X ptr=z-16383? data=(z) Jdata0ptr2=ptr2+1:j$(dgnum,ptr2)=(data):k(dgnum,ptr2)=z z    !fetch screen $ &z=16384@23296[ (ptr=z-16383? +data=(j$(dgnum,ptr)) 0z,data :z D N S fetch fast X 3200 Yx=16384@23296[ Z x,((addr)) ]addr=addr+1 `x b  fetch screen bits   z=1pxnum k(dgnum,z),(j$(dgnum,z)) z    save arrays   "text"t$() r  z=31000 %v=((z^2-(z-1)^2)) u=v^0.5 C((u)-(u+0.5))<0.01z# =z;":";z-1;":";v^0.5 z    start  !7,10 ;"PLEASE WAIT"  ""t$()  41:7,9 ;"STOP THE TAPE":0  300,   #( #2K27,41):110n,0:27,41):0,557 #:]17,3;"0":17,6;"2":17,9 ;"4":17,12 ;"6" #<17,15;"8" #>\16,2;"0":14,2;"2":12 ,2;"4":10 ,2;"6" #A #Fi579+x,513+y:20,20:-20,20:-20,-20:20,-20: #Hc72H+x,568+y:0,30:-30,0:0,-30:30,0: #P'"Here is an example of ";n$ #R #Z #\ #_noises #b #d-z=120:0.01z# =,-24:z #f #h #i&z=15:0.3,t(z):z #l #mz=15:t(z):z: #n*7,9 ,5,-7,0 # # # # axes(atype) # #_30,90Z:210,0:30,90Z:0,557:0,-110n #10 ,2;"0" #f11 ,9 ;"90":11 ,15;"180":11 ,22;"270":11 ,29;"360" #atype=09124# #atype=19130# #.4,2;"1":16,1;"-1" #07,1;".5":13 ,0;"-.5" # #.7,2;"1":13 ,1;"-1" #.4,2;"2":16,1;"-2" # # # #draw triangle(label) # #N30,60<:100d,0:0,60<:-100d,-60< #label=09175# #15,6;"adjacent" # 8,1;"hypoteneuse" #11 ,18;"opposite" #6123{,60<:0,7:7,0 #H41),60<:0,2:-3,2:-2,0 #14,2;"A" #14,17;"B" #6,17;"C" #::::::::: # # # # # replies() # #':9210#+((*6)+1): #"Berk ! What's ";c$;" ?": #'"Wally ! ";c$;" isn't on the tape.": ##"Moron ! Try spelling straight": #"sorry, ";n$;" ? ": #"Are you tired, ";n$;" ?": $"Don't wind me up, ";n$: $T $V scrhdr() $Y $\9900&:: $ $ qsthdr() $ $'9600%:9900&:egc=0: $ $ $endsec(start,c$) $ $5"That finishes ";c$:"Hit r to repeat this section" $ 9900& $a$="r"start $return $ $ $getans(loop,exp) $ $?dp=0:err=0:u$:u$:(u$)>10 err=1 $(u$)=09460$ $[j=1̱(u$):(u$(jj))<45-ů(u$(jj))>579ů(u$(jj))=47/err=1 $%9480%:j:u$="-."err=1 $Cerr=1dp>1"type the answer as a number":9460$ $=ans=(u$):(exp-ans)>0.005y# ="No, the answer is ";exp $$(ans-exp)0.005y# =9720% $return $ % %$(u$(jj))=46.dp=dp+1 % ,j>1Ư(u$(jj))=45-err=1 %  %k9800H&:d1=r(1)/10 +r(2)/100d+r(3)/1000:dec=d1:int=1000*dec %& %A"See if you understand this by trying the following examples" % 9800H& % %"True or false ?" %a$ %a$ %a$"t"a$"f"9650% % %n:n;"/";:d:d: % 9630% % % %praise % %%9720%+((*9 )+1): % "Good": % "Correct": %"Right again": %"OK": %"That's it": %"Brilliant !": %"Well done": &"Very good": &"Genius !": &HWz=110 :r(z)=(*9 )+1:z:r(1)r(2)9800H&: &R#r(1)r(2)9800H& &\ &z "trap": & &"Hit C to continue" &a$= &a$="c"9950& &a$="r"9950& & 9920& & &z=1502:z & 32&crhdT$sthd$ndse$etan$ig"iF#xes(#P#xe#riangl#iagrarais%qure"qupa"gtareturxr$nU3ȅ  >@@@>||BBBBB,,BBBBB<@|@<x~(8DD0H0  P    b WRITING A PROGRAM Writing any program consists of roughly 5 stages: 1. break down the problem 2. choose a suitable language 3. identify common areas of the problem (these will form functions, procedures and subroutines 4. code the program 5. de-bug the program Breaking down a problem can be done using flowcharts or other methods. This will reveal the nature of the problem, and therefore the suitability of various types of languages. It is quicker to write a program in a high level language than in assembler. However, programs written in assembler run up to 1000 times faster. This can be important if a lot of processing is involved. There are several types of high level languages: 1. languages like BASIC, which are easy to learn, but do not allow complex programs to be written clearly 2. languages like Pascal. They are usually compiled, and so run faster than BASIC, which is interpreted 3. special languages such as LISP and SETL, which handle lists or sets directly When you are learning to program it's best not to use a language you are unfamiliar with, even if it means using an unsuitable language. If you write a program in BASIC, extra effort should be put into making the program clear. Try to avoid "GOTO" instruction where possible, and use plenty of "REM" statements, so that it is easy to see what each part of your does. STRUCTURED ANALYSIS Analysis is the study of a problem prior to taking some action. Structured analysis overcomes problems of size by an effective method of partioning. Structured analysis allows a 'top- down' approach, whereby a problem is broken down into a small number of sections, and further sub-divided into sub- sections, within each main section. This division produces a 'tree-structure'. Each section represents a piece of code sufficiently small enough to be written without further sub-division. This technique makes the writing of very large programs possible by a group, as each programmer is responsible for one small and well defined part. Here is an example of a task divided into simpler sub- units, using structured analysis : how to make coffee : 1. boil some water 2. put coffee inside a cup 3. add boiling water 4. add milk Each of these operations are then further sub-divided. This process is called "refining". Here is an example of one operation further refined. 1. boil some water 1.1 put 500ml of water in a kettle 1.2 plug the kettle in 1.3 switch the kettle on 1.4 wait until the kettle switches itself off Try refining the other steps. DIAGNOSTIC AIDS Computer programs frequently contain errors when originally written. These are called 'bugs', and the process of finding them and correcting them is 'debugging'. This is done in two stages : 1. "desk debugging", which involves hand checking 2. "machine debugging", which involves testing modules of the program on the computer To find individual errors, tracing is used. Tracing consists of printing the instruction performed and relavent data values at points within the program suspected to contain a bug. Tracing is achieved in high level languages by inserting "PRINT" statements (or their equivalent). Another error finding technique is to force a halt following an error, and then printing the contents of storage. This is called a "storage dump". A machine code program is particularly hard to de-bug, as : 1. it is very cryptic 2. it can be changed, unknown by the programmer, by a bug in the program The second problem can be very serious if undetected, as it will almost certainly change the behaviour of the program the second time it is run. A solution is to use an emulator. This is a program, often written in a high level language, which simulates the machine code ultimately required. Although it will run very much more slowly than the actual program, it can provide useful information, such as the contents of every register after each instruction. Another ability of an emulator is to allow the programmer to execute one instruction at a time, watching its effects. DOCUMENTATION Program documentation comes in two forms, suitable for two different categories of user: 1. Technical documentation This explains how the prog- ram works, and how to modi- fy the program. 2. User's manual This explains what the pro- gram does,and how to use it Technical documentation is written in complex language. It corresponds to the workshop manual of a car, in that the general user does not need either the documentation or the ability to understand it. The user manual must be written in non-technical language so that the general user can understand it. Typical technical documentation might consist of the following: 1. a description of the problem 2. the algorithm/s 3. an annotated program listing 4. example results 5. error checking 6. bugs (if any) Typical user documentation might consist of the following 1. what the program does 2. how to run the program 3. explanation of menu options 4. details of commands 5. error messages In the 1960's, the teletypewas the standard input/outputdevice used with computers.From the late 1960's, the VDUbegan to take its place,graphics characters could nowbe used increasing the uses ofcomputers. Graphics charactersused in conjunction with thelight pen, a device thatallows free expression,simplify the operation ofprograms. In the past few years, speechoutput has increased in sophistication andconsequently is greater used. Input/output hardware hasdecreased in size to the sameextent that other hardware hasdecreased in size to the sameextent that other hardwarehas, resulting in speechoutput circuitry being used incalculators and even watches,as well as in more generalpurpose computers. Speechinput is still very limited,mainly because of thecomplexity of the programsneeded to interpret it. One word commands can beunderstood by a computerrelatively easily, but the structure of a sentence ishard to define withoutextensive contextualinformation. Teledata and teletext serviceswill allow thedecentralisation of officework bringing many benefits.An average of two hourstravelling time could be savedon each day, and the finalsaving due to the reducedcommuting would benefit thecountry economically andecologically. Teletext willalso allow a more convenientform of shopping from homethan mail order does atpresent and X 5  SwriCwriNwriAcY ch6 };.kh$(20,32 ):t$(7,7,16,32 ):w(25,8):5000:2000 ch6  G C E Tutoring  Aug 1984 6:6:0:  r(10 ) t(5):9069m# Lscrhdr=9300T$:qsthdr=9350$:endsec=9400$:getans=9450$ fig2=8950":fig=9030F#:axes2=9000(#:eg=9040P#:axes=9100#:triangle=9150#:diagram=218:praise=9720% 5br=8100:squrec=8850":squpar=8900" 2:"COMPUTER STUDIES help ch6"::"file handling" :" GCE Tutoring Aug 1984" 2z:"Hello, what's your name ?":n$:n$:"OK, ";n$;",":"I'll begin by telling you how touse this computer studies tape." 4W:"This tape covers 4 subjects which all come under the headingof file handling." :>:"Press the key marked C so I can type the next screenfull" <a$=:a$="c"62> = 60< >:z=1100d:z AF:"Thanks. From now on when I want you to press the C key, I'll say" D:" Hit C to continue" F1:"Here's the list of subjects on this tape": Hu"file structures organisation of files processing files security of files" K2:"Which subject do you want to try ?":s$: Lc$=s$ N'(s$)>3s$=s$(13) Ps$="fil"200 Rs$="org"400 Ts$="pro"600X Vs$="sec"800  _ 70F c     x=13 z=116 t$(1,x,z) z scrhdr x ,qsthdr 10"Structured related data is called a ?": 6a$:a$ ;&a$="file""That's right":325E @"No. It is called a file" E$"An inventory file might hold :": JU"1. 1000 records 2. 1000 characters 3. 200 characters" O,egc=3:exp=1:return=340T Rgetans 2start=200:return=398:n$=c$:endsec       x=14 z=116 t$(2,x,z) z scrhdr x qsthdr 5"If a file stores data about carsis the object :": T"1. car 2. model 3. engine size ?" 4egc=3:exp=1:return=520:getans 8"If a file stores data about carsis the attribute :":  T"1. car 2. engine 3. engine size ?" 4egc=3:exp=3:return=535:getans <"If a file stores data about carsis the key attribute :": T"1. car 2. model 3. engine size ?" !4egc=3:exp=2:return=550&:getans U2start=400:return=598V:n$=c$:endsec V X Z ] ` gx=12 lz=116 qt$(3,x,z) vz {scrhdr x qsthdr D"The record storing information about a file is called a ... ?": a$:a$ =a$="label"a$="file label"a$="File label""OK":720 ""No. It is called a file label." 5"Nowadays, even small computer systems store :": X"1. about 10 files 2. over 100 files 3. about 10000 files" 4egc=3:exp=2:return=735:getans 2start=600X:return=798:n$=c$:endsec    " % ( /x=13 4z=116 9t$(4,x,z) >z Cscrhdr Hx qsthdr \"Three possible ways to categorise people that have access to a file are :": \"1. system, group, user 2. read, write, execute 3. system, user, execute" 4egc=3:exp=1:return=920:getans 0"Three possible operations on a file are :": \"1. system, group, user 2. read, write, execute 3. system, user, execute" 4egc=3:exp=2:return=935:getans 2start=800 :return=998:n$=c$:endsec      x=17 z=116 t$(5,x,z) z  scrhdr z 4start=1000:return=1198:n$=c$:endsec     x=17 z=116 t$(6,x,z) z scrhdr  u3start=400:return=1398v:n$=c$:endsec v x z }  =4start=1400x:return=1598>:n$=c$:endsec @ B H Jh$(18): 4start=1600@:return=1798:n$=c$:endsec       h$(19): 4start=1800:return=1998:n$=c$:endsec   x$="": o=1̱x$ n=18 #w(o,n):x$(oo)+n-1,w(o,n) n o  H24,16,16,32 ,16,16,24,0 C24,8,8,4,8,8,24,0 F0,0,62>,64@,64@,64@,62>,0 E0,0,124|,2,2,2,124|,0 G0,66B,66B,66B,66B,66B,44,,0 G0,44,,66B,66B,66B,66B,66B,0  G0,0,60<,64@,124|,64@,60<,0 I240,8,120x,128,248,0,0,0 C0,0,0,4,126~,4,0,0 I248,136,136,136,0,0,0,0 C4,4,228,4,0,0,0,0 G240,8,240,8,240,0,0,0 G28,20,16,16,8,8,40(,568  E4,68D,228,68D,0,0,0,0 "G16,16,16,0,0,480,72H,480 %E12 ,18,18,12 ,0,0,0,0 (E7,4,4,8,8,144,80P,32 *G4,8,16,16,16,32 ,32 ,32 ,G32 ,32 ,32 ,16,16,16,8,4 /C32 ,16,8,8,8,4,4,4 2C4,4,4,8,8,8,16,32 4   save screen  ptr2=0 z=16384@22528X ptr=z-16383? data=(z) Jdata0ptr2=ptr2+1:j$(dgnum,ptr2)=(data):k(dgnum,ptr2)=z z    !fetch screen $ &z=16384@23296[ (ptr=z-16383? +data=(j$(dgnum,ptr)) 0z,data :z D N S fetch fast X 3200 Yx=16384@23296[ Z x,((addr)) ]addr=addr+1 `x b  fetch screen bits   z=1pxnum k(dgnum,z),(j$(dgnum,z)) z    save arrays   "text"t$() r  z=31000 %v=((z^2-(z-1)^2)) u=v^0.5 C((u)-(u+0.5))<0.01z# =z;":";z-1;":";v^0.5 z    start  !7,10 ;"PLEASE WAIT"  ""t$()  41:7,9 ;"STOP THE TAPE":0  300,   p*********************** r* level index exp. * u*********************** x yret=6000p z "INPUT #" |:"mantissa ? ":man:man :"exponent ? ":exp:exp lni=man+exp*10  lev=1 lev=lev+1  lni=lni 4lni<0lni=lni:lev=lev-1:6050  6031 "[";lev;"/";lni;"]" ret6000p a$  ret  z=130 * table * ***********************  man=10 exp=z "10^";z;6;" = ";  6020 z z=237% exp=10 ^z "10^10^";z;9 ;" = ";  6020 z 6 #( #2K27,41):110n,0:27,41):0,557 #:]17,3;"0":17,6;"2":17,9 ;"4":17,12 ;"6" #<17,15;"8" #>\16,2;"0":14,2;"2":12 ,2;"4":10 ,2;"6" #A #Fi579+x,513+y:20,20:-20,20:-20,-20:20,-20: #Hc72H+x,568+y:0,30:-30,0:0,-30:30,0: #P'"Here is an example of ";n$ #R #Z #\ #_noises #b #d-z=120:0.01z# =,-24:z #f #h #i&z=15:0.3,t(z):z #l #mz=15:t(z):z: #n*7,9 ,5,-7,0 # # # # axes(atype) # #_30,90Z:210,0:30,90Z:0,557:0,-110n #10 ,2;"0" #f11 ,9 ;"90":11 ,15;"180":11 ,22;"270":11 ,29;"360" #atype=09124# #atype=19130# #.4,2;"1":16,1;"-1" #07,1;".5":13 ,0;"-.5" # #.7,2;"1":13 ,1;"-1" #.4,2;"2":16,1;"-2" # # # #draw triangle(label) # #N30,60<:100d,0:0,60<:-100d,-60< #label=09175# #15,6;"adjacent" # 8,1;"hypoteneuse" #11 ,18;"opposite" #6123{,60<:0,7:7,0 #H41),60<:0,2:-3,2:-2,0 #14,2;"A" #14,17;"B" #6,17;"C" #::::::::: # # # # # replies() # #':9210#+((*6)+1): #"Berk ! What's ";c$;" ?": #'"Wally ! ";c$;" isn't on the tape.": ##"Moron ! Try spelling straight": #"sorry, ";n$;" ? ": #"Are you tired, ";n$;" ?": $"Don't wind me up, ";n$: $T $V scrhdr() $Y $\9900&:: $ $ qsthdr() $ $'9600%:9900&:egc=0: $ $ $endsec(start,c$) $ $5"That finishes ";c$:"Hit r to repeat this section" $ 9900& $a$="r"start $return $ $ $getans(loop,exp) $ $?dp=0:err=0:u$:u$:(u$)>10 err=1 $(u$)=09460$ $[j=1̱(u$):(u$(jj))<45-ů(u$(jj))>579ů(u$(jj))=47/err=1 $%9480%:j:u$="-."err=1 $Cerr=1dp>1"type the answer as a number":9460$ $=ans=(u$):(exp-ans)>0.005y# ="No, the answer is ";exp $$(ans-exp)0.005y# =9720% $return $ % %$(u$(jj))=46.dp=dp+1 % ,j>1Ư(u$(jj))=45-err=1 %  %k9800H&:d1=r(1)/10 +r(2)/100d+r(3)/1000:dec=d1:int=1000*dec %& %A"See if you understand this by trying the following examples" % 9800H& % %"True or false ?" %a$ %a$ %a$"t"a$"f"9650% % %n:n;"/";:d:d: % 9630% % % %praise % %%9720%+((*9 )+1): % "Good": % "Correct": %"Right again": %"OK": %"That's it": %"Brilliant !": %"Well done": &"Very good": &"Genius !": &HWz=110 :r(z)=(*9 )+1:z:r(1)r(2)9800H&: &R#r(1)r(2)9800H& &\ &z "trap": & &"Hit C to continue" &a$= &a$="c"9950& &a$="r"9950& & 9920& & &z=1502:z & 32&crhdT$sthd$ndse$etan$ig"iF#xes(#P#xe#riangl#iagrarais%qure"qupa"gxeturr$ntarȅ  >@@@>||BBBBB,,BBBBB<@|@<x~(8DD0H0  P    b FILE STRUCTURES A data file is a space for a set of related data organised in a certain way. An inventory file, for example, might consist of 1000 records of 200 characters each. The nventory record represents the current inventory situation for a given part number. The sort of information stored might include part number, part name quantity, cost etc. As files may be defined in a wide variety of ways, and on many different devices, it has become important to structure them in an ordered way. In recent years, attempts have been made to make files and their structure independent of the program accessing them. Making files independent in this way benefits the programmer, as consistency is improved. FILE ORGANISATION To understand how files are organised, some special definitions are required : 1. the OBJECT of a file is whatever the file records information about. eg. if a file holds inform- ation about ships, its object is 'ship' 2. An ATTRIBUTE is an item of information recorded about an object. eg. the arrival date is an attribute of a ship 3. A KEY ATTRIBUTE is the pri- nciple identifier of an object. eg. the name of a ship is the key attribute of a ship 4. a CORRELATION is an indica- tion that an object is ass- ociated with one or more other objects. eg. there is a correlation between the two objects 'ship' and 'consignment' There are two different kinds of files : 1. ATTRIBUTE FILES These are accessed by a single key, and contain all the attributes relevant to that key. 2. CORRELATIVE FILES These allow access among attribute files by correla- ting keys PROCESSING FILES Two major problems involved in file management are to : 1. Make sure that the file accessed is the correct one 2. Check if a particular program has access to the requested file As the data processing field has expanded, the number of files available in even quite small computer systems has risen to a a relatively large number (often several hundred) To keep track of information about a file, a FILE LABEL is used. This forms the initial records in a file. SECURITY OF FILES Some of the many files accessable on a mainframe computer system will be of a confidential nature. These files should be accessible by certain programs available to users of special status. One method is to divide files into three groups : 1. system (system programmers) 2. group (members of a group of users) 3. user (ordinary users) As well as this restriction on file access, further security can be provided by limiting the operations available to a user to a combination of the following : 1. read (view the contents of a file) 2. write (add to or change the contents of a file) 3. execute (run the program stored in a file) Many users will be allowed read access but not write access, as although the information may be needed by the user, useful contributions to it will often be unlikely. X 5  CfileSfilU1NfileAcG ch7 M2wOEkh$(20,32 ):t$(7,7,16,32 ):w(25,8):5000:2000 tuition template  G C E Tutoring  Aug 1984 6:6:0:  r(10 ) t(5):9069m# Lscrhdr=9300T$:qsthdr=9350$:endsec=9400$:getans=9450$ fig2=8950":fig=9030F#:axes2=9000(#:eg=9040P#:axes=9100#:triangle=9150#:diagram=218:praise=9720% 5br=8100:squrec=8850":squpar=8900" D:"COMPUTER STUDIES help ch7"::"EFFECTS OF COMPUTERS ON SOCIETY" :" GCE Tutoring Aug 1984" 2z:"Hello, what's your name ?":n$:n$:"OK, ";n$;",":"I'll begin by telling you how touse this computer studies tape." 4n:"This tape covers 4 subjects which all come under the headingof effects of computers on society." :>:"Press the key marked C so I can type the next screenfull" <a$=:a$="c"62> = 60< >:z=1100d:z AF:"Thanks. From now on when I want you to press the C key, I'll say" D:" Hit C to continue" F1:"Here's the list of subjects on this tape": Hy"applications in industry business applications general impact on society man/machine interface" K2:"Which subject do you want to try ?":s$: Lc$=s$ N'(s$)>3s$=s$(13) Ps$="app"200 Rs$="bus"400 Ts$="gen"600X Xs$="man"1000 _ 70F c     x=15 z=116 t$(1,x,z) z scrhdr x " 500 ,qsthdr 1#"Industrial research involves:": 6"1. a small number of simple calculations 2. a large number of simple calculations 3. a large number of complex calculations ?" ;4egc=3:exp=3:return=320@:getans @>"A common technique used in industrial research is :": ER"1. simulation 2. calculation 3. computation" J4egc=3:exp=1:return=335O:getans 2start=400:return=598V:n$=c$:endsec       x=12 z=116 t$(2,x,z) z scrhdr x  300, qsthdr 7"Business computer applications tend to require :": "1. a large number of simple calculations 2. a small number of complex calculatons 3. a large number of complex calculations ?" 4egc=3:exp=1:return=520:getans %"Business applications include :":  V"1. accounting 2. payroll calculations 3. both 1 and 2 ?" 4egc=3:exp=3:return=535:getans U2start=200:return=398:n$=c$:endsec V X Z ] ` b"GENERAL IMPACT ON SOCIETY": gx=13 lz=116 qt$(3,x,z) vz x8x=28,5;" ":16,0;" " {scrhdr x qsthdr "What does EFT stand for ?": Ƃ"1. electronic finance transference 2. electronic funds transfer 3. electrical funds transfer ?" 4egc=3:exp=2:return=720:getans <"Credit cards are more convenientthan cheques because :": s"1. they do not wear out 2. there is no physical transfer3. they are valueless in themselves ?" 4egc=3:exp=2:return=735:getans F"Tax fraud is likely to be more difficult in the future because:": "1. cash transactions will be recorded by computers 2. cash transactions will be replaced by EFT 3. tax calculations will be made by computers ?": 4egc=3:exp=2:return=750:getans 2start=600X:return=798:n$=c$:endsec    " % ( /x=17 4z=116 9t$(4,x,z) >z Cscrhdr Hx qsthdr :"In the future, which crime is likely to increase ?": N"1. payroll snatches 2. property theft 3. mugging" 4egc=3:exp=2:return=920:getans -"Bar codes currently appear on about :": U"1. 25% of goods 2. 70% of goods 3. 99% of goods ?" 4egc=3:exp=2:return=935:getans 2start=800 :return=998:n$=c$:endsec      "THE MAN/MACHINE INTERFACE": x=13 z=116 t$(5,x,z) z  scrhdr x Lqsthdr QA"In the 1960s, the standard man/machine interface was :": VQ"1. a teletype 2. a VDU 3. a keyboard" [5egc=3:exp=1:return=1120`:getans `1"At present, which is better developed ?": e4"1. speech input 2. speech output" j5egc=3:exp=2:return=1135o:getans o%"VDUs became popularly used in :": tL"1. 1950s 2. 1960s 3. 1970s" y5egc=3:exp=3:return=1150~:getans 4start=1000:return=1198:n$=c$:endsec     x=17 z=116 t$(6,x,z) z scrhdr  qsthdr &"Computers will allow society to:": O"1. decentralise 2. centralise 3. expand ?" #5egc=3:exp=1:return=1320(:getans (0"Proliferating communication benefits :": -M"1. democracies 2. autocracies 3. both ?" 24egc=3:exp=1:retun=13357:getans 7%"Computer science has followed :": <["1. linear growth 2. steady growth 3. exponential growth ?" A5egc=3:exp=3:return=1350F:getans u3start=400:return=1398v:n$=c$:endsec v x z }  =4start=1400x:return=1598>:n$=c$:endsec @ B H Jh$(18): 4start=1600@:return=1798:n$=c$:endsec       h$(19): 4start=1800:return=1998:n$=c$:endsec   x$="": o=1̱x$ n=18 #w(o,n):x$(oo)+n-1,w(o,n) n o  H24,16,16,32 ,16,16,24,0 C24,8,8,4,8,8,24,0 F0,0,62>,64@,64@,64@,62>,0 E0,0,124|,2,2,2,124|,0 G0,66B,66B,66B,66B,66B,44,,0 G0,44,,66B,66B,66B,66B,66B,0  G0,0,60<,64@,124|,64@,60<,0 I240,8,120x,128,248,0,0,0 C0,0,0,4,126~,4,0,0 I248,136,136,136,0,0,0,0 C4,4,228,4,0,0,0,0 G240,8,240,8,240,0,0,0 G28,20,16,16,8,8,40(,568  E4,68D,228,68D,0,0,0,0 "G16,16,16,0,0,480,72H,480 %E12 ,18,18,12 ,0,0,0,0 (E7,4,4,8,8,144,80P,32 *G4,8,16,16,16,32 ,32 ,32 ,G32 ,32 ,32 ,16,16,16,8,4 /C32 ,16,8,8,8,4,4,4 2C4,4,4,8,8,8,16,32 4   save screen  ptr2=0 z=16384@22528X ptr=z-16383? data=(z) Jdata0ptr2=ptr2+1:j$(dgnum,ptr2)=(data):k(dgnum,ptr2)=z z    !fetch screen $ &z=16384@23296[ (ptr=z-16383? +data=(j$(dgnum,ptr)) 0z,data :z D N S fetch fast X 3200 Yx=16384@23296[ Z x,((addr)) ]addr=addr+1 `x b  fetch screen bits   z=1pxnum k(dgnum,z),(j$(dgnum,z)) z    save arrays   "text"t$() r  z=31000 %v=((z^2-(z-1)^2)) u=v^0.5 C((u)-(u+0.5))<0.01z# =z;":";z-1;":";v^0.5 z    start  !7,10 ;"PLEASE WAIT"  ""t$()  41:7,9 ;"STOP THE TAPE":0  300,   #( #2K27,41):110n,0:27,41):0,557 #:]17,3;"0":17,6;"2":17,9 ;"4":17,12 ;"6" #<17,15;"8" #>\16,2;"0":14,2;"2":12 ,2;"4":10 ,2;"6" #A #Fi579+x,513+y:20,20:-20,20:-20,-20:20,-20: #Hc72H+x,568+y:0,30:-30,0:0,-30:30,0: #P'"Here is an example of ";n$ #R #Z #\ #_noises #b #d-z=120:0.01z# =,-24:z #f #h #i&z=15:0.3,t(z):z #l #mz=15:t(z):z: #n*7,9 ,5,-7,0 # # # # axes(atype) # #_30,90Z:210,0:30,90Z:0,557:0,-110n #10 ,2;"0" #f11 ,9 ;"90":11 ,15;"180":11 ,22;"270":11 ,29;"360" #atype=09124# #atype=19130# #.4,2;"1":16,1;"-1" #07,1;".5":13 ,0;"-.5" # #.7,2;"1":13 ,1;"-1" #.4,2;"2":16,1;"-2" # # # #draw triangle(label) # #N30,60<:100d,0:0,60<:-100d,-60< #label=09175# #15,6;"adjacent" # 8,1;"hypoteneuse" #11 ,18;"opposite" #6123{,60<:0,7:7,0 #H41),60<:0,2:-3,2:-2,0 #14,2;"A" #14,17;"B" #6,17;"C" #::::::::: # # # # # replies() # #':9210#+((*6)+1): #"Berk ! What's ";c$;" ?": #'"Wally ! ";c$;" isn't on the tape.": ##"Moron ! Try spelling straight": #"sorry, ";n$;" ? ": #"Are you tired, ";n$;" ?": $"Don't wind me up, ";n$: $T $V scrhdr() $Y $\9900&:: $ $ qsthdr() $ $'9600%:9900&:egc=0: $ $ $endsec(start,c$) $ $5"That finishes ";c$:"Hit r to repeat this section" $ 9900& $a$="r"start $return $ $ $getans(loop,exp) $ $?dp=0:err=0:u$:u$:(u$)>10 err=1 $(u$)=09460$ $[j=1̱(u$):(u$(jj))<45-ů(u$(jj))>579ů(u$(jj))=47/err=1 $%9480%:j:u$="-."err=1 $Cerr=1dp>1"type the answer as a number":9460$ $=ans=(u$):(exp-ans)>0.005y# ="No, the answer is ";exp $$(ans-exp)0.005y# =9720% $return $ % %$(u$(jj))=46.dp=dp+1 % ,j>1Ư(u$(jj))=45-err=1 %  %k9800H&:d1=r(1)/10 +r(2)/100d+r(3)/1000:dec=d1:int=1000*dec %& %A"See if you understand this by trying the following examples" % 9800H& % %"True or false ?" %a$ %a$ %a$"t"a$"f"9650% % %n:n;"/";:d:d: % 9630% % % %praise % %%9720%+((*9 )+1): % "Good": % "Correct": %"Right again": %"OK": %"That's it": %"Brilliant !": %"Well done": &"Very good": &"Genius !": &HWz=110 :r(z)=(*9 )+1:z:r(1)r(2)9800H&: &R#r(1)r(2)9800H& &\ &z "trap": & &"Hit C to continue" &a$= &a$="c"9950& &a$="r"9950& & 9920& & &z=1502:z &  32&crhdT$sthd$ndse$etan$ig"iF#xes(#P#xe#riangl#iagrarais%qure"qupa"gxeturr$ntarȅ  >@@@>||BBBBB,,BBBBB<@|@<x~(8DD0H0  P    b COMMERCIAL APPLICATIONS The use of computers for commercial application has increased very rapidly in recent times. Much wider use of computers in a much more compehensive role can be expected in the future. The type of problem is very different from that attacked by the mathematical computer. In a commercial application the calculations are normally extremely simple but have to be repeated a very large number of times. Some examples are given below. GAS AND ELECTRICITY BILLING A common type of application is found in nationalised industries, for example, in the issue of gas and electricity bills. The calculation from meter readings of a quaterly gas bill is a very simple matter, even although it may involve two different rates and instalments for some equipment. However in some cases several hundred thousand such bills may have to be issued each quater. The business computer is peculiarly suited for this type of work. This data can then be fed into a computer which is programmed to calculate the amount due and also produce a printed slip for posting to the consumer at a rate of more than a thousand slips per hour. It can also keep a record for accounting purposes. PAYROLL One of the most common applications of computers to business is the production of a payroll. In this case the calculation is more complicated than in the electricity or gas billing problem because we have to take account of overtime, which is normally at a different rate from the ordinary hourly one; income tax has to be taken into account and subscriptions deducted. An advantage is in increased accuracy, which results in fewer pay queries. It is also possible to obtain information as to labour costs, etc., very much more rapidly, and this information may be required in estimating the cost or in a cost accounting. ENGINEERING APPLICATIONS It frequently happens that design calculations for an engineering problem involve a large number of parameters which must be chosen in order to meet the specification laid down. The normal method is to guess suitable parameters and then perform a series of calculations to see if the specification is satisfied. If it is not, the parameters are varied and the calculation is repeated, several trials are required. A computer is peculiarly suited to this type of repetitive calculation, since the program can be unaltered but the initial conditions varied and the calculation repeated. Trade was first achieved by the means of barter. Gradually direct exchange became more difficult. Agricultural produce was particularly unwieldy.A rare commodity with a widely recognised value was more convenient, as a valuable quantity of, for instance, gold could be carried easily. As society stabilised, intrinsically valueless representations of the commodity could be used instead of it, for example bank notes and cheques. Credit cards are still more convenient than cheques as there is no physical exchange involved. At present recording the transaction that a credit card is used for is carried out by shop assistants. In the near d future the card will be read by a computer terminal, allowing a check to be made on the owner's credit worthiness and whether the card had been stolen or not. The direct debit of bank accounts and so increasing efficiency. Electronics funds transfer will bring governments more revenue, because income tax fraud will be very much more difficult than at present. Illegal financial transactions usually involve transfer of large sums of money.Electronic Funds Transfer will prevent this, as it will allow all transactions to be recorded. For this reason, casual criminals will also have problems, since any trading in stolen goods will also be recorded. IMPACT ON THE INDIVIDUAL Home security will become more important than of late, as property theft be computer controlled as well. Many sensors positioned randomly all over a house and all working on different principles will be hard to evade, and if all visitors to a house are video-taped this form of crime will effectively disappear as well. Mugging will decrease because material cash is the only form of money that is impossible to trace, credit cards of the near future having better methods of identifying the user, eg. a photograph incorporated in the laminated plastic of the card, for instance. Another possible method is magnetically encoding the user's fingerprint. The fall of cash crimes will probably tend to increase the number of other crimes, theft Until the 1970s, the teletypewas the standard input/outputdevice used with computers.From the late 1960s, the VDUbegan to take its place,graphics characters could nowbe used increasing the uses ofcomputers. Graphics charactersused in conjunction with thelight pen, a device thatallows free expression,simplify the operation ofprograms. In the past few years, speechoutput has increased in sophistication and consequently is greater used. Input/output hardware has decreased in size to the same extent that other hardware has decreased in size to the same extent that other hardware has, resulting in speech output circuitry being used in calculators and even watches, as well as in more general purpose computers. Speech input is still very limited, mainly because of the complexity of the programs needed to interpret it. One word commands can be understood by a computer relatively easily, but the structure of a sentence is hard to define without extensive contextual information. Teledata and teletext services will allow the decentralisation of office work bringing many benefits. An average of two hours travelling time could be saved on each day, and the final saving due to the reduced commuting would benefit the country economically and ecologically. Teletext will also allow a more convenient form of shopping from home than mail order does at present. X5  SappCappU3NappAc