Promotional exam answering toolkit
← Index · Sources and reliability notes
Purpose
These are concise answer frames adapted mainly from Star Notes: Model Answers & Answering Techniques. They are not an official mark scheme. Always apply the wording to the question’s scenario, supplied interface and stated interface.
How to use an answer frame
Give the definition or mechanism, identify the relevant fact from the scenario, then state the resulting effect. A memorised definition without application usually does not complete an “explain”, “justify” or “discuss” response.
1. Algorithms, functions and pseudocode
Function versus procedure
| Choice | Exam-ready justification |
|---|---|
| Function | Use a function because the task must return a value to its caller so that the value can be stored, tested or used by another expression/module. Name the required returned value. |
| Procedure | Use a procedure when the task performs an action but does not need to return a value to its caller. Name the action or state change. |
Python functions return None when they reach the end without an explicit return. In a question, distinguish returning a value from printing it or mutating an object.
Pseudocode conventions
The 2027 syllabus states that no specific pseudocode syntax is required; logical correctness is what matters. Use consistent indentation, meaningful identifiers and unambiguous bounds. If a paper supplies conventions, follow them.
Common readable forms include:
OPENFILE filename FOR READ
READFILE filename, line
WRITEFILE filename, data
CLOSEFILE filename
WHILE condition
statements
ENDWHILE
REPEAT
statements
UNTIL condition- Declare an array with its stated lower and upper bounds; do not assume all arrays begin at index 1.
DIVdenotes integer quotient andMODdenotes remainder where those operators are defined. For negative operands, follow the question’s convention rather than assuming Python’s exact behaviour.- Do not assume a fixed meaning for
INT()orRAND()unless the paper defines it. - A function returns a result; a procedure call performs its specified action.
- For a file question, show open → read/process or write → close, including end-of-file handling where needed.
Trace-table explanation
A trace table simulates an algorithm step by step and records relevant variable, condition and output changes. Comparing its results with expected results can reveal logic errors.
Use one column per value that is necessary to follow the algorithm. Record a value again only when it changes or when the paper’s layout requires it.
2. Program errors, testing and recursion
Explain an error in context
| Error | Answer frame |
|---|---|
| Syntax | The statement breaks a grammar rule of the language, so it cannot be parsed/executed as written. Identify the exact invalid syntax. |
| Runtime | The program begins running but an operation fails during execution, such as invalid conversion, division by zero, missing file or invalid index. Identify the triggering input/state. |
| Logic | The program runs but its algorithm produces the wrong result. State the incorrect operation/condition and show the consequence for the given data. |
Test-plan checklist
For each case, state the input, reason for choosing it and expected result.
- Normal: valid, typical data.
- Boundary: a valid value at or immediately around an allowed limit, selected according to the rule being tested.
- Erroneous: invalid data that should be rejected or handled.
- Add empty, singleton, duplicates, ties or negative values when the function’s contract makes them relevant.
Explain recursion
The function calls itself on a smaller or otherwise progressing version of the problem. A reachable base case returns without another recursive call. Each call must progress towards that base case.
For a call-stack question:
- Each unfinished call has a stack frame containing its local state and return location.
- A recursive call pushes another frame.
- The base case returns first.
- Frames then resume and are removed in last-in, first-out order while deferred calculations are completed.
When comparing recursion with iteration, relate the choice to the problem. Recursion may express a recursively structured solution clearly but uses a growing call stack and function-call overhead. Iteration stores progress explicitly and normally avoids that stack growth.
3. Object-oriented programming
Definitions that must be applied
- Encapsulation: groups attributes and methods in one class and controls interaction through its public interface. In context, name a private attribute and the method that reads or safely changes it.
- Information hiding: clients use the interface without depending on internal representation. This supports implementation independence.
- Inheritance: a subclass reuses or extends suitable members of a superclass. Identify the actual “is-a” relationship.
- Polymorphism: the same method call can invoke different appropriate implementations for objects of different classes. Name the shared method and contrast its behaviours.
- Instantiation: creates a new object from a class; its constructor initialises that object’s state.
Class-diagram checklist
- Separate class name, attributes and methods.
- Include visibility, types and parameters when required.
- Put common members in the superclass and specialised members in subclasses.
- Point the inheritance arrow towards the superclass.
- Include constructors/getters/setters only when required by the design or question; do not add them mechanically.
Software reuse and maintenance
Explain the mechanism, not just the benefit:
- Inheritance places shared code in the superclass, so subclasses reuse it instead of duplicating it.
- Encapsulation gives other code a stable interface, allowing internal implementation changes with fewer dependent changes.
- Polymorphism lets new suitable subclasses provide the same operation without adding repeated type checks throughout client code.
4. Linear linked lists
Describe insertion using pointer order
For insertion between previous and current:
- Obtain/create
newand store its data. - Set
new.next = currentto preserve the remaining list. - Set
previous.next = newto connect the earlier list to the new node. - If inserting at the head, set
new.nextto the old head and then updatehead = new.
For an array free-list representation, save the free node’s successor before overwriting its link. Update the free-list head, fill the node, and only then connect it into the active list.
Describe deletion
Locate the target while retaining its predecessor. For a middle node, set previous.next = current.next. For the head, update head = head.next. If a static free list is used, link the released node to the old free-list head and then make it the new free-list head.
Mention empty list, head, tail/singleton and missing-target cases where relevant. “Insertion/deletion is O(1)” is only justified once the required node/predecessor is already known; locating it may require traversal.
5. Stacks and queues
Core definitions
| Structure | Definition | Main operations |
|---|---|---|
| Stack | Last in, first out; the most recently inserted live item is removed first. | Push at top; pop from top; peek without removal. |
| Queue | First in, first out; the earliest unserved live item is removed first. | Enqueue at rear; dequeue from front; peek without removal. |
For fixed-capacity structures, overflow is an attempted insertion when full; underflow is an attempted removal when empty. State the paper’s required error behaviour: exception, message, sentinel or Boolean.
Array implementation answers
Define each pointer before describing an operation. A top pointer may mean the last occupied cell or the next free cell; queue rear may mean the last item or the next insertion position. Derive empty/full tests from the stated convention instead of memorising one formula.
For circular queues, advance with modulo capacity and distinguish empty from full using the question’s chosen method, such as a count or reserved slot. Read/display from front in logical FIFO order, not simply from the array’s leftmost index.
Linked implementation answers
- Linked stack: push and pop at the head/top.
- Linked queue: enqueue at rear and dequeue at front.
- On removing the final linked-queue node, update both front and rear to the empty value.
- A linked representation avoids a fixed array capacity but still depends on available memory and uses link storage.
6. Relational databases
Keys
- Primary key: chosen candidate key; uniquely and minimally identifies each record and cannot be NULL.
- Composite key: multiple attributes used together as a key.
- Foreign key: attribute(s) referencing a candidate/primary key in another or the same table. Values must match a referenced key, or may be NULL only when the relationship and constraint permit it. Foreign-key values may repeat.
- Secondary/alternate key: use the definition taught by the school for the question; in this pack it means an unchosen candidate key.
Explain redundancy and anomalies with scenario data
- Redundancy: the same fact is stored unnecessarily in multiple records.
- Update anomaly: one copy is changed but another is missed, producing conflicting values.
- Insertion anomaly: one fact cannot be stored until an unrelated fact is also available.
- Deletion anomaly: removing a record unintentionally removes the only stored copy of another needed fact.
Always name the repeated or lost fact. Do not claim that linked tables automatically update one another: cascading behaviour occurs only when explicitly configured.
Normalisation answers
- State what one row represents and identify the candidate/composite key.
- Reach 1NF by removing repeating groups and ensuring atomic values.
- Reach 2NF by removing partial dependencies of non-key attributes on part of a composite key.
- Reach 3NF by removing relevant transitive dependencies between non-key attributes.
- Preserve every required fact and label primary/foreign keys in the resulting relations.
7. Data representation
- A bit is one binary digit; a byte is eight bits. A byte is not defined as “one character”.
- ASCII defines 128 seven-bit codes.
- Unicode assigns code points to characters across many scripts and symbol sets.
- UTF-8 is one variable-length encoding of Unicode code points. Do not say that Unicode itself always uses one to four bytes.
- For a comparison, distinguish repertoire/code points from a particular byte encoding.
For base conversion, show place values or repeated division, preserve required leading zeroes and label the base. Hexadecimal is useful because each hex digit maps exactly to four bits, giving a shorter human-readable representation of a binary pattern.
8. Ethics, impact and Singapore laws
For a discuss question, develop both benefit and harm where appropriate:
stakeholder → technology feature/action → immediate effect → wider consequence → possible mitigationUseful dimensions include communication/access, privacy, misinformation, wellbeing, digital divide, productivity, job displacement, reskilling and costs. Avoid generic lists: tie each point to the stated technology and affected stakeholder.
For laws, identify the triggering action before naming the law:
- CMA: unauthorised access/modification/interference and related computer misuse.
- POFMA: online false statements of fact and the statutory public-interest framework for directions.
- POHA: harassment, threatening/abusive communication, stalking or doxxing in applicable circumstances.
- PDPA: an organisation’s collection, use, disclosure and protection of identifiable personal data.
For professional ethics, link integrity, competence, confidentiality, responsibility and public interest to a concrete developer decision.
9. Networks
Explain a mechanism
Use: component/protocol → information examined → action → result.
- Switch: examines destination MAC address and forwards a frame through the appropriate LAN port using its MAC table.
- Router: examines destination IP information and its routing table to select an outgoing interface/next hop between networks. It does not guarantee the globally fastest route.
- Gateway: translates between unlike protocols/formats when that is the role stated.
- DNS resolver: checks suitable cached data, then obtains an answer through the DNS hierarchy; referrals and queries are not simply “one recursive climb”.
- DHCP: supplies leased network configuration; it does not resolve a website’s name.
Address and encapsulation distinctions
- A remote host remains the destination IP; the first local frame is normally addressed to the default gateway’s MAC.
- Link-layer addresses and frames change at router hops; endpoint IP addresses normally remain unless NAT/tunnelling or another stated mechanism changes them.
- TCP sequencing, acknowledgement and retransmission support ordered reliable delivery. UDP does not provide those guarantees, but UDP still has a checksum field.
- Error detection can exist at several layers. Do not claim that packet error detection is “only in TCP” or that every checksum sits in a generic packet trailer.
Comparison answers
Compare along the same dimensions: setup, delivery guarantees, ordering, overhead/delay and application requirements. Finish by applying the comparison to the scenario rather than saying one protocol is universally better.
Final 30-second check
- Did I answer the command word?
- Did I use a fact from the scenario?
- Did I state the mechanism and consequence?
- For code, did I meet the exact return/print/mutation contract?
- For pointers, did I preserve the next node before redirecting a link?
- For comparisons, did I compare the same dimension on both sides?
- Did I avoid an absolute claim that depends on implementation or configuration?