Computer Science | D-MAVT | SS 22

Course catalog: 252-0832-00L
Lecturers: Dr. Ralf Sasse, Dr. Malte Schwerhoff

Primary educational objective is to learn programming with C++. When successfully attended the course, students have a good command of the mechanisms to construct a program. They know the fundamental control and data structures and understand how an algorithmic problem is mapped to a computer program. They have an idea of what happens "behind the scenes" when a program is translated and executed. Secondary goals are an algorithmic computational thinking, understanding the possibilities and limits of programming and to impart the way of thinking of a computer scientist.

The course covers fundamental data types, expressions and statements, (Limits of) computer arithmetic, control statements, functions, arrays, structural types and pointers. The part on object orientation deals with classes, inheritance and polymorphism, simple dynamic data types are introduced as examples. In general, the concepts provided in the course are motivated and illustrated with algorithms and applications.

Date Message

Opt-in on Moodle if you would like a US keyboard during the exam.


Added information about the Code Expert exam environment to the Exams section.


Solution for Exercise 6 Task 1 on CodeExpert has been extended to mention that overflows could occur in any case, which would result in undefined behavior.


Minor update of slides 344 and 345 regarding namespaces (lecture of 24.03., week 5), similarly in the associated lecture code example "Including Functions".

01.04.2022 Exercise Session Changes

Eric's session (Tue 16-18) has been permanently moved to LFW C 4.

The following changes are temporarily in action:

None - All exercise sessions take place as planned.


The study center will take place on Mondays and Thursdays at 18:15 → 20:00, starting in the third week of the semester (March 7th).


Registration to the exercise sessions is open:

Register now on [code]expert. You can join the forums on Moodle that will be the hub for all informal communications of general interest.

Welcome to Computer Science at D-MAVT! Registration for the exercise sessions will open on Thursday 24.02.2022.

Lectures Thursday 10:15 -- 12:00 ETA E 1, Livestream on the video portal

The (German spoken) lectures are recorded. Videos will be made available at ETH's video portal, on the direct link (only works after first lecture).

The study center is offered twice a weak, for 2 hours, starting in the third week of the semester (March 7th). Use the Study Center to ask additional questions on the covered material or get code-level help with your exercises.

Monday: 18:15 — 20:00 in HG D 7.1
Thursday: 18:15 — 20:00 in HG E 1.1

The Study Center is shared with Informatics 1 for D-ITET. Additionally, TAs of other first year courses should be present on Monday.

Note that Study Center will not take place on the following dates: Mon April 18th (Easter), Thu April 21st (Easter Break), Mon April 25th (Sechseläuten), Thu May 26th (Ascension).

This is a plan. No plan survives contact with reality. Regularly check the agenda for changes.

Independent of the information published here, a new set of exercises is released every Thursday morning on CodeExpert.

Week Date Topic Lecture Additional Material Exercises
1 24.02. RS: Integer Arithmetic and its Limits (1) Einführung in die Informatik
Overlays [de] [en]
Handout [de] [en]
(2) Integer Arithmetic and its Limits
Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Organisational Information
Ariane 5 Video ❘ Details
Clicker: Ausdruckswert
Summary 00 | Summary 01
C++ Tutorial
Exercise session slides (de)
Exercise session slides (en)
Exercise 1
2 03.03. RS: Boolean Functions, Safe Programming, Control Flow I Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: Mixed Int. Expr.
Summary 02
Self-Assessment 0 (Moodle)
Slides: For-Loop
Slides: Assert
Exercise 2
3 10.03. MS: Control Flow II, Floating Point I Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: for-Loop
Summary 03
Program Tracing with Scopes
Slides: Expressions and Loops
Self-Assessment 1 (Moodle)
Exercise 3
Bonus Exercise 1
4 17.03. RS: Floating Point II, Functions I Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: Overhang
Summary 04
IEEE FP Converter
Tracing Function Calls
Slides: Numeral Representations
Comparing Floating Point Numbers
Floating Point Guidelines
Exercise 4
5 24.03. RS: Functions II, Reference Types I Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: 110
Clicker: Intersect Intervals
Summary 05
Self-Assessment 2 (Moodle)
Slides: Exercises 1
Slides: Exercises 2
Exercise 5
6 31.03. MS: Reference Types II, Vectors and Strings Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: Referenzen
Clicker: Vectors
Summary 06
Slides: Self Exercise (Solution)
Slides: References
Exercise 6
7 07.04. MS: Vectors and Strings II, Recursion I Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: Recursion
Summary 07
Towers of Hanoi (EN)
Handout: Theory
Exercise 7
8 14.04. RS: Recursion II, Structs Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: Recursion (2)
Clicker: EBNF
Summary 08
Slides: Exercise Session
Handout: Theory
Exercise 8
Bonus Exercise 2
21.04. Easter break
9 28.04. RS: Structs and Overloading, Encapsulation and Classes Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: Eisenbahn
Summary 09
Self-Assessment 3 (Moodle)
Handout: Theory
Exercise 9
10 05.05. MS: Dynamic Data Types and Pointers Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Additional Pointer Slides
Clicker: Pointers I
Clicker: Constructors
Summary 10
Slides: Exercise 1
Slides: Exercise 2
Handout: Theory
Exercise 10
11 12.05. MS: Iterators and Containers Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: Pointers II
Clicker: Recursive Structs
Summary 11
Exercise 11
Bonus Exercise 3
Handout: Theory
12 19.05. MS: Memory Management with Classes Overlays [de] [en]
Handout [de] [en]
Code Examples
Lecture Video
Clicker: Copy Constructor
Summary 12
Self-Assessment 4 (Moodle)
Handout: Theory
Exercise 12
26.05. Ascension Day
13 02.06. RS, MS: Subtyping, Polymorphism and Inheritance; General Exam Information; Fun Quiz with Prizes Overlays [de] [en]
Handout [de] [en]
Code Examples, Quiz
Lecture Video
complete course:
Overlays [de] [en]
Handout [de] [en]

Time and place

The following exercise sessions are offered:

Time Place Zoom Link Assistant
Tue 14-16 IFW A 32.1 Velko Vechev (EN)
Tue 16-18 LFW C 4 LFW C 11 Eric Schreiber
Tue 16-18 ML J 37.1 Manuel Kansy
Wed 14-16 CAB G 52 Claudio Anliker
Wed 14-16 ETZ H 91 Céline Bornhauser
Wed 14-16 ETZ K 91 Aaron Häusler
Wed 14-16 IFW A 32.1 Konstantin Kalenberg
Wed 14-16 IFW C 31 Manuel Mekkattu
Wed 14-16 IFW D 42 Cinzia Müller
Wed 14-16 LEE D 101 Julia Näf
Wed 14-16 LEE D 105 Arielle Rüfenacht
Wed 14-16 LFV E 41 Theresa Stecher
Wed 14-16 ML F 40 Matthieu Rimlinger (EN)
Wed 14-16 ML H 41.1 Mark Benjamin Kuhne
Wed 14-16 ML H 43 Guirec Maloisel (EN)
Wed 14-16 ML J 34.1 Christopher Otto
Wed 14-16 NO D 11 Clemens Walter
Wed 14-16 NO E 39 Julian Weber
Wed 14-16 online Here Korrawe Karunratanakul (EN)
Wed 16-18 ETZ K 91 Carolin Beer
Wed 16-18 LEE D 101 Nicolas Küchler
Wed 16-18 NO E 39 Ilyas Seckin (EN)

Assistants marked with EN and FR teach in English and French, respectively, all others in German.

Backoffice assistants

Role Assistant Notes
Head TA Linard Arquint Main contact for administrative questions

Open C++ Tutorial To facilitate the introduction to the lecture, especially for beginners in programming, we will provide an introductory tutorial, which can be completed autonomously. We strongly recommend to complete it in the first week of the semester. The tutorial is available in both German and English. You can switch the language any time.



Prof. Dr. Bernd Gärtner and Dr. Michael Hoffmann kindly provided a script (lecture notes) that covers most of the material presented in the lecture. It contains additional details, but is unfortunately no longer maintained, and thus partly outdated.

Other Useful Resources

Code Expert Exam Environment

The Code Expert exam environment is configured slightly differently than the exercise environment. Main differences: more permissive (e.g. warnings instead of errors, vector[i] is allowed), and in larger tasks, you can run tests individually. If you are interested, try the Code Expert exam environment now.

Old Exams

You can find many old exams in our exam collection. Word of caution: