Past exam of the mathematics course of the University of Cambridge 2006 ib Paper 1 6D a Solution Created 2026-09-24 Updated 2026-10-14
Use columnwise partial pivoting: select the largest absolute entry in the current column and interchange rows. In the first column the pivot is , so interchange rows 1 and 2. The multipliers are and , and elimination givesThe second pivot is , so interchange the two remaining rows. Their previously stored first-column multipliers must also be interchanged. The final multiplier is , giving the LU decompositionThe permutation matrix orders the original rows as . Multiplication verifies the displayed identity.
Past exam of the mathematics course of the University of Cambridge 2006 ib Paper 1 12F ii Solution Created 2026-09-24 Updated 2026-10-14
Parametrize the logarithmic spiral byThe map is continuous into the ambient plane, hence into with its subspace topology, and it is onto by the definition of the spiral. It is injective because its radius determines uniquely, even when the angular coordinate winds through repeated turns.
Every point of is nonzero. The inverse is thereforethe restriction of a continuous function on the punctured plane. Hence is a homeomorphism and the spiral is homeomorphic to the real line. Its accumulation at the origin causes no failure of this argument: the origin is not included in .
Past exam of the mathematics course of the University of Cambridge 2006 ib Paper 1 12F i Solution Created 2026-09-24 Updated 2026-10-14
The product topology on consists of arbitrary unions of rectangles , with open in and open in . Equivalently, these rectangles form a basis.
The empty set is the empty union, and is itself an allowed rectangle. An arbitrary union of sets of this form is still a union of allowed rectangles. Finally,which is an allowed rectangle because the factor topologies are closed under finite intersections. Distributing intersection over unions shows that the intersection of any two product-open sets is product-open; induction handles all finite intersections. These verify every topology axiom. Rectangles alone are generally not a topology, which is why their arbitrary unions are included.
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 9 e Solution Created 2026-09-24 Updated 2026-10-14
A collections library can specify a
List<E> Java interface, with different implementations such as ArrayList<E> and LinkedList<E>. A method accepting List<E> can iterate or access elements according to the documented list contract without requiring one particular storage representation. Each implementation may also extend its own appropriate class superclass.The benefit is separating a usable contract from its implementation. A parameter restricted to a concrete
ArrayList<E> would exclude a linked list implementation and unnecessarily expose the storage choice. Requiring all providers to extend one concrete class would couple them to its implementation and consume Java's single class-inheritance relationship. Interfaces permit multiple implemented contracts, though clients must rely on the stated contract rather than assuming every optional operation is supported or has the same time complexity. Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 9 d Solution Created 2026-09-24 Updated 2026-10-14
A growable-array library should store its backing Java array and logical size in private fields in Java. Public methods such as
add, get and remove can enforce bounds and keep the size consistent with the stored elements. The representation can later change without requiring clients to modify direct field accesses.The benefit is preserving invariants through encapsulation. If clients could assign the size or replace the backing Java array directly, they could create negative sizes, report elements that do not exist, or modify entries without the library's checks. Accessor methods should not expose a mutable backing object indiscriminately, since a private field alone does not prevent that indirect route. Private fields also do not provide a general security boundary against privileged reflection or native code; the point here is ordinary library access discipline.
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 9 c Solution Created 2026-09-24 Updated 2026-10-14
A collections library can supply a genuinely generic method in Java whose own type parameter connects the input element and the result element type:For example,
java
static <T> java.util.List<T> oneElement(T item) {
java.util.List<T> result = new java.util.ArrayList<T>();
result.add(item);
return result;
}List<String> xs = oneElement("sample"); is type-checked without a cast. The method can also construct a List<Integer> from an integer object. The standard library's Collections.singletonList is another example of this type relationship, though its returned list is unmodifiable.The benefit is one reusable implementation with compile-time argument/result consistency. A raw
List result would lose element-type information, invite unchecked calls and require casts that may fail later. Separate methods for every element type would duplicate code. Merely enclosing a concrete type in angle brackets, such as returning List<String>, does not make a method generic; the method here declares <T>. Type erasure means the guarantee is primarily a source-level type check, not a distinct runtime class for each type argument. Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 9 b Solution Created 2026-09-24 Updated 2026-10-14
An immutable library value such as
java.lang.String can be a final class in Java. No class can extend it, so a client receiving a String cannot secretly receive a subclass that changes the behavior of its methods. This protects assumptions about value semantics in code using strings as keys or trusted identifiers.The benefit is a closed implementation contract. Without
final, subclasses might override methods inconsistently or introduce behavior incompatible with the library's intended guarantees. Making a class final does not by itself make its fields immutable; a correct immutable implementation also controls its state. The cost is that clients cannot customize it by inheritance and must instead use composition or a different abstraction. Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 9 a Solution Created 2026-09-24 Updated 2026-10-14
A graphical-component library can provide
protected void paintComponent(Graphics g) as a subclass customization hook, as in javax.swing.JComponent. A subclass overrides it to draw its own contents while the library retains responsibility for the surrounding painting protocol. A protected method in Java is accessible to code in the declaring package and to subclasses in other packages subject to the receiver restriction; it is not simply a public method and not exclusively subclass-visible.The benefit is controlled extensibility without exposing an ordinary client operation. If the method were private, external subclasses could not override and reuse it as the intended hook. If it were public, arbitrary clients could call it outside the normal painting lifecycle and the library would have a wider public contract to maintain. Protected hooks still require documented invariants because subclass code participates in the implementation.
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 8 b ii Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 8 b i Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 8 a iv Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 8 a iii Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 8 a ii Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 8 a i Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 7 c Solution Created 2026-09-24 Updated 2026-10-14
Use LRU replacement, or a modest recency-based approximation, for eligible buffer-cache entries. Unlike individual memory accesses, buffer cache lookups already pass through operating system code. Updating an LRU replacement list on each lookup is therefore practical: remove the accessed entry from its old position and put it at the most-recent end; choose the oldest unpinned entry as victim. A hash lookup plus a doubly linked recency list makes this bookkeeping constant time.
Good temporal locality favors retaining recently used blocks. FIFO page replacement's arrival-only criterion can evict a block used moments ago. CLOCK page replacement can save bookkeeping, but the difficulty of observing arbitrary memory references that motivates it is absent for software-mediated block accesses. Dirty victims require write-back, so a policy can favor an old clean buffer or arrange background cleaning without discarding recent hot data. A long one-pass scan can pollute pure LRU replacement; scan-resistant variants are useful refinements rather than a reason to ignore recency altogether.
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 7 b Solution Created 2026-09-24 Updated 2026-10-14
A buffer cache keeps copies of device blocks in main memory, indexed by device identity and block number. It reduces expensive repeated device reads and can combine several modifications into one write. It also gives software a controlled place to hold data while requests are in progress.
On a read, the operating system looks up the block. A valid cached copy gives a hit and supplies the data; a miss reserves an eligible buffer, writes its old contents first if dirty, issues the device read, and marks the new contents valid when the transfer completes. A write modifies the buffer and marks it dirty. Under a write-back policy, a later flush or eviction sends it to the device; under write-through, completion also waits for the required device write. Dirty state differs from “currently in use”: a pinned or locked buffer cannot simply be reused while a request depends on it.
A buffer cache needs synchronization for concurrent readers, writers and in-flight transfers, and should avoid inconsistent independent copies of the same block. Explicit flushes and ordering are needed when durable storage is required; caching alone does not guarantee that an acknowledged in-memory update survives a crash. Replacement chooses among eligible buffers, preserving dirty data before reuse.
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 7 a iii Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 7 a ii Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 7 a i Created 2026-09-24 Updated 2026-09-24
Past exam of the mathematics course of the University of Cambridge 2006 ia Paper 5 6 b Solution Created 2026-09-24 Updated 2026-10-14
Represent a binary search tree by:Assume the provided For equality-type values, call
sml
datatype ('k, 'v) dict = Empty
| Branch of ('k, 'v) dict * 'k * 'v * ('k, 'v) dict;lookup d key returns NONE or SOME value, and update d (key, value) returns the updated binary search tree. Traverse the first dictionary, retaining only a key with the same value in the second:sml
fun intersection equal d1 d2 =
let
fun visit Empty result = result
| visit (Branch (left, key, value, right)) result =
let
val r1 = visit left result
val r2 =
case lookup d2 key of
NONE => r1
| SOME other =>
if equal (value, other)
then update r1 (key, value)
else r1
in
visit right r2
end
in
visit d1 Empty
end;intersection (op =) d1 d2. An explicit value comparison parameter also handles values for which Standard ML does not define built-in equality. This distinguishes absent keys from defined values without reserving a sentinel value.Every inserted entry belongs to both input dictionaries with the same value, so the result agrees with each. Conversely, each common equal-valued entry is visited in
d1, found in d2, and inserted. Any dictionary agreeing with both can contain only those entries. Thus the result is exactly the largest common dictionary, not merely an intersection of key sets. If d1 has entries, lookup height is , and maximum result-tree height during insertion is , the time complexity is for constant-cost comparisons. Logarithmic heights require a balancing assumption; an ordinary unbalanced binary search tree can have linear height. There are unlisted articles, also show them or only show them.