Forni TP 2018181 May/Jtjne 2018

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 28

TEST CODE 02215020

FORNI TP 2018181 MAY/JtJNE 2018


C AR IBBEAh E X A A4 I N A T I O h h CO UNC IL

CA R I BBEA h ADV.'UNCED PRO FICI ENCY

EXAJ'vI1N.'ATION" COM P UTER SCIE h CE

FURTH ER TOPICS IN COMPUTER iiCIENCE

UNIT 2 — Paper 02

READ TI IE ''OLLOV'ING INSTRUCTIONS C tRE ''ULLY.

1.This paper consists ot’SIX questions. Answer ALL questions.

3. Oo NOT write in the margins.

4. It’you need lo rewrite any answer and lhere is not enough space to do so on the
original page, you must use the exlra lined page(s) provided at lhe back ot’ this booklet.
Remember to draw a line through your original answ'er.

5. If you use the extra page(s) J'ou iYlUST write the question number clearly' iii
the hoz pmvided at the top of the extra page(s) arid, where relevant, include
the question part heside the answer.
SECTION A

DAK STRlqyLRES

.Ansx›'cr BOTI 1 questions.

1. (n I The user and developer sl’ obstruct dnia types (.fiDTs) loc us on di fferent as pect s sf
dntn types. Outline TWO aspects of’ data types that are the focus of’

(ii) developer

|4 inarks|
-5-

(b) (i) Describe the slruclure ot’ stack ADTS and queue ADTS.

Stack

Queue

|2 marks|

(ii) Write ONE real-lit'e example to illustrate a ‘stack’ and a qiieue’.

Stack

Queue

[2 inarks|

(c) A stack and a queue can be implemented using an array or a linked list. State TWO
reasons u liy an array may be replaced by a linked 1 ist to iinpm›'e pmgrain efficiency.

|2 marks|
(d) The methods lhr queue and stack ADTs are listed in Table 1 and Table 2 below. The
positions at which values are added and removed are the standard positions expected wilh
queue and stack operations.

TABLE 1: A QUEUE ADT

Method Effect of Method


lsKnipty() Tests il’ the queue is emply
Knqueiie(<-vale) Add oval - lo the queue
Dequeue() Renio›'es a ›'alue from the queue and returns it

TABLM 2: A ST tCK ADT

method Mffect of iYlethod


IsEmpty() Tesls il’ the queue is empty
Adds oval - to lhe stack
Pop () Renio›'es a ›'alue from the stack and returns it

A palindroine is a word that reads the same backward as w ell as for's'ard. for
example, niadain, kayak. le vel. racecar. Use the follow ing giiidelines to write an
algorithm lhat represents lhe body function to test if a word is a palindmine:

— The input to the algorithm is a queue named queue I info which a word to be lested
has been loaded, such lhat lhe first letter of’ the w ord is at the linnt of lhe queue.

— The solution should use another queue called queue2, as well as a stack called stack I .

— The solution can include simple ›'ariables, such as a character, but should use no
other aggregate data.

Write your response cii page 7.


-7-

|9 marks|
(e) (i) Using a suitable diagram, show the end result of an initially empty linked list alter
all of the follow ing opemtions are executed in the order given. Note that new
nodes are inserted at the beginning of the list.

fnten (40)
fnten (20)
Delete (40)
Insert (15)

Clearly indicate the node, data, pointer, lop and end ot’ the list.

(ii) It sing a suitable diagmm, describe the sleps in adding a new node to a linked lisl.

[3 inarks|
2. (a) (i) Write C code lo declare an army named iiuinseq to store a sequence of integers
from 0 to 20 inclusive.

|1 mark|

(ii) State the array location fi›r lhe integer 1 9 in (a) (i).

| 1 mark|

(iii) Write a snipped of’ C code to call a binary search function, binarysearch, given
the parameters numseq. searchKey, low and high. The function binarysearch
should return the location ol'tlie key in nuinseq if it is found, otherwise, it returns
the ›'alue —1.

(iv) State the required condition tor a binary search on an array.

| 1 mark|
(v) Determine the number of comparisons that are needed to search the iiuinseq
array in (a) (i) to find the value 20 using a linear search. Slate ONK reason for
your answer.

|2 marks|

(v i) Determine the number of comparisons thalare needed lo search lhe numseq array
in (a) (i) lo find the value ot’ 20 using a binary search. Show all working.
- 11 -

(b) (i) Use C cr›de to create a frinclion named swap which takes an array and lwo array
local ions. The purpose ot’ lhe function is lo interchange the contents of the t's'o
local ions in the army.

[4 inarks|

(ii) Describe how' a selection sort can be used to sort an array ot’ ten integers from
-12-

(iii) Dased on the information below and the functions getsmallest and swap, use C
code to create a function, seleetionsort, that performs a selection sort on an array
with known boundaries, low and high.

— getsmallest (array, low, high): Renims the location of the smallest integer
within low and high

— Function header: void selectionsort (int arr[], int low, int high)
(c) Consider the following array w ith five integers.

2 3

Value

Use a bubble sort to show the contents of lhe array during and at the end of

— the second pass.

Total 25 marks
SECTION B

SOFTWARE ENGINEERING

Answer BOTT questions.

3. (a) J's Solutions is undertaking the development ofa new infomiation system to keep track
of student records. In a particular school, the records will include subjects, grades and
fees. Tfiis undertaking involves different phases and delivembles. Answer the following
questions with regard to the smdent records system.

(i) State ONE functional requirement and ONE nonfunctional requirement for the
development of such a system.

Functional requirement

Nonfunctional requirement

(ii) Outline the outcome or end result of the &sign phase.


(iii) Ditferentiale between the ‘lop-down design’ and ‘bottom-up design’ methods.

(iv) Identify the design method which allows testing and coding to be done early,
ond encourages code reiisabilily.

| 1 mark|
- 16 -

(v) Distinguish between ‘unit testing’ and ‘acceptance testing’. Give an example of
EACH type of testing and state the min person/s involved in EACH test.

[6 marks|

(b) An online auction company allows its members to place items for sale through auction.
Members can bid or not bid on other auctions. A member can post an item for sale
era an auction and a base price must be specified by the owner. Items are categorized;
therefore, an item belongs to only one item category (Electronics, Clothing etc.) but an
item category can have zero or more items. Each item for sale can have many auctions
since an item my not be sold in its first auction. The auction should keep track of date
started and date ended. The biAs made on the various auctions by members must be
recorded with the following: bidID (primary key), mernberID, auctionl D, BidArnount,
DidDate.

In the boz provided on page 17, draw an entity-relationship model for the above
scenario. Relationships should be named, and all the primary keys and eardinality of
EACH relationship should be clearly specified.
- 17 -

[10 marks)
Total 2S marhs
4. (a) (i) Well-engineered software should be mintainable. State TWO coding principles
or practices that can aid in creating maintainable code.

(ii) Outline TWO situations that can cause infoimtion systems soft 'are to enter the
maintenance phase.

(b) An important characteristic of soRware with regard to its usability is that it should be
easy to use. State TWO other characteristics of software usability.
ynaiuñ otenap amwgos yo auld Spun aqi ui pesn eg eve 8m‹ffjotoad log eu!IlnO (p)

”slgsuaq nPnI»u! pjnoqs nsuodsea unoy ”IunrudoIo^eP

- 61 -
- 20 -

(e) A traveller makes a request to book a seat using an airline resein ation system. The
system checks to determine it'any seats are available tor the given flight in lhe booking
database. If a seat is not available, the pmspecti›'e traveller is notified. For an available seat,
the traveller gives personal details and payment information to make the reservation. The
system slores the customer's details and updates the booking database. Payment
information is sent lo the accounts department tor the payment verification.
Confirmation of payment results in the preparation ot’ tickets tor the customer or else
the booking is cancelled, in which case the customer is notified and lhe booking
database iipdated to reflect the cancellation.

I ii the hex pmvided on page 21, draw a Revel-0 data flow diagram to show' the flow of
information fi›r the airline reservation system in the scenario described above.
-21-

[12 marks)

Total 25 markc
-22-

SECTION C

OPERATING SYSTEMS AND COMPUTER NETWORKS

Answer BOTH questions.

5. (a) In an operating system, a process is entirely &pendent on a program. Differentiate between


‘a program’ and ‘a process’.

[2 marks]

(b) A process changes states during execution. State ONE reason why a process may
move from running to EACI I of the following states

(i) Running to ready

(ii) Running to waiting

(iii) Running to finished ..............................................................................................

[3 marks]
- 23 -

(c) Describe lhe steps by which deadlock can occur if two pmcesses (P1 and P2) will bolh
eventually need t's'o DVD drives (D1 and D2) lo copy files troin one disc to another.

(Note: There are only two DVD drives in the system.)

(d) Distingii ish between a ‘multitasking operating system’ and a inultipmc essing operating
system’, gi ving ONK real-lil'e example of IiAC11.

[ft marhs]
- 24 -

(e) (i) Outline ONE reason why modern computers use virtual memory.

[2 mar hs]

fi i) Describe how irtunl memor}' works.

[4 marhs]

(ii i) Explain ONK disadvantage of using large viriiial memory when compared to
small memory 'RAM.

[3 marks]
Total 25 marhs
- 25 -

6. (a) Mr John Doe would like to set up tw'o LANs at his business headquarters using the following
connectivity devices:

Router, PC/wireless device, ISP, DSL modern, Switches

(i) Arrange these connectivity devices in order of use from the source.

(ii) State TWO advantages of using a router.

[2 marks|

(iii) One employee suggests using a hub in place of a switch. Briefly explain to the
employee why a switch would be more appropriate for the job.

GO ON TO TI IE NEXT PAGE
- 26 -

(b) The layers in the OSI network model are listed below.

Application Presentation Session Transport


Network Data link Physical

In the following table, write the layer that BEST corresponds with each characteristic.

OSI Lsyer Characteristic

(i) Control sessions between applications

Dinary transmission over media such as


(ii) ..................................................... cable, air etc.

(iii) ..................................................... Include protocols such as I ITTP, FTP, SMTP

Uses IP addressing for routing packets between

MAC address used for physical addressing, node


(v) to node communication

TCP and UDP provides communication between


(vi) processes

(vii) ..................................................... Data representation and encryption


- 27 -

(c) (i) State ONE similarity and ONE diti'erence belw een ‘ FTP’ and '1I TTP’.

|2 marks|

(ii) DitTerentiale between 'HTTP’ and ' I ITTPS’.

| 1 mark|

(d) State TO O examples of any VOIP application.

(2 mnrks|
- 25 -

(e) Outline how a ‘client server network model’ differs from a ‘peer-to-peer netw'ork model’
with regard to

Dependability .....................................................................................................................

Security ................................................................................................................................

Totsl 25 marhs

END OF TEST

IF YOU FIN ISH BEFORE TIME IS CDI I .ED, CHECK YOUR WORK ON THIS TEST.

You might also like