(16 May) Computer Science (CS) Mock Exam: Question Paper 101 Marks
(16 May) Computer Science (CS) Mock Exam: Question Paper 101 Marks
m
co
o.
oj
o nd
si
vi
re
Question 1
A restaurant uses an object-oriented program to manage the cost of the food and drink consumed by
customers. Everytime a table is occupied a `Payment`object is instantiated which will contain details of
the items ordered. As each item is ordered, a `FoodItem`or a `DrinkItem`object is added to the
`Payment`object as appropriate.
m
fiCount = 0;
diCount = 0;
} co
o.
public DrinkItem getDi(int x)
oj
{
nd
return dix;
}
o
m
co
o.
oj
o nd
2. State the implication of the use of the term `static`in the `Payment`class. [2]
si
vi
re
3. With reference to two examples from the classes in the resource, explain the benefits [4]
gained by the use of different data types.
m
4. Describe the purpose of the following statement:
co [3]
o.
`**private** FoodItem[] fi = **new** FoodItem[100]`
oj
o nd
si
vi
re
5. The `Payment`class method `addFoodItem()`is passed a `FoodItem`object as a [3]
parameter.
Construct the method `addFoodItem()`.
m
co
o.
oj
o nd
si
vi
re
Question 2
1. The `Arrival`object has two methods named `compareWith`. [2]
m
co
o.
oj
o nd
3. [1]
vi
re
Question 3
A sorting algorithm needs to be implemented using selection statements.
1. Construct code that finds the minimum value in an array numbers of integers. [4]
m
co
o.
Explain how the if statement is used in your code to compare values.
oj
2. [2]
o nd
si
vi
re
3. Define the term 'local variable' and explain its scope in the context of your code. [2]
Question 4
An online education platform tracks students and their courses. The platform has a Student class and a
Course class.
private String courseName;
private int courseCode;
private Student[] enrolledStudents;
m
public void enrollStudent(Student student) {
// code to add a student to the enrolledStudents array
co
}
}
o.
oj
public class Student {
private String studentID;
nd
this.name = name;
re
this.activeStatus = true;
}
2. Explain the purpose of the `setActiveStatus` method in the Student class. [2]
m
co
o.
oj
3. [3]
o
si
vi
re
4. Outline one benefit of setting Student attributes as private. [2]
m
co
o.
oj
o nd
si
vi
re
Question 5
A task scheduler needs to manage tasks with varying priorities.
1. Describe how a priority queue differs from a regular queue. [2]
2. Outline how a priority queue can be implemented using a linked list. [2]
m
co
o.
oj
o nd
si
vi
re
3. Construct the method insertTask to add tasks into the linked list in order of priority. [6]
m
co
o.
oj
o nd
si
vi
re
Question 6
A company is developing a suite of financial software tools, utilizing programming teams in different
countries.
1. Discuss the use of programming teams in software development projects. [4]
m
co
o.
oj
Outline two reasons why using programming teams in different locations may be [4]
nd
2.
problematic.
o
si
vi
re
3. Describe one advantage and one disadvantage of object-oriented programming for the [4]
development of financial software tools.
m
co
o.
oj
o nd
si
vi
re
Question 7
A simulation game includes classes such as Vehicle, Car, and Bicycle. Both Car and Bicycle inherit from
Vehicle.
1. Explain the term encapsulation. [2]
m
2. [3]
co
o.
oj
o nd
si
vi
re
3. Explain two advantages of modularity in program development for this game. [4]
m
co
o.
oj
o nd
si
vi
re
Question 8
In a university system, a Course object is related to multiple Student objects. Each student is enrolled in
one or more courses.
1. Describe the relationship between the Course and Student objects in this scenario. [2]
Construct a UML class diagram showing Course and Student with an appropriate
m
2. [3]
relationship.
co
o.
oj
o nd
si
vi
re
3. Explain one benefit of defining clear relationships between objects in a program. [2]
Question 9
The Treatment object needs to be developed further. There are three possible types of treatment and
this is to now be recorded.
1. Construct diagrams to show how inheritance can be used to re-design the Treatment [6]
class.
m
co
o.
oj
o nd
si
vi
re
2. Describe three advantages of modularity in program development. [6]
m
co
o.
oj
o nd
si
vi
re
Question 10
Computer-aided design incorporates 2D and 3D visualization. A car manufacturer decides to adapt a
current design to include extra features. The designer starts by loading a wire frame version of the
current design.
1. Outline the way in which the wire frame graphic represents the car design. [2]
m
2. Identify one change to the design of the car that could be made using the wire frame. [1]
co
o.
oj
nd
3. Outline how the wire frame could be manipulated to make this change. [2]
o
si
vi
re
4. Outline how the designer could interact with the computer in order to achieve this. [2]
5. Identify two changes to the interior and exterior that the designer may want to make. [2]
6. Describe the visualization techniques that would be applied to convert the wire frame to a [6]
3D view of the car, as it would appear when manufactured.
m
co
o.
oj
o nd
si
vi
re