Skip to navigation | Skip to main content | Skip to footer

COMP20021: Imperative Programming with C and C++ (2007-2008)

This is an archived syllabus from 2007-2008

Imperative Programming with C and C++
Level: 2
Credit rating: 10
Pre-requisites: COMP10081 or COMP10580
Co-requisites: No Co-requisites
Duration: 11 weeks in first semester
Lectures: 22 in total, 2 per week
Labs: 18 hours in total, 9 2-hour sessions
Lecturers: Aphrodite Galata
Course lecturer: Aphrodite Galata

Additional staff: view all staff
Sem 1 w1-5,7-12 Lecture 1.1 Tue 10:00 - 11:00 -
Sem 1 w1-5,7-12 Lecture 1.1 Fri 14:00 - 15:00 -
Sem 1 w2,4,7,9,11 Lab Dual Thu 11:00 - 13:00 H
Sem 1 w2,4,7,9,11 Lab Dual Mon 14:00 - 16:00 F
Sem 1 w2,4,7,9,11 Lab Dual Tue 15:00 - 17:00 G
Sem 1 w3,5,8,10,12 Lab UNIX Fri 10:00 - 11:00 H
Sem 1 w3,5,8,10,12 Lab UNIX Thu 10:00 - 11:00 G
Sem 1 w3,5,8,10,12 Lab UNIX Tue 13:00 - 14:00 F
Assessment Breakdown
Exam: 70%
Coursework: 0%
Lab: 30%


This course unit introduces students to the C and C++ programming languages and the tools used to support them.

Learning Outcomes

A student completing this course unit should:

Be able to critically compare C, C++ and Java and identify the strengths and weaknesses of each for a given application area (A2, A3, B3).
Understand the syntax and structure of C and C++ programs (A2).
Be able to design C and C++ programs to meet requirements expressed in English (B2).
Write and debug programs in both languages using appropriate tools (C5, C6).
Use 3rd party libraries of functions or classes (C5).
Understand how C and C++ are implemented on the host architecture (A3).

Assessment of Learning outcomes

Learning outcome (1) is assessed by examination. Learning outcome (2), (4) and (5) in the laboratory, and learning outcome (3), and (6) by both examination and in the laboratory.

Contribution to Programme Learning Outcomes

A2, A3, B2, B3, C5, C6, D4


Introduction and Motivation [1]

What C and C++ are used for (embedded systems, operating systems, real-time systems, device drivers, computer graphics). Brief recap on the CPU/store model. Compilation of Java to its VM and byte-codes compared with compilation of C/C++

I/O in C [2]

File handling, incompatibilities between operating system versions (e.g. handling of carriage return)

Esoteric Features [1]

Variable parameter function calls, dark and scary features (`,', `?:', goto, break, continue) Variations on a theme: overview of Objective C, C# and C++ [1]

Basic C++ [1]

Simple class definition, similarities with Java (private, public, protected). Constructors and Destructors.

Inheritance and Virtual Functions [1]

The QT toolkit as an example of a deep hierarchy of conserved functions. Virtual functions and dynamic binding (comparison with Java methods). Multiple inheritance compared to Java interfaces.

Introduction to Exercise 3: A drawing program [1]

A more complex program. Use of multilple files, a makefile and the linker. Dynamic data structures, a hierarchy of drawing primitives (bitmaps, poly-lines). An event based programming model.

Templates and the STL [2]

Class templates for implementing generic constructs like vectors, stacks, lists, queues that can be used with any arbitrary type. C++ templates provide a way to re-use source code as opposed to inheritance and composition which provide a way to re-use object code. Function templates as a way of building generic algorithms.

C++ behind the scenes [1]

How C++ classes are `implemented in C'; constructors and destructors and virtual functions. What inherited classes look like in memory.

C++ Type system [1]

Old style deprecated casts and coercions. New style casts (const, static, dynamic and void) and the run-time type system.

C and C++ Best practice [1]

Side effects, obfuscated C, dangers of multiple inheritance, mad operator overloading. Use const.