Computer Science | D-ITET | SS 22

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

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".

09.03.2022 Exercise Session Changes

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 I at D-ITET! Registration for the exercise sessions will open on Monday 21.02.2022.

Lectures Thursday 08:15 — 10:00 ETF 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 for D-MAVT. Additionally, TAs of other first year courses of D-MAVT students might 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
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
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
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
Thu 14-16 CHN D 42 Piet De Vaere (EN)
Thu 14-16 CHN D 44 Friederike Groschupp
Thu 14-16 CHN D 46 Leila Chettata
Thu 14-16 CHN G 22 Jan Brosi
Thu 14-16 HG E 33.3 Maline Zimmermann
Thu 14-16 online Here Simon Erni
Thu 18-20 CAB G 57 Marco Cina
Thu 18-20 CHN D 48 Johannes Majer
Fri 08-10 HG F 26.5 Silvan Krebs
Fri 14-16 HG F 26.5 Michelle Egger

Assistants marked with EN teach in English, 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: