
This is the complete worked solution for the S6 Computer Science (016) NESA Advanced Level Examination, 2024–2025, sat on 15 July 2025. The paper covers combinations MCE (Mathematics-Computer Science-Economics) and MPC (Mathematics-Physics-Computer Science).
Work through each solution carefully. Where a question asks you to explain your reasoning, the explanation is included because in the actual exam, the explanation is where most marks are either won or lost.
If any topic here is giving you trouble, book a Computer Science tutor on Mathrone Academy for targeted one-on-one help before your next exam.
You can also practise alongside the S6 Mathematics II 2025 worked solutions and the S6 Physics 2025 worked solutions to cover your full combination.
DOWNLOAD THE QUESTION PAPER 👉👉 HERE TO GO ALONG WITH ANSWERS
Answer: b) Power it off and unplug it.
Before cleaning any laptop, you must switch it off completely and disconnect the power cable. This prevents electric shock, short circuits from liquid contact, and accidental input while cleaning. Harsh chemicals (option a) can damage the screen coating and plastic. Cleaning while running (option c) risks both electric shock and accidental key presses. Option d is simply unsafe practice.
Answer: b) Storing duplicate copies of data files.
A backup is a copy of data stored separately from the original so that if the original is lost, corrupted, or deleted, the data can be restored. It is not software updating (a), restarting (c), or deleting files (d).
Answer: b) 11101₂
Working column by column from right to left:
1 1 1 0 + 1 1 1 1 ---------
Result: 11101₂
Answer: a) 100010002₂
Align the numbers (pad the shorter one with leading zeros):
1 0 1 0 1 1 1 0 - 0 0 1 0 0 1 1 0 ------------------
Subtracting bit by bit (borrowing where needed):
Result: 10001000₂
Answer: b) 10001.001₂
Integer part — 17₁₀:
Repeatedly divide by 2 and record remainders:
Reading remainders bottom to top: 10001₂
Fractional part :0.125₁₀:
Repeatedly multiply by 2 and record the integer part:
Reading top to bottom: .001₂
Combined:
Answer: b) To reduce file size.
Video compression reduces the amount of storage space a video file occupies and makes it faster to stream or transfer. It does not increase quality (a) — in fact, lossy compression slightly reduces it. Adding visual effects (c) and colour grading (d) are separate editing functions unrelated to compression.
The tree structure is:
A
/ \
B C
/ \ \
D E F
Three standard traversal rules:
Answer: a) A, B, D, E, C, F
Visit A (root), go left to B, visit B, go left to D, visit D (leaf), back to B, go right to E, visit E (leaf), back to A, go right to C, visit C, go right to F, visit F (leaf).
Answer: b) D, B, E, A, C, F
Go left to D first (leaf), then B, then E, back up to A (root), then C, then F (C has no left child).
Answer: d) D, E, B, F, C, A
Left subtree first: D, E, then B. Right subtree: F, then C. Finally root: A.
Answer: b) To protect databases from unauthorized access and data breaches.
Database security encompasses authentication, authorisation, encryption, and audit trails — all aimed at preventing unauthorised users from reading, modifying, or destroying data. Availability (a) is related to reliability, not security. Performance (c) is optimisation. Schema design (d) is a design function.
Answer: b) NIC (Network Interface Card).
A NIC is the hardware component that physically connects a computer to a local area network, either via an Ethernet port or wirelessly. Printers, monitors, and keyboards are peripherals so they do not form part of the network architecture itself.
Answer: b) Configuring DHCP settings.
DHCP (Dynamic Host Configuration Protocol) configuration on a router allows it to automatically assign IP addresses to devices that connect to the network. This is a core setup step. Enabling file sharing (a) is an OS-level task done after network setup. Building Ethernet cables (c) is physical infrastructure work, not router configuration. Installing network drivers (d) is done on client machines, not the router itself.
Answer: a) 0 1 1
The program declares x = 7 and y = 5, then evaluates three Boolean expressions. In C++, Boolean comparisons output 1 for true and 0 for false.
(x == y) → Is 7 equal to 5? No → 0(x > y) → Is 7 greater than 5? Yes → 1(x != y) → Is 7 not equal to 5? Yes → 1Output printed line by line: 0, then 1, then 1.
| HTML Element | Purpose |
|---|---|
| iii) Adds a top-level heading |
| i) Adds a paragraph |
| iv) Embeds an image |
<a> | ii) Defines a hyperlink |
Answer: b) It offers convenient methods for parsing primitive types and strings.
The Scanner class provides methods like nextInt(), nextDouble(), and nextLine() that directly parse input into the required data types without manual conversion. It is not synchronised (a), does not connect directly to file streams by default (c), and is not necessarily faster (d) it prioritises convenience over raw speed.
Answer: b) To serve Java applications.
Apache Tomcat is a web server and servlet container that runs Java Servlet and JSP (JavaServer Pages) applications. It handles HTTP requests and maps them to the appropriate Java code. It does not manage databases (a), compile Java code (c that is the job of javac), or design GUIs (d).
Answer: c) To provide the user interface for interacting with the application.
In a VB project, the front end consists of the forms, controls (buttons, text boxes, labels), and layout that the user sees and interacts with directly. The back end handles logic and data management.
Answer: c) MsgBox
MsgBox is the built-in VB function that displays a dialog box with a message and an OK button. InputBox is used to receive input from the user. MessageBox is a .NET class method rather than a standalone VB function. Print outputs to the form surface, not a dialog.
| Statement | Answer | Reason |
|---|---|---|
| a) Static pages load faster as they don't rely on back-end processes. | TRUE | Static pages are pre-built HTML files served directly — no server-side processing needed. |
| b) Static pages show fixed content, while dynamic pages update based on user input. | TRUE | Static pages have the same content for every visitor. Dynamic pages generate content on request (e.g., logged-in dashboards, search results). |
| c) Static pages need server-side scripting, dynamic pages do not. | FALSE | It is the opposite. Dynamic pages require server-side scripting (PHP, Python, Java, etc.). Static pages need none. |
| Statement | Answer | Reason |
|---|---|---|
| a) Proper allocation does NOT significantly affect disk space or fragmentation. | FALSE | Allocation strategy directly determines fragmentation levels. Poor allocation causes fragmented free space, wasting disk capacity and slowing access times. |
| b) Improper allocation can slow down data retrieval and increase resource use. | TRUE | Fragmented files require the disk head to move across multiple locations to read a single file, significantly slowing retrieval. |
| c) Efficient allocation improves system performance by reducing management overhead. | TRUE | When files are allocated in contiguous or well-organised blocks, the OS spends less time tracking scattered fragments and access is faster. |
| d) File allocation is only crucial for large systems, not small ones. | FALSE | Even small systems suffer from fragmentation and poor allocation. The impact is proportionally significant regardless of system size. |
| e) A good allocation strategy compromises system reliability and recovery. | FALSE | A good strategy does the opposite — it improves reliability and makes recovery easier by keeping file metadata and data organised. |
Answer: a) To query databases using mathematical operations.
Relational algebra is a formal query language that uses operations like SELECT (σ), PROJECT (π), JOIN (⋈), UNION (∪), and DIFFERENCE (−) to retrieve and manipulate data from relational tables. It is the theoretical foundation behind SQL.
| Type of Integrity | Correct Match | What it means |
|---|---|---|
| 1) Entity Integrity | c | Every row in a table must have a unique, non-null primary key. No two rows can share the same identifier. |
| 2) Referential Integrity | b | A foreign key value in one table must match an existing primary key in the referenced table or be NULL. Prevents orphaned records. |
| 3) Domain Integrity | a | Each column only accepts values within a defined type, format, or range. For example, an age column should not accept text or negative numbers. |
| 4) User-Defined Integrity | d | Custom business rules enforced through constraints, triggers, or stored procedures — e.g., "a student cannot be enrolled in more than 8 courses." |
The array is declared as int arr[5] = {10, 20, 30, 40, 50} and ptr points to arr[4], which is 50.
sizeof(arr)/sizeof(int) = 20/4 = 5 (5 integers in the array).
| i | sizeof/sizeof − i | *(ptr − i) | Output |
|---|---|---|---|
| 0 | 5 − 0 = 5 | *(ptr−0) = arr[4] = 50 | Element 5: 50 |
| 1 | 5 − 1 = 4 | *(ptr−1) = arr[3] = 40 | Element 4: 40 |
| 2 | 5 − 2 = 3 | *(ptr−2) = arr[2] = 30 | Element 3: 30 |
| 3 | 5 − 3 = 2 | *(ptr−3) = arr[1] = 20 | Element 2: 20 |
| 4 | 5 − 4 = 1 | *(ptr−4) = arr[0] = 10 | Element 1: 10 |
The loop runs from i=4 down to i=0. *(ptr−i) += 5 adds 5 to each element via pointer. Then arr[4−i] is printed.
| i | Element modified | New value | arr[4−i] printed | Output |
|---|---|---|---|---|
| 4 | *(ptr−4) = arr[0]: 10+5=15 | 15 | arr[0] = 15 | Element 1: 15 |
| 3 | *(ptr−3) = arr[1]: 20+5=25 | 25 | arr[1] = 25 | Element 2: 25 |
| 2 | *(ptr−2) = arr[2]: 30+5=35 | 35 | arr[2] = 35 | Element 3: 35 |
| 1 | *(ptr−1) = arr[3]: 40+5=45 | 45 | arr[3] = 45 | Element 4: 45 |
| 0 | *(ptr−0) = arr[4]: 50+5=55 | 55 | arr[4] = 55 | Element 5: 55 |
Complete program output:
Elements of the array accessed using pointer: Element 5: 50 Element 4: 40 Element 3: 30 Element 2: 20 Element 1: 10 Modified elements of the array using pointer: Element 1: 15 Element 2: 25 Element 3: 35 Element 4: 45 Element 5: 55
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@WebServlet("/welcome")
public class WelcomeServlet extends HttpServlet {
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
// Set the response content type to HTML
response.setContentType("text/html");
// Get the PrintWriter to send HTML output
PrintWriter out = response.getWriter();
// Write the HTML page
out.println("");
out.println("");
out.println("Welcome ");
out.println("");
out.println("Welcome to My Java Servlet Page!");
out.println("This page was generated by a Java Servlet handling an HTTP GET request.");
out.println("");
out.println("");
}
}
Explanation of key parts:
@WebServlet("/welcome") — maps the servlet to the URL /welcome so the server knows which class handles requests to that path.doGet() — overrides the parent class method. This runs whenever a browser sends a GET request to the mapped URL.response.setContentType("text/html") — tells the browser to interpret the response as an HTML page, not plain text.PrintWriter out = response.getWriter() — gets the output stream connected to the browser.out.println(...) — sends HTML line by line to the browser, which renders it as a formatted page.#include
using namespace std;
class Employee {
private:
string name;
double salary;
public:
// Constructor to set employee details
Employee(string empName, double empSalary) {
name = empName;
salary = empSalary;
}
// Declare friend function — can access private members
friend void calculateTax(Employee emp);
};
// Friend function definition
void calculateTax(Employee emp) {
double tax = 0.30 * emp.salary; // 30% of salary
cout << "Employee Name: " << emp.name << endl;
cout << "Salary: " << emp.salary << " RWF" << endl;
cout << "Tax (30%): " << tax << " RWF" << endl;
cout << "Net Salary: " << (emp.salary - tax) << " RWF" << endl;
}
int main() {
Employee emp1("Mugisha Jean", 500000);
calculateTax(emp1);
return 0;
}
Expected output:
Employee Name: Mugisha Jean Salary: 500000 RWF Tax (30%): 150000 RWF Net Salary: 350000 RWF
Key concepts tested:
name and salary are private — they cannot be accessed directly from outside the class.friend keyword. This grants calculateTax() direct access to private members without being a class member itself.The topics tested most heavily in this paper Are binary arithmetic, tree traversals, C++ pointers, and database integrity come up every year in slightly different forms. The best way to prepare is past paper practice under timed conditions, followed by targeted revision of any topic where you lost marks.
Mathrone Academy has tutors specialising in Computer Science for MPC and MCE students. If binary conversions or C++ programming are still not clicking, find a CS tutor near you or online here.
Also check the study techniques guide for Rwandan students and the full 2026 national exams study guide and timetable to plan your revision schedule.
Computer Science paper 0 is sat by students in MCE (Mathematics-Computer Science-Economics) and MPC (Mathematics-Physics-Computer Science) combinations at S6 level under the REB/NESA curriculum.
The paper has three sections totalling 100 marks. Section A (55 marks) is compulsory and covers multiple choice and short answer questions. Section B (30 marks) requires you to attempt any three from five questions. Section C (15 marks) requires any one question from two options, typically a full programming task.
The correct answer is 11101₂. When you add the two binary numbers column by column from right to left, the carries produce a 5-bit result: 11101 in binary, which equals 29 in decimal (14 + 15 = 29 ✓).
A friend function is a function declared inside a class with the friend keyword but defined outside it. It is not a member of the class but has access to the class's private and protected members. It is used when an external function needs to work with private data without breaking encapsulation through public getter methods.
Pre-order visits Root → Left → Right. In-order visits Left → Root → Right. Post-order visits Left → Right → Root. In-order traversal of a binary search tree produces values in sorted (ascending) order.
Entity integrity ensures every row in a table has a unique, non-null primary key. Referential integrity ensures that a foreign key value in one table matches an existing primary key in another table, preventing broken relationships between tables.
Mathrone Academy publishes worked solutions for S6 past papers across subjects. See the S6 Mathematics II 2025 solutions and the S6 Physics 2025 solutions. You can also book a tutor for personalised past paper practice sessions.
⚠️Important Disclaimer
The solutions on this page are prepared by the Mathrone Academy team for revision and learning purposes only. This is not an official NESA marking scheme or REB-approved answer guide. While every effort has been made to ensure accuracy, answers and explanations may differ from the official examiners' marking guide. Always refer to your school teacher or the official NESA publications for authoritative marking guidance. Mathrone Academy accepts no responsibility for any discrepancies between these solutions and official results.
Published by Mathrone Academy connecting students worldwide with quality education resources, scholarship opportunities, and expert tutoring. Visit us at mathroneacademy.com or text us via whatsapp on +250786684285