Computer Science practice questions (Jahziah exam)
One worked question for each of the 8 official subject areas of Computer Science, from a bank built on ETEC’s academic standards. Work them here, then practise the full set — with spaced review and timed mocks — in the app.
A software engineer must implement a data structure that supports the following operations on a collection of distinct integer keys: insert a key, delete a key, search for a key, and retrieve the predecessor of a given key (the largest key strictly smaller than the given key). The application frequently performs all four operations, and the keys are drawn from a large range. A colleague suggests using a hash table with separate chaining, claiming that its expected O(1) average time for insert, delete, and search makes it the best choice. Which statement correctly analyzes why a balanced binary search tree is actually the more appropriate implementation for this workload?
Pick an answer to check yourself.
WHY
Predecessor requires ordered keys; a balanced BST provides O(log n) predecessor, while a hash table cannot support it efficiently.
Sample — the full set, with spaced review and mocks, is in the app.
Area 02 · Architecture & organization
A 8-bit ALU adds the two's complement values 0x6B and 0x5A and stores the low 8 bits in an 8-bit register. Which statement best analyzes the result and the flags it should set?
Pick an answer to check yourself.
WHY
107+90 = 197 = 0xC5 fits in 8 bits (carry out = 0). As two's complement, 0xC5 = −59, so two positive operands yielded a negative pattern → signed overflow = 1. Option B.
Sample — the full set, with spaced review and mocks, is in the app.
Area 03 · Discrete structures
In a breadth-first traversal of a tree starting from the root, which data structure is typically used to keep track of nodes to visit?
Pick an answer to check yourself.
WHY
Breadth-first traversal processes nodes level by level; a FIFO queue is the standard data structure.
Sample — the full set, with spaced review and mocks, is in the app.
Area 04 · Information management
A database designer is describing the relational data model to a new team member. Which statement best explains the principle that underlies the relational model?
Pick an answer to check yourself.
WHY
The relational model represents data as relations (tables). Each relation is a set of tuples (rows), each tuple is an instance, and each attribute's values come from a defined domain. Associations between relations are expressed not by pointers but by matching key values. Option B states this correctly.
Sample — the full set, with spaced review and mocks, is in the app.
Area 05 · Networking
A small company network consists of three departmental LANs, each connected to a central router. This central router also connects to an ISP router, which forwards traffic across the public internet to a remote web server. A network engineer labels each device as either an edge or core component according to the standard internet structure model. Which classification is correct?
Pick an answer to check yourself.
WHY
In the edge/core model the LANs (end systems and access networks) are the edge, while routers forwarding traffic through the internet backbone — here the ISP router — belong to the core. Option B states this.
Sample — the full set, with spaced review and mocks, is in the app.
Area 06 · Operating systems
A device driver maintains a single I/O request queue for a disk. The queue is currently empty. Requests arrive in this order: X (service time 8 ms), Y (service time 2 ms), Z (service time 6 ms). The driver uses Shortest Job First (SJF) scheduling, which selects the request with the shortest service time from those currently waiting. When X arrives, it begins service immediately. While X is being served, Y and Z arrive and wait. After X completes, which request is served next and what is its waiting time?
Pick an answer to check yourself.
WHY
X is served first (8 ms). Y and Z queue during that time. When X finishes, SJF picks Y (2 ms) over Z (6 ms). Y has been waiting since it arrived (during X's service) until t = 8 ms, giving a waiting time of 8 ms.
Sample — the full set, with spaced review and mocks, is in the app.
Area 07 · Programming languages
A class `Temperature` stores a Celsius value in a private field `celsius`. The class provides a public method `setCelsius(double c)` that assigns the value but does not validate it. A client program sets `celsius` to −300 using this method. Which change best applies encapsulation to prevent invalid states, without exposing the internal field?
Pick an answer to check yourself.
WHY
Keep the field private and validate the input inside the setter, rejecting values below absolute zero; this preserves encapsulation while preventing invalid states.
Sample — the full set, with spaced review and mocks, is in the app.
Area 08 · Software engineering
A bank is adopting an agile process for a mobile banking app. The team plans two-week iterations with a prioritized backlog and a demo at the end of each iteration. Which characteristic of agile processes does this plan most directly illustrate?
Pick an answer to check yourself.
WHY
Short iterations, a prioritized backlog, and end-of-iteration demos embody iterative and incremental delivery with continuous customer feedback, the central agile characteristic.
Sample — the full set, with spaced review and mocks, is in the app.
Practise CS questions in the app.
Create a free account: your free trial is 50 practice questions and one timed mock, no card and no time limit. Every question explains why each option is right or wrong.