Question 1
HLPaper 1A number of devices in and around the home can be operated by control systems.
A home owner wishes to install automatic lights to illuminate a water fountain in her garden. These lights will automatically turn on at sunset and turn off at sunrise.
Describe two hardware components that would be an essential part of this control system.
Explain the concept of feedback, with respect to computer control systems in general.
The home owner has also installed a control system that waters the flowerbeds in the garden. This system aims to maintain the water content of the flowerbeds between a minimum and a maximum value. However, the system is only activated when the light intensity is below a certain level.
Outline the algorithm involved in controlling the watering system described above.
Question 2
SLPaper 1A company has 600 employees whose names are currently stored using a collection called NAMES
. The names are stored as surname, first name. For example: Smith, Jane, Uysal, Rafael, Ahmed, Ishmael, Jonsonn, Sara, …
The names in the collection are kept in a random order. However, it would be more useful if they were kept in alphabetical order.
The company’s staff list is now organized in the arrays in alphabetical order.
A binary search was used to find a specific name in the array.
Construct a pseudocode algorithm that will store the surnames in one array and first names in another.
Construct a pseudocode algorithm that will sort the surnames into alphabetical order using the bubble sort method. The order of the first names must also be changed so that they keep the same index as their corresponding surname.
Describe the process a binary search would follow to find a record in the surname array.
Outline one benefit of using sub-programmes to implement your algorithms from parts (a) and (b).
Question 3
SLPaper 1For an identified application, explain why a binary search would be preferred to a linear search.
Question 4
SLPaper 1Describe the steps involved in using the bubble sort algorithm to sort an array.
Question 5
SLPaper 1A school has 100 students. All student names (strings) and student ID numbers (five-digit integers) are held in two separate one-dimensional arrays named SID
and SNAMES
.
For example, student Pia Baranger has ID number 11876.
A binary search algorithm is not used to find a particular name in arraySNAMES
.
The school offers its sporting program to students and has a basketball team, a tennis team and a football team. Each student must choose at least one of these three sports.
Three collections,BASKETBALL, TENNIS
and FOOTBALL
, are created. When a student chooses a sporting activity, their ID number is added to the appropriate collection.
For example:
BASKETBALL={10011, 11876, 10122}
TENNIS={10011, 11876, 10002}
FOOTBALL={10011, 10002, 22103, 32000}
The method isIn(X, COL)
is available, where:
X
is a five-digit integer representing an ID numberCOL
is a collection that holds student ID numbers.The method isIn(X, COL)
returns True
if the ID number X
is in the collection COL; False
otherwise.
For example:
isIn(11876, BASKETBALL)
returns True
isIn(11876, FOOTBALL)
returns False
The football and tennis training sessions are held at the same time. The football coach would like to know how many students will not be able to attend the football training session because they will be attending the tennis training session.
State the reason for not using a binary search.
Construct an algorithm in pseudocode for the method isIn(X, COL)
.
Construct an algorithm in pseudocode that will output the number of students who have chosen both tennis and football. The method isIn()
should be used in your answer.
The school coordinator would like to check whether there are students who have not yet chosen any one of the three sports.
Construct an algorithm in pseudocode that will output the names of students who have not yet chosen any one of the three sports. An appropriate message should be displayed if every student has chosen a sport.
Question 6
SLPaper 2An airport uses an object-oriented program to keep track of arrivals and departures of planes. There are many objects in this system and some are listed below.
The code below outlines the Arrival
class used in this program.
public class Flight
{ private String id;
public String getId() {return this.id;}
// ... more variables, accessor and mutator methods
}
**
public class** Arrival
{ private Flight myFlight;
private String sta; // Scheduled Time of Arrival ('hh:mm')
private int runway;
private String gate;
private int delay;
private boolean landed;
public Arrival(Flight myFlight, String sta)
{ **this.**myFlight = myFlight;
**this.**sta = sta;
**this.**runway = 0;
**this.**gate = null;
**this.**delay = 0;
**this.**landed = false;
}
public void addDelay(int newDelay)
{ **this.**delay = newDelay;
}
public String getETA()
{ // calculates the Estimated Time of Arrival (ETA) of the flight
// by adding the delay to the sta and returning the result as a
// String ('hh:mm')
}
public int compareWith(String flightID)
{ if (myFlight.getID().equals(flightID)) { return 0; }
else { return 1; }
}
public int compareWith(Arrival anotherArrival)
{ // missing code
}
// ... plus accessor and mutator methods
}
The code below outlines part of the FlightManagement
class used in this program.
For the purposes of this exam only arriving flights are being considered.
public class FlightManagement
{
private Arrival[] inbound; // array of inbound airplanes
private int last = -1; // index of last used entry
public FlightManagement()
{ inbound = new Arrival[200];
}
public void add(Arrival newArrival)
{ // missing code that adds the newArrival to the array inbound
// sorted by ETA, and updates last
}
private int search (String flightID)
{ // missing code that searches the array inbound and
// returns the index of the Arrival object with flightID
}
public Arrival remove(String flightID)
{ Arrival result;
int index = search(flightID);
result = inbound[index];
while (index < last)
{ inbound[index] = inbound[index + 1];
index++;
}
last--;
return result;
}
// ... many more methods
}
The method search
in the FlightManagement
class searches the array inbound
and returns the index of the Arrival
object with the given flightID
.
Outline the general nature of an object.
Describe two disadvantages of using Object Oriented Programming (OOP).
Outline one advantage of using modularity in program development.
State the relationship between the Flight
object and the Arrival
object.
Construct a UML diagram to represent theArrival
object.
Construct the method search
implementing a linear search. Use the first compareWith()
method in the Arrival
object.
You may assume that an Arrival
object with the given flightID
exists in the array inbound
.
Outline one advantage of using a binary search.
Outline one disadvantage of using a binary search.
Question 7
HLPaper 1An oil and gas company has a networked computer system for use of their employees in the Head Office.
The company also uses the internet to enable communication with employees working on exploration and production in many remote geographical areas.
The sub-sea oil and gas exploration and production unit of the company relies on thousands of kilometres of pipeline which are monitored by a computer control system which can detect leaks.
The process of detecting leaks is carried out by sensors which are continuously monitoring changes in the flow and pressure of the liquids in the pipes.
This data is processed on a computer in the office.
If any of sensor values are outside of the acceptable parameters stored on a disk in the office, the following error routines are performed:
Identify one hardware security measure that will ensure that confidential data from the Head Office cannot be accessed.
Identify one software security measure that will ensure that confidential data from the Head Office cannot be accessed.
Identify one network security measure.
Explain the environmental benefit of using a computer control system to monitor the pipeline.
Explain the relationship between sensors, output transducers and processor in this situation.
Construct a system flowchart to represent the process described above.
Question 8
SLPaper 1A medical centre uses a computer system to manage both patients’ data and appointments. This system, which is used by the doctors, nurses and secretaries, has two unordered files: a patients’ file and an appointments’ file, both of which can only be accessed sequentially.
Every evening the following processing takes place:
Outline the pseudocode that the processing must follow when the system sends out the text reminders.
Describe two different methods that the medical centre could use that would allow data to be restored should it be lost for any reason.
The medical centre is concerned about the privacy of the data it is storing and has to make decisions concerning:
Discuss the issues that should be considered before making these decisions.
Question 9
SLPaper 1Outline the need for a translation process from high level language to machine code.
Question 10
SLPaper 1Identify one fundamental operation of a computer.
Distinguish between fundamental and compound operations of a computer.