CSS Computer Science (Optional) — Paper-I, Section-A, Topic III. These 9 patterns recur across FPSC past papers (2016, 2018, 2020). The "design a system using OOP" format is the single most reliable question type in this topic — it appears in some form almost every year, just with a different real-world scenario (university, library, medical store, student registration).
Appeared: 2016, Q2(c)
Design a Student Registration System using OOP. Define classes including Person, Teacher, Student, Course, Section, Allocation, and Registration — each with
getdata(),showdata(), and suitable constructors.
Solution (class list and relationships):
| Class | Relationship | Why |
|---|---|---|
| Person (base) | — | Shared attributes: name, age, CNIC |
| Teacher : Person, Student : Person | is-a (inheritance) | Both are specialized kinds of Person |
| Allocation | has-a Course + Teacher + Section | Records which teacher teaches which course, in which section |
| Registration | has-a Student + Course + result data | Records which student is enrolled in which course, with grade |
This is a full worked question with complete, compilable C++ code (including virtual functions and a polymorphic vector<Person*> roster) already on the Classes and Objects — Exam Practice page — see "Exam Practice: Student Registration System" there for the full listing. The University Records System variant on the same page (file-based, no virtual functions) shows the contrasting case where polymorphism must deliberately be avoided.
Appeared: 2016, Q3(c)
Design a Library Information System using OOP. Describe classes (Student, Teacher, Book, Issue Book, etc.) with appropriate data members — no code implementation required.
Solution:
| Class | Key Attributes | Relationship |
|---|---|---|
| Member (base) | MemberID, Name, ContactInfo | Shared by Student and Teacher members |
| Student : Member | RollNo, Program, MaxBooksAllowed (e.g. 3) | is-a Member, with a lower borrowing limit |
| Teacher : Member | EmployeeID, Department, MaxBooksAllowed (e.g. 10) | is-a Member, with a higher borrowing limit |
| Book | ISBN, Title, Author, CopiesAvailable | Standalone entity catalogued by the library |
| IssueRecord | Member (reference), Book (reference), IssueDate, DueDate, ReturnDate | has-a Member + has-a Book — the linking/junction class |
Key reasoning points: since the question explicitly says "no code implementation required," the marks are for correctly identifying (a) which classes should share a common base (Student/Teacher → Member, to avoid duplicating MemberID/Name), (b) which classes are linked via composition rather than inheritance (IssueRecord is not "a kind of" Book or Member — it has both), and (c) realistic, sufficient attributes per class (3–5 is the expected depth). Writing full C++ code when a question says "describe" wastes exam time without earning extra marks.
Appeared: 2016, Q4(c)
Design Medical Store software with classes Person, Customer, Salesman, Purchase (with attributes), using C++/Java syntax, applying inheritance where appropriate.
Solution: