Learning Resources

S6 Computer Science 2025 Past Paper: Full Worked Solutions

Mathrone Academy
S6 Computer Science 2025 Past Paper:  Full Worked Solutions
News Image

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 

Section A: Attempt ALL Questions (55 marks)

Question 1 : Laptop Safety Precaution (2 marks)

 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.

Question 2: What is a Backup? (3 marks)

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).

Question 3: Binary Arithmetic (8 marks)

i) 1110₂ + 1111₂ (2 marks)

Answer: b) 11101₂

Working column by column from right to left:

  1 1 1 0
+ 1 1 1 1
---------

Result: 11101₂

ii) 10101110₂ − 100110₂ (2 marks)

 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₂

iii) 17.125₁₀ = ( )₂ (4 marks)

 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: 17.12510=10001.0012

Question 4:  Video Compression (3 marks)

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.

Question 5: Binary Tree Traversals (6 marks)

The tree structure is:

        A
       / \
      B   C
     / \   \
    D   E   F

Three standard traversal rules:

i) Pre-order Traversal

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).

ii) In-order Traversal

 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).

iii) Post-order Traversal

Answer: d) D, E, B, F, C, A

Left subtree first: D, E, then B. Right subtree: F, then C. Finally root: A.

Question 6:  Database Security (3 marks)

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.

Question 7: LAN Architecture Component (2 marks)

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.

Question 8: Setting Up a Wireless Router (3 marks)

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.

Question 9: C++ Program Output (5 marks)

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.

Output printed line by line: 0, then 1, then 1.

Question 10: HTML Element Matching (4 marks)

HTML ElementPurpose

<h1>
iii) Adds a top-level heading

<p>
i) Adds a paragraph
<img>iv) Embeds an image
<a>ii) Defines a hyperlink

Question 11 (5 marks)

i) Why is the Scanner class preferred for user input in Java? (3 marks)

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.

ii) Primary purpose of Apache Tomcat (2 marks)

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).

Question 12 (5 marks)

i) Role of the Front End in a Visual Basic project (3 marks)

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.

ii) Function to display a message box in Visual Basic (2 marks)

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.

Question 13: Static vs Dynamic Web Pages: True or False (6 marks)

StatementAnswerReason
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.

Section B: Worked Solutions (Attempt any THREE)

Question 14: File Space Allocation in Operating Systems: True or False (10 marks)

StatementAnswerReason
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.

Question 15 : Relational Algebra and Data Integrity (10 marks)

i) Purpose of relational algebra (2 marks)

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.

ii) Data Integrity Type Matching (8 marks)

Type of IntegrityCorrect MatchWhat 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."

Question 17: C++ Pointer and Array Program Output (10 marks)

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).

First loop:  accessing elements backwards via pointer:

isizeof/sizeof − i*(ptr − i)Output
05 − 0 = 5*(ptr−0) = arr[4] = 50Element 5: 50
15 − 1 = 4*(ptr−1) = arr[3] = 40Element 4: 40
25 − 2 = 3*(ptr−2) = arr[2] = 30Element 3: 30
35 − 3 = 2*(ptr−3) = arr[1] = 20Element 2: 20
45 − 4 = 1*(ptr−4) = arr[0] = 10Element 1: 10

Second loop: modifying elements (adds 5 to each) then printing arr[4−i]:

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.

iElement modifiedNew valuearr[4−i] printedOutput
4*(ptr−4) = arr[0]: 10+5=1515arr[0] = 15Element 1: 15
3*(ptr−3) = arr[1]: 20+5=2525arr[1] = 25Element 2: 25
2*(ptr−2) = arr[2]: 30+5=3535arr[2] = 35Element 3: 35
1*(ptr−1) = arr[3]: 40+5=4545arr[3] = 45Element 4: 45
0*(ptr−0) = arr[4]: 50+5=5555arr[4] = 55Element 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

Section C: Worked Solutions (Attempt any ONE)

Question 19:  Java Servlet for HTTP GET Request (15 marks)

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:

Question 20:  C++ Friend Function for Tax Calculation (15 marks)

#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:

Study Smarter for Your Next Exam

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.

Stay Connected with Mathrone Academy
WA Channel WA Group TG Channel TG Group

Frequently Asked Questions

What combinations sit Computer Science at A-level in Rwanda?

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.

How is the S6 Computer Science paper structured?

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.

What is the correct answer for binary addition 1110₂ + 1111₂?

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 ✓).

What is a friend function in C++ and why is it used?

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.

What are the three binary tree traversal orders?

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.

What is the difference between entity integrity and referential integrity?

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.

Where can I find more S6 past papers with worked solutions?

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

🎯 VIGNETTE AD TRIGGER — fires on next page interaction