Grade by Grade
Ontario · Grade 12 · ICS4U

Computer Science

A. Programming Concepts and Skills

Data Types, Files and Expressions

Welcome to Grade 12 Computer Science. This first unit takes the data types and expressions you used in ICS3U and studies them the way a first-year university course does: precisely, at the edges, and with an eye on how real software can go wrong.

You will use integer division and remainders to build real algorithms (digit processing, base conversion, Euclid's GCD and check digits such as the Luhn algorithm). You will master type conversion between strings, characters, integers and floats, and see how types convert inside an inheritance hierarchy (upcasting and downcasting in Java, isinstance in Python). You will learn exactly how strings and objects are compared, and make your own classes comparable, the Python version of Java's Comparable interface. You will meet the limits of finite representation: integer bounds, two's complement and overflow, and the precision and rounding errors of floating-point numbers, and you will design algorithms that work around them. You will build one-dimensional arrays of records and objects, and store them in external files: text and CSV files, binary files, JSON, XML and an SQLite database. All the way through you will practise professional code maintenance: solving errors independently with the documentation, and documenting your own code to industry standards.

All code is Python 3 (version 3.9 or later; 3.12 or later is recommended). You need only a computer with Python installed (free from python.org; the Thonny editor is a friendly choice) or a free browser-based Python editor that can create files. Every lesson has worked examples, programs whose exact output is shown, a hands-on activity, practice with answers, and a quiz. Code inside practice questions is shown one line per bullet: type it rather than copying it, because copied spacing may not work. Programs and comparisons with Java are included because many university courses use Java.

This unit builds on ICS3U, especially Programming Basics (data types, binary, ASCII and Unicode) and Arrays and Subprograms (lists, functions, sorting). The other ICS4U units continue from here: Modular and Object-Oriented Design (classes, encapsulation, inheritance and polymorphism in depth), Algorithm Design and Analysis (searching, sorting, recursion, 2D arrays and testing), Software Development Team Project, and Topics in Computer Science.

Curriculum: The Ontario Curriculum, Grades 10 to 12: Computer Studies (2008, revised), Computer Science, Grade 12, University Preparation (ICS4U), strand A. Programming Concepts and Skills: A1.1 to A1.5 (data types and expressions), A3.1 (reading from and writing to external files), A4.1 (using support documentation independently to resolve issues) and A4.3 (fully documented code to industry standards).

1Integer Division and Remainders
70 min
A1.1 A4.3
2Algorithms Built on Remainders: Digits, Bases, GCD and Check Digits
75 min
A1.1 A4.3
3Type Conversion: Strings, Characters and Numbers
70 min
A1.2 A4.1
4Non-Numeric Comparisons: Comparing and Sorting Strings
70 min
A1.3 A1.2
5Limits of Finite Representation: Integer Bounds and Overflow
70 min
A1.4 A1.1
6Limits of Finite Representation: Floating-Point Precision and Rounding Errors
75 min
A1.4 A1.2
7One-Dimensional Arrays of Records
70 min
A1.5 A1.3
8Arrays of Objects: State, Behaviour and References
75 min
A1.5 A1.3 A4.3
9Making Objects Comparable
70 min
A1.3 A1.5 A4.3
10Type Conversion in an Inheritance Hierarchy
65 min
A1.2 A1.5
11Reading and Writing Text and CSV Files
75 min
A3.1 A1.2 A1.5 A4.1
12Binary Files and JSON
75 min
A3.1 A1.2 A1.4 A1.5
13XML Files and Databases
75 min
A3.1 A1.2 A1.5
14Code Maintenance: Using Documentation to Fix Errors Independently
65 min
A4.1
15Code Maintenance: Documenting Code to Industry Standards
65 min
A4.3 A4.1
16Data Types, Files and Expressions: Unit Review
40 min
A1.1 A1.2 A1.3 A1.4 A1.5 A3.1 A4.1 A4.3
C. Designing Modular Programs

Modular and Object-Oriented Design

In Grade 11 you learned to write functions and to split a program into subprograms. In this unit you learn to design programs the way professional teams do: as collections of modules, classes and abstract data types that are easy to understand, test, reuse and change.

You will start with functional decomposition and then spread programs across multiple files, using modules and packages. You will write your own classes, protect their data with encapsulation, and plan whole systems with CRC cards and UML class diagrams. You will build the classic abstract data types (stacks, queues and dictionaries), then reuse code with inheritance, overriding, polymorphism and overloading, and design for reuse with composition and functions as parameters.

Real programs are rarely written from scratch, so you will also learn to enhance existing code without breaking it, using regression tests. Throughout, you will document your code to industry standards (docstrings, comments, PEP 8) and write user documentation such as help screens, READMEs and manuals. The unit ends with a complete multi-file project: an ice-arena booking system.

All code is Python 3. You need a computer with Python installed (IDLE, Thonny and VS Code are free). Multi-file programs work best in a desktop editor, since some browser-based Python sites support only one file. Programs in grey code boxes can be copied and run; code inside practice questions uses special spaces for indentation, so type it in yourself.

Related units: Data Types, Files and Expressions (Unit 1) covers the Python basics used here; Algorithm Design and Analysis measures the efficiency of the searches, sorts and data structures you build; Software Development: Managing a Team Software Project applies this unit's design process to a full team project.

17Functional Decomposition: Designing Subprograms Top-Down
70 min
C1.3 C1.4
18Modules and Packages: Programs Across Multiple Files
70 min
A2.1 C1.4
19Classes as Building Blocks: Constructors, Methods and Class Attributes
75 min
C1.2 A2.1 A2.2
20Encapsulation: Protecting an Object's Data
75 min
C1.2 A2.2
21Object-Oriented Design with CRC Cards and UML
75 min
C1.1 C1.2
22Abstract Data Types: Stacks, Queues and Dictionaries
75 min
C1.1 C1.2 C1.4
23Inheritance as a Design Tool: Generalization and Hierarchies
70 min
A2.2 C1.4
24Overriding, Overloading and Polymorphism
75 min
A2.2 C1.4
25Designing for Reuse: Composition, Interfaces and Libraries
70 min
C1.4 A2.2 A2.1
26Documenting Modules, Classes and Interfaces
70 min
A4.3 C1.4
27User Documentation: Help Files, Manuals and Training Materials
70 min
A4.4 A4.3
28Modifying Existing Modular Code to Add Features
75 min
A2.3 A2.2 C1.4
29Putting It Together: A Modular Object-Oriented Project
75 min
A2.1 A2.2 A2.3 C1.1 C1.2 C1.3 C1.4 A4.3 A4.4
30Modular and Object-Oriented Design: Unit Review
40 min
A2.1 A2.2 A2.3 C1.1 C1.2 C1.3 C1.4 A4.3 A4.4
A. Programming Concepts and Skills

Algorithm Design and Analysis

In Data Types, Files and Expressions and Modular and Object-Oriented Design you built the pieces of larger programs. In this unit you learn to design the algorithms inside them, and to prove with evidence that they are correct and efficient. This is the heart of computer science, and the part of ICS4U that leads most directly into first-year university courses.

You start by specifying algorithms precisely: preconditions (the starting state), postconditions (the ending state) and loop invariants. Then you learn to measure efficiency in two ways: by timing programs, and by counting statements, loop iterations and comparisons to find an algorithm's Big-O.

With those tools you design and analyse the classic array algorithms: linear and binary search (and when each is the better choice), subprograms that insert and delete array elements, insertion sort compared with the selection and bubble sorts from ICS3U, and algorithms on two-dimensional arrays, including matrix multiplication and processing the pixels of an image.

The second half is about recursion: base cases and the call stack, efficient recursive designs (fast power, numbers into words, fractals, XML parsing), the classic pitfalls (infinite recursion and the exponential growth of naive Fibonacci), and merge sort, an O(n log n) divide-and-conquer sort. The unit ends with formal test plans: unit, integration, regression and randomized testing with Python's unittest module.

All code is Python 3 and every program has been run to check its output. You need only a computer with Python (IDLE or Thonny are free) or a free browser-based Python, plus everyday items such as playing cards, an egg carton and graph paper for the hands-on activities.

31Specifying Algorithms: Preconditions, Postconditions and Loop Invariants
70 min
C2.1 A4.2
32Measuring Efficiency: Run Times, Counting Steps and Big-O
75 min
C2.2 C2.3
33Linear Search in Depth: Records, Variations and Analysis
70 min
A3.2 C2.2 C2.1
34Binary Search: Halving the Problem
75 min
A3.2 C2.1 C2.2
35Linear versus Binary Search: Run Times and Complexity
70 min
C2.2 A3.2
36Subprograms to Insert and Delete Array Elements
70 min
A3.3 C2.1 C2.2
37Insertion Sort
70 min
A3.4 C2.3 C2.1
38Comparing Sorting Algorithms: Counting and Timing
75 min
C2.3 A3.4
39Two-Dimensional Arrays: Rows, Columns and Traversals
70 min
A3.5 C2.2
402-D Array Algorithms: Matrix Multiplication and Image Pixels
75 min
A3.5 C2.1 C2.2
41Thinking Recursively: Base Cases and the Call Stack
70 min
A3.6 C2.4 C2.1
42Recursive Algorithms: Numbers to Words, Fractals and XML
75 min
A3.6 C2.1
43Recursion Pitfalls: Infinite Recursion and Exponential Growth
70 min
C2.4 A3.6 C2.1
44Merge Sort: Divide and Conquer
75 min
A3.6 A3.4 C2.3 C2.1
45Formal Test Plans for Algorithms: Unit, Integration and Regression Testing
75 min
A4.2 C2.1
46Algorithm Design and Analysis: Unit Review
40 min
A3.2 A3.3 A3.4 A3.5 A3.6 A4.2 C2.1 C2.2 C2.3 C2.4
B. Software Development

Software Development: Managing a Team Software Project

In Grade 11 you built small programs through the whole software development life cycle. In Grade 12 the programs get bigger, and so does the job: you will manage a software project as part of a team, the way it is done in industry and in university capstone courses.

The unit follows one guided team project from start to finish: LendIt, an equipment-lending program for the (fictional) Maple Grove Community Centre, which lends snowshoes, skates, cross-country skis and board games to its members. A four-person team (Priya the project manager, Jordan the lead developer, Amara the tester and Luc the documentation lead) shows every step, and role cards and project event cards let you run the project yourself, alone or with friends or family playing the other roles.

You will plan a project (scope document, requirements and user stories, work breakdown, deliverables, estimates, risks and a schedule), manage it with Gantt charts, PERT and critical path analysis, calendars and task boards, write design documents, keep your source code safe and shared with Git (commits, branches, merges and conflicts, shared repositories), write a formal test plan with unit, integration, regression and acceptance tests using Python's unittest, keep the project on track with status reports, burndown charts and change control, manage your own time, write user documentation and training materials, deploy and close the project, and finally review the project and reflect on your own and your team's work.

Every lesson ends with a project step for your own team project, so by the end of the unit you will have a complete project portfolio. Every code sample uses Python 3 and runs exactly as shown; Git examples use the free git program (or a browser-based alternative described in the lessons). The sibling units Modular and Object-Oriented Design (designing classes and modules), Algorithm Design and Analysis (searching, sorting, recursion and their testing), Data Types, Files and Expressions and Topics in Computer Science: Sustainability, Ethics, Emerging Technologies and Careers supply the code your project will use.

Curriculum: The Ontario Curriculum, Grades 10 to 12: Computer Studies (2008, revised), Computer Science, Grade 12, University Preparation (ICS4U), strand B. Software Development: overall expectation B1 (managing the software development process through all of its stages: planning, development, production and closing; specific expectations B1.1 to B1.7) and B2 (applying project management techniques in a student-managed team project; B2.1 to B2.3). The unit also teaches two code-maintenance expectations from strand A: A4.2 (a formal testing plan with unit, integration and regression testing) and A4.4 (external user documentation such as help files, training materials and user manuals).

47Software Projects and Teams: Stages, Models and Roles
70 min
B2.1 B1.2
48Requirements, User Stories and the Scope Document
75 min
B1.1
49Work Breakdown, Deliverables, Estimates and Risks
75 min
B1.1 B1.4
50Scheduling Tools: Gantt Charts, PERT Networks, the Critical Path, Calendars and Task Boards
75 min
B1.4 B1.1
51Design Documents: Architecture, Data, Interfaces and Traceability
75 min
B1.2 B1.3
52Managing Source Code: Shared Folders and Version Control with Git
75 min
B1.7
53Teamwork with Git: Branches, Merges, Conflicts and Code Review
75 min
B1.7 B2.1
54A Formal Test Plan, Part 1: Unit Testing with unittest
75 min
A4.2 B1.3
55A Formal Test Plan, Part 2: Integration, Regression, System and Acceptance Testing
75 min
A4.2 B1.3
56Keeping a Project on Track: Progress, Burndown, Earned Value and Change Control
75 min
B1.2 B1.4
57Managing Your Own Time in a Team Project
70 min
B2.2 B2.1
58User Documentation, Training Materials and Deployment
75 min
A4.4 B1.3
59Closing the Project: Acceptance, Delivery, Support and Maintenance
70 min
B1.5 B1.3
60Project Review and Reflection: Plan versus Actual
75 min
B1.6 B2.3
61Software Development: Managing a Team Software Project: Unit Review
40 min
A4.2 A4.4 B1.1 B1.2 B1.3 B1.4 B1.5 B1.6 B1.7 B2.1 B2.2 B2.3
D. Topics in Computer Science

Topics in Computer Science: Sustainability, Ethics, Emerging Technologies and Careers

This unit looks at the responsibilities that come with computing, and at where computer science can take you next.

Environmental stewardship and sustainability (D1). You will measure the full footprint of computing (embodied and operational emissions, data-centre energy, Ontario's grid), learn how programmers write greener software, look at health through ergonomic standards and Ontario workplace rules, and investigate government and community initiatives such as producer responsibility and the 2024 federal right-to-repair amendments.

Ethical issues (D2). You will analyse ethical issues with four lenses and stakeholder maps, then apply them to privacy and personal data (including k-anonymity and Canadian privacy law), intellectual property (piracy, downloading, licences, plagiarism), artificial intelligence (bias, fairness audits and how governments are regulating AI), and everyday practice (phishing, passwords and cyberbullying). You will compare the ACM and IEEE codes of ethics.

Emerging technologies and society (D3). You will analyse who benefits and who pays when a technology spreads, model adoption with a logistic function, and investigate an emerging technology in a technical report, website, presentation or video.

Exploring computer science (D4). You will read ACM and IEEE publications on interdisciplinary research (with the edit-distance algorithm used in both biology and linguistics), investigate theoretical computer science (graphs, automata and the halting problem), research careers and postsecondary pathways, and evaluate your own Essential Skills and work habits.

This unit builds on Grade 11 (ICS3U) Topics in Computer Science and uses the Python from Data Types, Files and Expressions, Modular and Object-Oriented Design and Algorithm Design and Analysis. Every lesson has explanations, worked examples, tested Python 3 code, diagrams, a hands-on activity, practice with answers and a quiz. Laws, programs and statistics were checked in October 2026 and are stated with dates; they change, so recheck them before you rely on them.

Curriculum: The Ontario Curriculum, Grades 10 to 12: Computer Studies (2008, revised), Computer Science, Grade 12, University Preparation (ICS4U), strand D. Topics in Computer Science: D1.1 to D1.2, D2.1 to D2.3, D3.1 to D3.2 and D4.1 to D4.4.

62The Full Footprint of Computing: Embodied Carbon, Data Centres and the Grid
70 min
D1.1
63Green Software: Writing Code That Uses Less Energy
70 min
D1.1
64Healthy Computing: Ergonomic Standards and Workplace Rules
65 min
D1.1
65Investigating Sustainability Initiatives: Governments, Companies and Communities
70 min
D1.2
66Analysing Ethical Issues in Computing: Lenses, Stakeholders and Trade-offs
70 min
D2.1
67Privacy and Personal Data: Law, Re-identification and Privacy by Design
75 min
D2.1 D2.3
68Intellectual Property: Piracy, Downloading, Licences and Plagiarism
70 min
D2.1 D2.2
69Codes of Ethics for Computing Professionals: ACM, IEEE and Beyond
70 min
D2.2
70Ethics of Artificial Intelligence: Bias, Accountability and Regulation
75 min
D2.1 D3.1
71Ethical Computing in Practice: Phishing, Passwords and Cyberbullying
70 min
D2.3 D2.1
72Emerging Technologies and Society: Who Benefits and Who Pays?
70 min
D3.1
73Investigating an Emerging Technology: Technical Reports and Evidence
75 min
D3.2
74Interdisciplinary Research: Reading ACM and IEEE Publications
75 min
D4.1
75Theoretical Computer Science: Graphs, Automata and the Limits of Computing
75 min
D4.2
76Careers and Postsecondary Pathways in Computer Science
70 min
D4.3
77Evaluating Your Essential Skills and Work Habits
60 min
D4.4
78Topics in Computer Science: Sustainability, Ethics, Emerging Technologies and Careers: Unit Review
40 min
D1.1 D1.2 D2.1 D2.2 D2.3 D3.1 D3.2 D4.1 D4.2 D4.3 D4.4

Curriculum strands

AProgramming Concepts and Skills

BSoftware Development

CDesigning Modular Programs

DTopics in Computer Science