Nivaar Exam Prep

25-Comp-A4 Program Design and Data Structures: December 2019

Nivaar worked solution (AI-drafted; not reviewed by a licensed engineer) · Last updated

  1. Question 1 Programming — Horoscope Sign and Compatibility
  2. Question 2 Programming — Reverse a Line and the Saddle Point
  3. Question 3 Programming — Crypto-Arithmetic Puzzle
  4. Question 4 File I/O — Lines and Words per Line
  5. Question 5 File I/O — Merging Two Sorted Files
  6. Question 6 Object-Oriented Design — A C++ Complex Number Class
  7. Question 7 Pointer-based Data Structures — Preorder Traversal and find_min_leaf
  8. Question 8 Linked Lists — Polynomial Representation
  9. Question 9 Algorithm Design and Sorting — Removing Duplicates

Start with Question 1 →

The cover page directs candidates to answer any six of the nine, and only the first six as they appear in the answer book are marked — so a complete paper is $6\times 20 = 120$ marks, which is the "total mark is out of 120" the paper's Note 6 states. Pseudocode or any high-level language (e.g. C or C++) is accepted, and the examiner's note states explicitly that marking emphasises the operation of the program, not syntactic details.

Reference texts for this subject.

  • Cormen, Leiserson, Rivest & Stein, Introduction to Algorithms, 4th ed. — tree walks (ch. 12), sorting and its complexity (ch. 2, 7), asymptotic analysis (ch. 3).
  • Weiss, Data Structures and Algorithm Analysis in C, 2nd ed. — arrays (ch. 1), linked lists (ch. 3), binary trees (ch. 4), searching and hashing (ch. 5).
  • Deitel & Deitel, C++ How to Program, 10th ed. — class design and operator overloading (ch. 9–11), file streams (ch. 14).
  • Kernighan & Ritchie, The C Programming Language, 2nd ed. — character/file I/O idioms (ch. 1, 7), pointers and structures (ch. 5–6).
  • Stroustrup, The C++ Programming Language, 4th ed. — value semantics, const-correctness and operator overloading (ch. 3, 11).

The Computer Engineering citation list is built around architecture and networking texts (Patterson & Hennessy, Tanenbaum, Mano); this subject is programming and data structures, so the works above are cited instead.