You are on page 1of 532
CAMBRIDGE UNIVERSITY PRESS Computer Science for Cambridge International AS & A Level COURSEBOOK Sylvia Langfield & Dave Duddell CAMBRIDGE Lary Ping Me Cambiege 288 Unt gon oe Ube Pia, 20 oe New e005 USA 1 Vilamstonn Rd Por Malou C2, Raala 234-21, 34 on, Pat Splendor Frum J Dai Cente "anon os 5-4, gape OT5N5 amie Unverty Prep a e uoesty of Cog farthest ton by dasareaing now eps! ‘Ehtaton tring dere thehighesnaacora eso eee. camer Vnomatonontirtieswnecorbydgeoy/SBLGSSSES ecorbedgeuriestyPess2018 Thepubtston econ Suber sts cepon sot rnsansaleeet coche ering ere, eprasicnnol any pu mey hace went mien pemicon fants ues res Gress eon 20:8 Pein thei ingot Latina rnd Aectloue rc ri ebcton kel fo he Bea {SBN 971-108-5832 Paperback nth Cambridge Eleste ction (yes) Isa sre tion eons cana Semen yrs amt Uniesiy reshapes te psn or acum of URL {Grr rts re sees lero mhptteaton, ad casa ‘Renton eases ot reas anda tal lmao enh ‘Soworiscrecate rea esramnngbt sme Urey soos ot [fone e esac oaveneoraton eter ieomoleqosion adsorlestvesinthe be wee witenby ents fisamaataa he waymatsse ardcomay bere Pst ecmpaper queso protic permission of Canbige ‘Sousa ctsnanona Evo once 0 TEACHERS THE UK lesitesreredce ary oar. wort wt em feng Soteyenans eco tongs oat caer helene: alec chargers eon Cooyiheucenne tere (i sherenossctcohn tt orwheryouisn wend etemscfs eres, ‘Sedyeuhoe pede wien meson olay Users es ( wheeyoc se plowedoeplodsrsthoupemauon ude Berens ‘eam 3th Capra bears and Patent 88 ch cove ‘arate fe epecotor ceva pesngerwincenan pes ect Strona mpoducton lots rps sting aaron gsi (eT) Part 1: Theory fundamentals Part 2: Fundamental problem-solving and programming skills pter 12 Algorithm des m-soving F Part 3: Advanced theory Part 4: Further problem-solving and programming skills CeCe a1) Part 1: Theory fundamentals Part 2: Fundamental problem-solving and programming skills Part 3: Advanced theory Part 4: Further problem-solving and programming skills How to use this book ey Terns Task. uestion - Discussion Point ~ Rellection Point- Reflection Pont Ca Extension Question - oxerdee adv or topics beyond the immediate scope ofthe ‘ge Internationa AS. ALevel sylabus. On Extension Question 101 Worked Example 3 of song problems orimplementing Tip quik notee'o Dussieinseen bis hihie 12 wheres ean oid vales po hich ery summary =hese ‘appear aithe end of youre have learned an Exam-style Questions ‘cxamstyle Questions - ‘sing exam style question ea Chapter 1: Information representation By theend ofthis chapter you should be abet: 1 sha understanding of binary magnitudes andthe derence between binary preies and decal prefs 1 show undertanangof thebasisof ferent ruber systens ‘= perorm binary adtion and subtraction ‘dese practical applications where BnaryCoded Decimal (20) andHexadecima re used 1 show understandirgofand be ableto represent characte ta nits intemal binary form, depending on the character set used 1 show understanding ofhow data for abitmapped image 1 perform calevlationsto estimate the fiesizetora bitmap Image show understandiag of the effects of changrg elements ofa bitmap imageon telmage qulty ar show understanding ofhow dat fora vector gaphicare justi the use oa itmap image ora vector rphicfora ven task ‘= show undersandingothow sounds represented and enced ‘show understanding ofthe impact of changing the sampling rate and elution show understanding ofthe need for and examles ofthe use cofcompresion show understanding of oss and lssess compression and ust the use of a method ina give stuation show understanding of how a tet le, bitmapimage, vector \gephicand sound fie canbe compresad Reece Eee) 1.01 Number systems Denary numbers Asacildwe ist encounter the numbers that we use in everyday ie when We ate fist learsing to count Specialy, we lam to count using 2,3, 5.6.7.8, 9,10 This givesus ten ciferent symbols to represent each indvidual cig. This stereloe a base-10rumber system. Numbers inthis sytem are caled denary aumbersc, re traditional, deca) numbers, ‘When 2 numbers wntten down the value thatitreresents is defined by the place values of ‘the gets nthe numer. This canbe ilustated by considering the denary number 345 which is interpreted as shown in Table 1.01 Piacevalie wow [wn] Gomer eee 0 oe |e Tobie 1 Ue of placevalesn the representation denry uber Binary numbers ‘The snarynumbersystem sbase 2 Each binary itis writen with ether ofthe symbols and i, Abinary digits eared to as Bit swith a denary number, th zlueo a binary aumoeris defined by placevales. For ‘example, see Table 102 forthe inary number 013.0, Produc of digit and . place value “Table 1.02 Use of place valuesin the representation of binary number 8y addingup the valuesin the bottom row you can see thatthe binary number 101110 has 2 velue whichis equivalent the denary mmbers6 ‘You mustbe able to use the binary number system in order to understand computer, systems, Tis i because nse computer systems thee no attempt made to repr diferent igs ¥. nsteao all computer technology is engineered with components lepreset or recagrise ony two states: on'and'off To match this, allsoftware used by te hardware uses binary codes which consist bits. The binary code may represent binary number but this es nat have tobe the case Binary codes are mostoten based onthe use ofone or more groups of eight bits. Agroup of bitsiscaleda bate Hexadecimal numbers These ae base-16 numters where each hexadecimal gts represented by o folowing symbols 0,,234.567.89,48,0.EF, The symbols through to represent the denary values 10 trough to 15. The value ofa numbers defined by place voles. For trample. 200 lable 1Usfor tie nexacecimal number 2A, or Perens Table 1.03 Us of place vluesin the representation ofa hexadecimal number [Adc up the valuesin the bottom row shows that the equivalent denarynuberis 78 Inorderto explain why hexadecimal nrmbers are us groupe fours enced fisttodefnethe mibbleasa _Anibbe can be represented ty one hexadecimal cgi Ths means that each byte of binary code can be written 3s we hexadecimal digits. Two examples are showin Table 104 together with thei denary equivalent a 200100 a8 0 ‘able 1.08 Examples of byte represented by two lheradecimal gis Note here that you were converting the binary number exercise on 2 piece of pane you would not bother wit nluting leading zeros. However, 2 Slolowed trough in the hexadecimal epresetation ‘ne example when you wil see hexadecimal representations of bytes is hen an error has ‘eeutred dung the execution ofa program. Amemary dump could be provided whichhas 3 ovalec al fepesentaton ofthe content of some chosen part the memory. Another use ‘when the bytes conan binary numbers inthe charts that define character codes. This dscussed iaterin this chapter Ine character code chars and im other onlin sources you may se eterencesto octal rumbers which are base-8 You can ignore these Converting between binary and denary numbers ‘One methee for converting binary number toa denary number's toad upthe place values or every git that has a value 1. This wasilustrate in Table 1.02, ‘An alternative metho is shown Worked Example 1.0 Tocarryoutthe conversion you stat atthe mast sigficant bt and sucessvly multiply bytwo and ad the result the ext cit. The folowing shows the method being used to convert the binary number 1100 othe denary number 25: 2442101, then add6100, then 3d 12100,then 3d 2410 1to gives Toconvert a denary number to binary begin by denying the largest power of thathas a vale less than the denary number. You can then write doum the inary representation ofthis, ome of2 value. This wile 2 1 folowes byte approprate umbe-of eros. Now subtract the power oftwo value From the denary number. Thendentythe largest power of2 vale that ess than the remainder rom the subtraction. You can now repace a zeroin thebinary representation with aL fr this new poner of2 postion Repeat tis process unt you have accounted forthe ful deny nue, For example, forthe denary umber 7 thelarget power of two vale less than hiss 64 so you can start by witing down 1000000, The remainder ater subwracing 64 fam 78s 16 The largest poner cf two valueless than thisis 80 the replacement of zero by J gives 100100, Repeating he procezstinds values of4 then 220 the nal answe 00114. ‘An akernative approachis shown in Wocked Example 1.02 ‘useful way to convert a denary valve tots binary equivalent isthe aracedut af secosive clusion by twowith the ‘emeinder written down at ech tage, The converted number sthen even asthe se of remainders in reverse order, ‘This can beillustrated by the conversion of denary 246 to binary 26 = 2 > 123 withremaindero 23+ 2 > 61 withremaindert 30 withremalnder1 18 withremaindero with mainder with remainder 1 with remainder 1 » wit remainder 1 the binary equivalent of denary 2465 11120310. SE a ) “Tochec tht anansne-wih eight it sensi, remember hatte maximum dear value | ppbensemat shoe ionenntehnntaamtnartes an fez, Conversions for hexadecimal numbers. Itispossibleto convert hexadecimal number to denary by using the method shown in Table 103, However, here aremore than 2 few cigs, the nurbersinvolved inthe conversion become very lage nstead, the sensible approach iso fis convert the hexadecimal number toa binary number which cen then be converted to denary. Toconert hexadecimal numberto binary, each dg strested separately and converted into a bitbinaryequvalent,emembering tat Fconvetsto 111, € converts to 1110 ands0 on Toconvest a binary umber to hexadecimal you start withthe fou east ig and convert nem ro one hexadecyl tox en proceed up cont bits Senificent bt successively aking groupings of fur bits and converting each grouping tothe covresponding heradecimal it TasKL.01 Convert each atthe denary umbers¥6, 218 and 374 nto hexadecimal numbers. Wa eee Questions.01 1,02 Numbers and quantities ‘There are several diferenttypes of numbers within the d provided Tale 10, 5 system, Examples ofthese are on [pest fe computers “able 1.05 biferent nays to expressa vlueusingthe denaryaumber system Weil focus on how large values ae cope of measurement, canbe wtten in tre te, fe havea quantity tat incldes uits diferent ways. For exam wien in any one af these ree ways: neces Thesecond example has used an exponential notation to define the magnitude othe value Te tid examplehas aéded a preixtthe unit ta define this magnitude We eed this as 25367klometres The'klo'is an example of adecimal prefix There oe our cecimal pein commonly used foslargeeurbes. These are shown in Table 106 cee Uniortunately fora longtime the computing word used these prefixramesbutitha slghly diferent dfinison. The valve for 2 102, Because ths is close to 1000 computer Scietsts decides that they could use the kilo preixta represent 1028 So,forexsmple. ita computer system had the fllowing valves quoted forthe processor speed and te sizeof the ‘memory and ofthe hard ce Processor speed Lech Se of RAM ace, Ske ofhard disk 0068 The peti would represent 1° forthe processor speed but would slmoct cota represen 1024 1028 1026 forthe ther to valves, ‘Ths unsatisfactory stuationhas now been esoved by the definition of anew tt of names nich canbe used to deine abinary prefix, election ofthese is shown in Tate 1.07, EIN Factor applied tothe value ie 1 San gil aa i ot ‘Table 1.07 Some examples ofbinary prefixes When a number ora quant s presente tora person to ead itis best presented with ether one enary cgi ortwo denary cigs before he decimal pint. fa caleulation has been carted out, the nia result found may not match this equitement, Aconvetson of Cambridge international AS & A Level Computer Science te presented valve wil be needed by choosing a sensible mapritude factor For example, Consider the lowing wo answers calelated forthe sie of ale: a 3ssobytes| ‘onerson tokibtytes would be sensible using the calubtion AiO = 3275KB bb s4sso00byte a15608= Here, conversion to mebibytes would be sensible using the caleltion 2 Iyig=3 296m oe M32 34560008. Ifa caluationisto be performed with values quoted with erent ragrtude actors there mustfist be conversions to ensure all jeshave the same magnitude factor For example, many files of sie 2-4 MiB could be storedon a 4GiB memory stick rversion ofthe GiB valueta the corresponding Ni value ifyou needed tonow there should bes The aleulaion would be xa024t8 1.03 Internal coding of numbers The discussion inthis chapter lates only to the codngot integer values. The codingot non integer numeicvalues (el number) isconsieredin Chapter 6 (Setion 16.03, Coding forintegers omputersneed to Gveone example of hen aheradecmalrenesntton used m Another pssst the maton sed that theo bes eddunly represen 0 {Ignesiepe ina’ numbers ints coplanar i Caledate the denay nmbecoresponding teach yt. a 4 coetwo advantages! eprseting sie tegen a's complemertarm ae than unger and magne rearesentaton a Geta erent examples cf ther optons othe types fifrmation at ould be ‘tpozont by tn ys or each example state whether 9eresentaton equres tyes even tre, pstone byt or ony pal abt ac ne 8 2. he deer tas some mogesstoredin fe tet aretwo pose omatstrtheles Describe the approach used if a graphicis stored in a vector graphic file. a ib Deseibe he appreachused fa gaphiisstoredina bap He a IW sttewhich rmot gestetter image aly fhe magehestobemagnted and enlain wy a > Thedesigoris concerned about thsi opm topes 1 iftnereoiutanistobe G40» 480 andthe colour depth sto be 16st an oprosimotese rhe itnop fie Sine the anor ving senile uns al 11 Enloinwhy thscaklaton ony ves n aproxmatefe se a The desgner deces that tne bitmap fle ree compressing 1. Explain how a simple frm of lossless eampression coud be used, a plein one possible approach to lossy compression that could be used a 13 Anaucioencoderis to be used to create arecordhgof a song, The encoder has two components > ‘One ofthe components is an analogueto-digtal converter (ADC. 1 Explain why this is needed. a fi Two important factors associated withthe use ofan ADC arethe sampling ate and the sampling resolution. Explain the two terms Seetch a dagram this wl help your explanation 5 The other component ofan audio encoder hast beused before the ADC is sed 1 entiy his component. a Explain why itis used a aa | Usingswo's complement, show how the folowing denary numbers coud be stored inans-bit reise: a a 8 |W Convertthe twa numbersin pat (a (nto hexadecimal a Binary Coded Decinal 8CO) another way f representing numbers | Wt the number 359 In CD for, 0 IW escrieause of C0 pumber representation a Camtrtgeinnatonl AS Aleve Compute Science S68 paper 3) ue 5 Sound canbe repesented cgay ina compute, Explain the terms sampling resolution and sampling ate oT ‘The folowing inormatin eles toa music track bing recorded on a 0: + musicis sampled 44100 times per second + each sampleisis bts + each ack equressamplingfor let and ight speakers. 1 Calciate thenumber of bytes required io storeone second of sampled music. Show your working. a HAparticulr tacks four minutes long. Describe ow you woud calculate the number af megabytes equied to store this track a ‘Wihen storing mus tracksin a compute, the MP3 formatis oken used, This reduces le size by about 30%, Explain how the music quality is apparently retained B Cambsage iterate Slee Computer cence 958 paper 204 Novebar 205 folio) ay ty lalla M aad Pree 2.01 The evolution of the purpose and benefits of networking Wide area network (WAN) Duringthe 1870sit wou be rarmal for large organisation to have compute This ‘computer would bea mainfame ormicicomputer The computer couldhave been unninga ‘ime -sharingoperat system with ngividval users accessing the computer usirg a terminal ‘ontected othe compute witha cable. Technology was deveoged tat alowed computers inaiferent organisations tobe netwovked using what would nom be describe ara wie area ‘network (WAN). 2 AN, the networked computes coud be thousands iometres apart. The benefits afhavigthe computers connected bya WAN were 20 could beran ona erate computer that had the required applicationsofware + adatarchve that was stored ona remote computer could be accessed + amessage couldbetransmited electronically ta user ona remote computes Today, atypical WANs characterised by the following. + ew used byan organisation or acompary to connect sts or branches + lewilnotbe owed bythe organisation or company. + Tewilbeleased froma pubic stched teleghonenetwerk company (STN) + -Adedicated communication ink willbe provided by the PST ‘+ Tre transmission mecium wil be ibre-optic cable, ‘+ Transmission within te WAN willbe om steht ste + Aswitch il connect the WAN to each site ‘There il notbeany end.systems connected rectly tothe WAN, Local area network (LAN) Inthe 19805 the ara ofthe microcomputer or peesonalcamputer(PC) changed computing. Inan organisation, zuser could have her own computer on thei desk, The computer could bea stand-alone system orsome orgristions chose to have more than one computer connected using local area network (LAN) Its called ical area network becouse it ‘ypically connected Fs thar ween one room orin one building or on one st, The benels of connecting PCsin LAN included thefolloning + Thee 2 of istaling application satware on each incvidual PC could be seved by instalng the softwere on an application server attached to he LAN ited Alle server coud be attached tothe LAN that allowed userstostorelurgee les and alsa allowed les tobe shared between users Insteadof supplying indvidval printers tobe connected toa users PC one or more printerscould be atached to 3 print server that was connected © theLAN these could beigher quality printers ee any a + Manogersin organisations could use electronic mailto than sending round memes on pape. ruicat with sta rather + The’ paperless office’became a possibility, where fies wer tobe stored in gta form on fie server rater an a paper copesinafling bine Today, atypical LAN s characterised by the following + ttwilbeused by an oganisation ora company wthinasteorbranch + tell be owned bythe organisation orcompary + itwillbe one of manyindvicual LN atone ste + Thetransmission meclum wl be twisted par cable or WF +The LAN will contain advice that allows connection toother networks + Therewil be end-ys connected which will be use systems or sev biscussion Point: eprint server wasattached tna net, hal neonate poi internet working The 1290s canbessitobewhenthe moder eacfcomputngard networks sated thebepining of wide-orend ue oft ntemet.The wor ntemetig shortens form ofthe term nternetwork hie deserves saumber of network connected ogrnet LAN ar connected to WANs which ate intum connected telnet a allow acest resources \word-nide, The other technologies dering the modern era, namely moble devices and isles networlog, arte to become common used nthe 2000s, ‘The purpose and beelits of netwerknghave nat changed butter scale and scope hsincreased enermeush n pata people now haveful accessto networks rom the pesonal devices, The client-servermodel “he lent server mcdel or xchitecture) was ist used in lage organizations when they had installed interalnetwerks.Typeally the erganisation would Rave individual ANS ‘connected via an organisation-wide WAN, Anindvicual LAN mghthave had an application server attached. The organisation was likely toneed a powerful central computer The central compitercould becennectedto the WAN as server. would probaly nathaveindvidual users connected tnitirecty.APC, attached i aLAN, could access the server ascent. The clenc-server male of opsation nowadays is diferent. The clients a web browser connected to theInteret, The servers web server hosted on the Internet. ‘The server arovides in application and the lent uses the aplication. Thee ate two options for how the client factions Athin-client sone whit + chooses an application torunontheserver + sends input data: the server when requested by the application + receives output fom the application thicken sone ich + chooses an application provided bythe server 1+ possibly caries out some processing before running the apalicaionontheserverand ‘aso afer receving output rom te aplication + aeratvey, possibly downloads the appcation from theserver ands the aplication tse tnthiheclen made tm gruensinguneecan be cally ewe ui The dent server approach isthe choice in the folowing circumstances. + The serverstoresa database whichis accesed rom the cen system, + Thesewverstocesa web application which allows the cen system ta fin o sometimes, supa information, +The server stores aweb application which allows the client system tocaryoutan | e-commerce or financial transaction, File sharing a Fase: uploads files to Me server then the cent server operation canbe usedby another user ta download these rom the serve An akeratve medeo operation for sharing fess peevto-peernetworking instead ofiaing cone server that any clens acces, peer-to-peer network operates with each peer retworked computer tring some ofthe ls. Each peercanthereore acts alent and request fle from another peer oritcan act asa server when another peerrequets te downlad off. ‘The peerto-pee'mode! hae several advontagescompsred acer erverfle downioading: + itavoide the possibility of congestion onthe network when many clentsare ‘Smultaneoul attempting to downoad fies parts ofaflecan be downloaded separately + the parts areavalabe om mor than one host ‘The client serve model hes the folowing advantages. + talons an exganisation o conto the downloading nd use ffs, 1+ Tretils canbe better protected rom malware attacks becawsethefes are stored on ‘one server whic willbe regularly scanned using appropiate anti-vius sofware 2.02 Network topologies Toe ave five requirements ara dte connmunications yatem a sender a receive, transmission medium, a message and a protocol (see Chapter 1 for deals about protocols. _Atansmission mesium can bear efor Nii or cables eg, for Ethernet) Data canbe sent thvaugh the medium in aferent modes: vnere data fom isonesway 0 ere data can low ether way butt simultaneously + fulldvgex wher simultaneous both-ways data lw posse ‘N'message' is any typeof data, which canbe sentas ether: + sbroadtast hich is one. llommunicatio used tradonal for 2 mulcast whichis ram one souree to many destinations + aunicas, ‘Agata con possbilies fr nications system may consist single wolated network, Inere are Several topology of sn oated network, Thesimplestof tise is here two systems ae connected by anetworklink as shown in Figure 201. Tiss an example of pointo-paint connection, which 8 decicated lnk. Transmission might be simplex o duplex and 2 message cen only be unicast. Figure 201 A pint to-point network Early LAN topologies used either a ing oro bus topology vie don't needto cover the cng topology ast isnot used very alten now. Abus opolegyhas only one ink butit shared boramumber of end-systems and is therfore descrined as mult-paint connection The ciguation i shown i Figure 202, There ino drect connection between ay pa of end systems, A message must therefore be broadcast eventhough itmight ony beitended for ‘one end-aystem, The topoigy is resilent because faut in an end-system or nthe ink ot does na affect the use ofthe network tyne other end-ystems. SBERSBEBEE Figure 202 Abus network eof ofuly-connected mesh topology is shown in Figure 2.030 this fation, each end-system has point-to-point to each ofthecther end systems, Transmission i ule messages mightbe unicast, multicast orbroadcast, Part J: Chapter: Z Figure 2.03 Amesh network, Figure 203 shows endsytems connected in amesh topology but this surrealistic because ‘ofthe amaunt of cabling required. Amesh topology canbe used when individual LAN Switches ve connected na network The epologyicecentia fr the conn itis the inastrueture ofthe Internet Thenal possolity ia star topology whichis show in Figure 208, Figue 2.06 startopology Figure 206 couldhave been crawnsothatt looked ike asta buthas been drawn to show the physical configuration tats use ina rea if installation In star topology. cach end- syslemhas painete-polnt connection tn the central device Tenneson figlexand ‘massages rom the central device might be unicast, multicast or broadcast. Aswththe bus tepology the fare of an end-ystem, ots link, eaves the other end-ystomsunfected However, the central device must natal. 1bus topology most of the end-aystems might be use workstations and theothers are servers. However, inthe tar topology the end-systems might be user wockstations corserversbutthe ental device isiferent. tsa speialsed device th the puposeot cannectingothercevices inthe network. Cutrenty, estar topology isthe usualy to ceiigue a network. Ther are several easonsfor hs. The mastimortantis hat the Cenzel device cn be use to connect the network to aher networks ane, in particu, to Uelntemes, See Dene ccr fa LANS are connected, they can have diferet topologies 0+ supportigtechaologls. This collection of LANs then becomes a hybrid network. special Connecting device is needed to ensure tat the hybrid netwerk sulylunetional, is often an advantage tobe able to connect 2 new topology LAN to existing LANs where not sensible ornot possible to use the existing topology fer the new LAN. sn example suena vored LAN slreagynstaled but anew wireless LAN sto be connected 2.03 Transmission media cable -Ane-work eablecan be twisted par, coal orflre-opti The twisted pairand coal cables per othe transmission mecium. In dscussing suitability fa guenapolication umber of factors to conser. One ofthese isthe cost ofthe cable and connecting vies. Another isthe best bandwicththat can be achieved. The bandwith governs the fata trarmiscion ae, Thee are then two factors that can cause poor petra the kethood of interference affecting transmitted signals and he extent of attenuation {Cetercrtion of thesignal) when igh frequencies are vansmited. These factors wil dictate wheter repeater or amplifiers are needed in transmission lines and how many willbe needed, Table 20 shows some comparisons ofthe diferent cable types es cw ign Thighs Sndnithcd tones rie uch tterwation at high frequency | Affected Most affected " Least affect ieee Saeed —_|tesafeced | antec 5s ea viecten [waren [test ‘Table 2.0 Comparisons between able types ‘You need to understand that fr each ofthe three types of cabling there ae defined standard for cferert aces of cablewhich must be considered when you type ofeable to use. bre optic fewhich le performs best but costs more than the otherknds. Fora newinstalator the improved performance of fxe-optic cables ikely tbe the Factor that govern your choice. However, where copper cables aleo6y installed the costof replacement by fibre-optic cable may not be justified. Figure 2.05 Onecable with fur tsted pats with difering twist rates to reduce latererence Currently, twisted pair cable s normaly used to connect telephone handsets to tlephone lines. This type cable sillustrated in Figure 205. is also the technology of choice fo igh ‘question 2.01 Coaxial cables used extensively by cable television companies andin metropolitan area rnetwors, it usally used far long itenus tepone cabling breoptt cable the coaxial cable isnot technology 0 choice forlong distance cabling, As shown in Figue: bundled but xe-optic cable contains many individual bres. plastcncet ene Se a igure 206} Coasa cable and (ba bund fibre-optic cable Wireless 3 alterna ee wz caw High tow. faa Tow Users computer Figure 2.08 Schematic diagram oft streaming Perse Te buffer must deliver the data tothe user 2 the corec bitrate or the media being used Data hich sent into the bulershould be sentat a higher rate to alow for unexpected delays. The media payer continvausy monitors how ful he buferisand canals the bit rateinrelaion tothe define hgh and low-water mars, kis essential to have abufer se ‘thats sufclently gear itreverto ge le Therate of transmission tothe buf imited by the bandwidth ofthe network Figure 2.13An inteanet connected tothe Interne Using 2 NAT box ‘The NAT baxhas one iP acideess which vise oer the Internet and so cen be used as 2 sending addess ofa a eceiung adress. ternal the P adéresses haveto be chosen rom ‘one othe tree ranges of P addresses shown in Table 203 that have beer allocated fr such networks, (You do not need to remember tnese numbers! awiaee.0.0 399168. 255.255, “Teble20 Pvt adresses beused in pratenetworks The mportant points that each adress canbe simultaneously used by ary numberof afferent prvate networks. Tereis no knowledge of such use onthe ntrnetitselforin {anyother private network, The interfacein the NAT box has software installed to exaine ‘each incoming or outgoing ransmission. Therecan bea security check before an incoming "Yansmission is dected tothe corect internal acres. The digram showsundefined srs om the outer conaected tothe NAT box. These indicat thatthe network sttucture ‘within the organisation could take many different forms. ‘Static and dynamic IP addresses Aseiscussedin Secton 206, when a user wishes tohave a connection to thelnteret the connections handed by an internet Service Provide. Te ISP wil hve avaable alge umber of hostbs. However, the cumber of users that the ISPs supporting could very ely be larger than the otal aumter of adaresses avalsie. Fortunate for thelSP andfocan irdvial ser many ofthese potential users wll nate engaged in Internet interaction. rking technologi Sor he normal practice ifo theISPto create a ‘dynamic address'fora user. This sone thatthe I5Pis reeto enange ft suits but moce importantly the adcress is avaiable for r-llocaton foncea user disconne's Irom theIntemet, The aermatveis static adress whieh nee changes and can be provided users prepared to pay an extra charge Discussion Point: IPvé addressing Today there are combinations of Pv approaches in use and these allow the Internet tw comiine to funclon. Respected sources argue that tis cannot continue beyond the current decade. There must soor be a migration to P version 6 (IP), which uses 2128 bitaddressing scheme allowing 2 diferent adresses, ahuge number! in practice, hs wil alow more complexstructurng of addresses, Documenting these addresses is going to be cfcut. The adcresss are written ina colon hexadecimal notation. The code is broken into 6-bit parts, with each part represented by four hexadecimal choroeter. Fortunately, come abbreviations ae alowed. few ensmples are pven in GcaFEFFFF 30 25KFO1 jee osomited ‘Table2.04 Some examples of hus addresses ‘Extension Question 2.01, Pvéaddressingis used how man allable per square metre the Esti surlace? Do yu think there wll be eraugn to go round? dresses would b 2.09 Domain names Ineveryday use ofthe internet, auser needs toidentya particar web page or email box As ers, we would much peter notto iden each Padres ur its dotted decimal value! To getroune t's rablem the domain name sevice (ONS, also hnown as domaln name system) was invented in 1983, The ONS service allocates eadatle domain names for internet hosts and provides system for inding the P adress for an indvial do The system is setup as a hierarchical distributed database which sistalied on large umber ofamain name servers covering the ale of the internet. The oman name servers ae connected ina hierarchy, with powerful rot servers atthe top ofthe hierarchy supporting the whole Internet. The rat servers ate replicated, meaning that multiple coples fall ther data are kept at al mes, DNS name space’ then dvidedinte non-ovecapping zones. Each zanehas a primary name server wth the database stored on. Secondary ‘eres ep natin ram thi mary server ‘As 2esult, the naming systems hierarchical. There re more than 250 top-level domains which ae ether generic feg.com, edu, nd gow) or represent countries eg ukand i. ‘Thedomain name included in universal resource locator (URL, which identifies awed page, oran email address. domain sramedby the path upward fom it For example eng ‘scacom. eer tothe eng subdomain inthe cisco domain ofthe com toplevel domain. Lookingup a domain name to find an address called name resolution’ Forsucha query ‘there are three possible outcomes, + Ifthe domains under the contro ofthe server towhich the query issentthen an authoritative and correct Pacdressisetumed + fthe domain isnot under the conta of he server, an IP address con aie retumed fit is stored ina cache of recently requested addresses butt might be out of date + ifthe domainin the queryis emote then the query sent toa root server which can provide an addres forthe name serve ofthe appropriate topleveldomein,Thsinturn an provide the ares forthe name server inthe nest lower domain Tis continues Lunt the query aches a name sever that can proude an authortatveP adress, Reflection Pol in several lacesyou have ben aske to carry out some research. Are you usingthe most ficient search method? Specialy, how cul they be improved? 1 Glent server and peerto-per networking are options orf shaing. Thestar topology ithe one most commonly use for a LAN, ‘= The main ansmission mia ae copper (twisted pai, caval) cables, fre optic cables and vieess {rado, mizowave, iar) 1 Factorsto consider when choosing a medium ae bandwidth ttenuaton interference and the need for repeaters. ‘CSIC carersence multiple access with olson detection) has ben veto detect nd vis rmessagecolisiosinshared media, ‘The ltenet te largest nternetwork in existence, IsPs provide aecosstothelntaret. lntemet nastics supportecbyPSTNs and cl phone companies. “The WorldWide Web sa astrbutes application acesibeontheinteme. ‘Thecurrentintermet aédesing scheme sIPvt, with PS. utue contender. “The DNS resolves @domain name to an Padres. Exam-style Questions 1 Anew company hasbeen established thes bought some new premises which consist of @ number of bulings ona single site. ithas decided that ll ofthe computer wersxations in thedferent buildings ned to be networked, They are consdering ways in which the network might be se up One option they are considecngis to abing forthe network and to instal themselves i Name hethreetynesofcabing that hey mightconsier. 2 1 Explaintwofeets, other than cost, that they need te consder when choosing stable cabling @ 1b Another option they ae considering to use wireless technology fora ast partof the network 1 Explain one option that might be suitable for wireless networking a Wdentiy one advantage other than cost, of using wireessretherthan cable networking in IA ieny one disadvantage other than cost of using wiles rather than cable networking {€ Tefal option they reconsidering sto use the services ofa PSTN 1 belinewhat a PSTN is or does. m Explain now a PSTAcould provide a network forthe compen. 8 2 a TheDomain Name System's vitally important for Internet users. g 1 Name the typeof software used by the system and the typeof hardware on which the softwares installed a [Name two types of application that se the Daman Name System and for each give brief description af how tis used a 1b Inthe clestl Pvt addressing scheme, the 32-bit binary code fer the address has the ton (mast significant) ot set 0 Dit aes A the top two ete se to 10 class Bor the top thre its set to 110iclassC. Ina document an Ps adress hasbeen writen 38205.124.16152. 1 Give the name fr this notation fran P adéress and explain how ivelats tothe s2-bitbinary code a FH genifyte clas of he adress and explain yourreason. a 1 cxpiain why an Pvt adcressclfines a netiD and a host a € IftheciDRscheme or an Pot addessis used the P address 20512416.152 would be ‘State the binary code forthe hostO in ths adds, with 2 reasen, a 2 Auserwatches 2 video presided bya website that uses on-demand bc streaming Describe the measures nesdecito ensure that the vdeo does nat pet isbeing watched 6 4 Describe where private IP addresses can be uses e 1b _Explainhow itcan be ensured that private and public P addresses are not used in sarong conten H munication and net 5 a Antaddresshas the oloning value: 11.64.255.90, 1 swrte te above Pade in hexadecimal Explain the format of anP adress. 1b Study the folowing sentence: when auser enters URL nto thelr webbrowser, tie ONS service locates the required resource” Explain how a URL and DNS ae used to locate a resource. a Contdoe rational A Aleve Compe Since SES pepe 1208 ne 5 6 Accessto World Wide Web content uses IP addessing 48 StatewhatP stands fr, “4 a 0 1b Thefollowing table shows four possible IP aderesses, Indicate foreach Pacdess whether tisvalc or invalid nd eve a reason, ‘daress DenaryiHevadecimal | Vaidorinvalid | Reasen 3-2A.GnA.BaRB | Heracecinal Bassa Denaey aera | Headeainal “ € _Describetwodiferences between public and private IP addresses. a Cont neat tse is BH aE ICeM ELEY Learning objectives ‘By the end ofthis chopteryou shouldbe able to: 3.01 Overview of computer system hardware functionality A computer system hast support three major ate3s of operational capt + the processing of data + thestorageoféata + theinputand output of date ‘tthe heart ofthe system the processing of eat is caried out by the CPL (Central Processing Unit). The working of the CPU ae the subjectof Chapter Sand will ot be dlscussed furtherhere. Data storage ‘The terminology used inthe computer iterate ta describe components fo string datos not always consistent. One variation ito cstngush between memory asthe comport ahh the processor can access directly and the file) store used for long term storage. An ‘iterative to describe the memory as primary storage and the emider as secondary storage \Wnatever names are used, the memory hierarchyisa useul concept when we choose the components tobe used ina computer sytem fr data storage. Figure 301 shows aversion cof his hierarchy thatincludes the tends the important factors thatafect our choice. The factors increase inthe direction ofthe arrow. The ester isa component within the CPU that asthe fares access speed. The cache memory has aster access peed than that of main cvemory, particulary whenthecacheisa builtin partoftheCPU chi, Component | Category ‘Accesstime Capacity Size Cost egiter Processor component Cachememory | Primary storage sin memory Hard isk ‘Secondary storage Aunlany storage L F gure 3.01 Trendsin the factors affecting the cheiceofmemory components Computer users would real ke to havea arg amour: of primary storage tat cost litle and allows quick acces. Thsis not possible, the fastest components cost more and have lites capacity n practice the choice made'sa comgromis. could be argued tat there isa need for seconday storage because the use of primary storage aloe would be fartoo expensive, However its more sensible smpiyto recognise hat long-tsm storage of data requis separate dedicates components An altemative approach when choosinga storage medium or devices to consider which of the following applies: + itisanintegra prt ofthe system, to which theuser cannot normally get access the options here area hard disk orsoistate drive + Risanindiiualitem thatcan be inserted intoadrve whichis partoftecomputer system or whic can be connect fa it- cul bs hop dik opial cor megratictape args that canbe connected tothe system whe possblties here ineuding a hard deve, a memory sik + itisa portable item thatthe user an carry atound with them fo atachingoaflerent systems possibly used for personal backup - usally a ash memory stick nowadays but 2 floppy iskor optical dscisan ater there are + itireroiefromt system, possibly accessible viaa network forbactup cloud storages one option, butters are magn: araysef Independent Disks) or SAN (Sor Data output Forcata output from a computer system the folowing options are waliable + sceeendeplay + hardcooy using 2 printeror plotter > virtual headset pl + aspeater + stingto any of the data storage devices described earlier ‘= wansmission on network tink, Data input Forthe ingutof data toa computer system the al wing ae amongthe options avaliable: + ke cd orkeypad entry by auser user inraction witha screen using screen icons menus; possibly using 2 device snd postal volving the use ola touch sree + auservsnga game contiler + auserusinga scanner user using a mizop intandem with oie recognition skware reading rom any ofthe storage doves described ear + tranarssion ona network ink, Note that nout and autaut ina computer system are controlled bya VO sub-system. This nde data input too output ram the vrten totheinteral hard disk or computer system aswel cata reae rom or 3.02 Embedded systems waren Section 301 relates to what we can calla genera-ourpose compute system. We also need ta consider embedded compute systems because thee are many eal parts wil lest certainly or more bedded system must stil contain 3 processor, memory and an YO capability. hese ‘ae consiructed on one chip hiss called a microcontalle For some applications the sn lhe input and output solely associated with the interaal workings ofthe host item, nother cases, pethaps when servinga monitring oe contol function, there might input rom within the system but some outputs provided ta the user Aernatvely, Abed system con provide a full user in The major advantage of embedded ystems is that they ae special purpose possibly performing only singe function, This uneton ike tobe requited in wide variety of ferent manufactured products Mass production of an embedded system brings tconomis af sale: the mare we make, the cheaper they become, Duingtne early years oh ‘hr use, embedded ystems had the dstdvantage tha programmieguas dict because the memory space avaiable to store a program was limited, Fr this eas, programs had tobe short. action, there was the isadvantage tat errors were found Following, instalation then new chips had to be manufactured and used to eplacethe ally ones, Inmeder systems these problems areles lke, buta new problem hes developed Embededsystems are now part of what called hel (Interne af Things) More and mare embedded systems are being installed with network connection, This can greatly rapeove the usefulness ofa product, for example by providing information and updates tothe ones, However tis wcsoiiy vee etrhia way concern. Embedded ystems ae ess key to be protected against uniwtulactans han general-purpose systems, Discussion Point: How might usfi information from an embeded system installed ina domestic apotance [be communicated over a network a the owner ofthe aplance? 3.03 Memory components um The components that make ua the main memory of gene‘l-ourpose compute system sre caledrandom-access memory (RAM) called RAM because ary byte of data stored an be accessed without afecting he other bytes stored Because ofthis might have been better caliedcrect access memory. Another posible ame woud be ead-~urte memory ‘because RAM canbe repeatedly ead om or writen to, Akay feature of RAM is tats volatile, whichmeans that when the computer system switched off the contents of the memory ae lst. ‘There are two general types of RAM technology. Dynamic RAM (ORAM) is constructed from capaci tha leak elctity and therefore need regularly recharging (very ew rillseconds) 0 maintain the identity ofthe dat stored, Static RAM (SRAM) is const uced rom lip lop that continue to store data indefinitely while the computersystem is switched €0n, The ris and logic for lip-lops are cscussed in Chapter 19 (Section 1802. ‘The major diference between the two types of RAM i that DRAM requires fever electronic components pert stored.Thiemeans DRAMA cheaper tomake andhasa higher density for data storage. “he major advantage of SRAM i that proudes shorter accesstime. In a generat ‘purpose comput syste, ts normal prectee lor maln memory abe constuetearom DAM but forcache memory tobe provides by SRAM because ofthe fester acess speed. By contrast embeded systems that eed RAM with oly init capacity oen use SRAM for this The second category of memory component iscalled read-only memory (ROM) Azan, this name doesnot eve a full picture ofthe characteristics of th typeof component. ROM shares the rardom+accessor direct acces properties of AM. However, asthe name ples ey Interrational AS. Se annot be wittentowhen nse within the compute veto. The ether iy fests ic ‘alain ROM isnot oe hen the computer system s svtched of he memory snon- woot The word lates seerteains Ty toremembethat alate memory nolonger stores daawhentesystem sath of ROM has specialised uses forthe storage of data or programs that ate gong tobe used unchanged over and over again. na general-purpose system the most important use isin storing the bootstrap progran. This isa program thetruns immediatly when a system i ‘switched on. There area umber of ether uses or ROM in sucha system, some of which we ville Intern this book. n zéalton, ROMs used in mary embeded systems, There ace fouriferent peso ROM. 1 Inthesimplet ype! ROM the programs orcata ae istaled as part ofthe manufacturing process erent conterts re neeced the chip must be paced 2. Anaematve's Programmable ROM PROM) The manufacturer the chip supplies chips toasystem bur. Thesyetem bulder instal the arogram or datainto thechigs. Ths alls thesystem builder 'o text somesample grammed chip before commiting the whole batch to be pograrimed A th theses type af RON, he program ardata once Instaled cannot be crange 2. Amore tleeble type of ROM Is Erasable PROM (EPROM The installed dat or progremean be erased (using ull ight) andrew date ora cew program can beinstaled. However hs ‘eprograming usual requires the chip to be removed From the crc. 4 The mostflexbie type of FOMis lewrcally Erasable PROM (EEPROM) Astherame suggest, thiswarksina sla wayto EPROM, exeps an electrical snl canbe used to remove isting cata. This has themsjr advantage thatthe chip can remain inthe cut contents arechanged, Honever, te chip stl used a read-only, mary components ae inthe computer system you ae using and tout thom such ae the tye and storage capacity? Buffers ‘Whenever data hast be anslersed rom one part a computer system to another a problem occurs ithe cata can be sent more quel than tan be received The slstion to the probiem is to use aber. Data enters abutferbelore being transmitedto is destination. The buffer functions asa queue ote date emergesin the order thatit has entered the bur ically, the butericreated inthe computer memory. Question 3.01 Part 1: Chapter 3.04 Secondary storage devices. Belore discussing storage devices, we should introduce some terminology. For any hardware device, whether an intepel part of the computer system ora connected peripherals operation requtes appropiate sofware to beinstaie, Ths sokwares elered toa the “device diver, Ths should na be confused wih the term ere’ associated special with ‘astorage device. The term deve initally elred to the hardware thathoused a storage ‘medium and physically rsfered data to ior read dat rom t, However, asso oten happens, such distinctions are often ignored. Asa est, for example, referencestoa hard ska hard sk ive orto ahard civ’ have the same meaning, Magnetic media Magnetic media have bee the malnstay of lestore technology foravery longtime. The invention of magnetic tape or sounc recording pre-dates the vention ofthe computer by ‘many years Asa result, magnetic tape was the fst storage device In contrast, the hard disk was specially vented for computer storage The hard disk also used magnetisation to rie dat, and arrived a few years ar magnetic tape was frst used for storage For ether type of magnetic medium the interaction with itis contlled bya ead head and ‘awritebead, A read head uses the basic aw of physics that state of magnetisation wil afiectan electrical property; a write head uses the eveselaw. Altough they are separate devices the two heads are combine in areag-write ead, Thetwo alternatwestates of ‘magnetisaton are interpreted as 8100 ‘schematic diagram of shard disks showin Figure 302. Points to nate about the physical 1+ there smorethan one plate (isk) + each latte tas aread-wrte head for each side + the platters spin in unison altogether and atthe samespeed) the read-wite heads ae attached to actuator ams hich alow theheads to move over the surfaces ofthe platters + the motion of each read-write head is syrchroised withthe mation ofthe other heads + acushionof air ensuresthata head does not touch a pater surface lranarsic ave Asngedie Figure 02Aschematcdrawingof the components ofa hard ik rive inconcentric tacks (rack sharingthe same cent Each rackeonssts ola sequence of its. These re fomated into sectors where each sector contains defined numb alts, The sectr becomes he smallest unital storage Because the movement ofthe headsis "syehronized the same rackson diferent sks can have rated data stored on them. Theseare accessble yjustone moverntelthe head. The coletion af racks seferedto asa cylinder To store afl, sucient number oct shave tobe allocated but these might or might rotbe next eachother Ashes are created and subsequently deleted recites the use ofthe sectors becomes increasingly kagmented, wich graces the performanceaf the sk, A defragmentation propram can reorganise the allocation of sectors to festo restore performance. Ths is lscused in Chapter (Section 803, hard drieis considered to tea dec acess read-write device because ary Seto: can be chosen freacing or wring However, te data na sectr has tobe read sequently (inorder This sont a simplified explanation ofhard drive technology. There ar several ssues that aise when making hard devs For example, the length of track on te dik You movefrom centre toedge Manufacturers otherwise the largeras eto take accountof this inher cesige, 2 storage cxpacty mile es than potently might be Optical media Ath the magnetic tape wsdum, optical storage was developed trom existing technology nat associated with comput systems, The compact dic (CO) evolved into CD cial audio (O-DA) and ths became the technology used inthe CO-ROM, This was extensively used for distrbutingsofwarebut wa of na value asa replacement far the floppy dsk. The read-wrte ‘version (CD-RW which came_ater finaly meant CO was a complete alteratveo floppy asks emer the CD has now gen way tothe DVD (orignal ‘ial video csc but later renamed 2 ipa versatie dis), Theletest and most powertul technology isthe Bluray dsc (8), ie ciagram ofa design for an opti equippes to read a CD with area lightof wavelength 60am ddsccrive is shown in Figute 303, Ts light of wavelength 780 nm ora OVD with rec laser tensind Diwoie minor Sgnaleatacton os ead signal detector Figere 2.03 schematicdrawingof on opie die drive ‘Wie can ignoce the fine details ofthe construction ofthe dive and concentrate on the principles of haw itoperates, The important features or the proces of reading daa rom the ‘ec are follows, 4+ The optical dsc has one spiral rack runing rom the inner exteme the surfaceto the outer edge + During operation, the disc spins. + Simultaneously the esermoves across ensuring hat itis continuoudy focused on the spiral ak +The track onthe surface ofthe dsc has what arerelerred to as‘ptsand lands + Thelaserbeam is eflecte rom the suface ofthe ds. + The diference between the reflection rom apt compared io that rom aland canbe erected + Thisifferenc inthe intensity ofthe light the detector receives canbe interpreted a thera Lora to alow abinary code tobe read rom the dsc For CD-RW and OVD-RW technologies, he reflective suraceisa speciaaloy material. When atais being written tothedls (the bur’ process the heat genereted2y the absorption ‘of thease ight changes the material to lquld form, Depending the mensiy ofthe laser light ene material reverts to ether crystalline or an amorphous soli frm when coos, When the dss 80, the laser ight rellected rom the cystaline sold but at from the amorphous sol, allowing the codingofa10°0, Despite there being ontyonetrackthe isc functions asa drectaccessdevice because the lacer can move forwards or backwards. The dati formatted into sectors along the rackin similar way the formatting oa magnetic had disk ‘nother similaitywith magnetic dk technology isthatthe storage capacity fe dependent ‘on how close together individual physical presentations ofa binary dgitcan get. There [sre two aspects governing this for an optical ise, The speed of rotatio sone but the ost Important the wavelength ofthe light Sorter wavelength ightcan te better focused. This iswhy 2 OVO canstoremore than 2 but much ess than a lay de Solid-state media Despite the continued improvement in optical technology there snow power competitorin te orm ofsoid-state storage. Thebasis for thisis lash’ memory, whichis a semiconductor tecmnology wth na moving parts, The crcuitsconsetf aay of wansitors {actingas memory cells, The most requently uses teesnoioy scaled NAND' because the basicciruitry resembles tha of a NANO logic gate see Chapter 4 Section 4:04) withthe ‘memory cellsconnectedin series Thewtingto the memory and the eading fom itis handled bya NAND lash contol. The special features that blocks a’ memory cells can have thet contents erased all atonce in as. Furthermore, belove cata can bevrtento block of cllsin the memory the data inthe block rst has to be erased Ablock consists ‘of several pages memary. When data ead, a single page of data cen be readin one operation The most frequent use is etherina memory card arin USB lash drive (memory stick In the later care the flash memory s incorporate n'a device withthe memory chip connected toa standard USB connector. Tis iscurently the technology of choice fr removable data storage. How long this il main sis uncertain with alternative technologies uch as shase-change random access memory (PRAM) aleady underdevelopment.

You might also like