top of page

Exercise Tips & Tricks

Here you will find every week some guidance on how to solve the exercises in addition to a rating system which tells you what exercises we think are most valuable for your learning experience. The following meaning is given to each rating

  • ★★★★★ Solve this exercises every week as they are crucial to your understanding of the topic. 

  • ★★★★☆ These exercises are a very good practice to train your skills and you should aim to solve these exercises every week. 

  • ★★★☆☆ These exercises are important but you might spend time on other more important tasks before solving these. It would be good if you solve these every week.

  • ★★☆☆☆ These exercises are probably not as exam relevant or are very time consuming for what learning effect they will have. 

  • ★☆☆☆☆ These exercises are just for fun so do whatever you want with them.

  • ✮                  This exercise is a bonus exercise you must solve it to have a chance of receiving a 0.25 grade bonus at the end of the semester. 

Exercise 0

Exercise 1

★★★★★

If you do not enroll for the class then it will be very hard to attend it, so make sure that you are enrolled.

Exercise 2

★★★★★

You need to make sure that you have the Eclipse IDE installed and that it comes with a version of Java at least 17. Use Eclipse as your IDE even though other options offer many more services. Eclipse will be the only IDE available in the exam hence getting comfortable using it is important for the exam.

Exercise 3

★★★★★

This is an important exercise. Make sure to also read the Quickguide on Eclipse that might contain some additional useful information. You may also try out some more code examples of course.

Exercise 1

Exercise 1

★★★★★

Being able to use git on Eclipse to push your solutions and to pull the new exercise projects is crucial to your ability to properly solve the exercises. Be careful when copying the link as it might contain formatting characters. Here is the link again without these formatting characters:

https://gitlab.inf.ethz.ch/course-eprog2023/students/<your_kürzel>           or with

https://gitlab.inf.ethz.ch/course-eprog2023/students/<your_kürzel>.git

If that does not work attempt to first log in online and then come back to Eclipse.

Exercise 2

★★★★

This exercise serves the purpose of changing the program for you to push the changes to gitlab in Exercise 3.

Exercise 3

★★★★★

Do this exercise and check whether the changes show up on the gitlab website inside of your corresponding project folder. Make sure to push and not just commit as else the changes are only stored locally on your computer.

Exercise 4

★★★★★

This is probably the most important exercise of this weeks exercise sheet as being able to solve EBNF exercises is crucial for the theory part of the exam. Make sure you solve this exercise. I recommend this EBNF verifying tool to check your solutions.

Exercise 2

Exercise 1

★★☆☆

You should be able to solve this exercise quickly as Eclipse will point out almost all mistakes. Do this exercise for completeness sake and because it takes almost no time to do so.

Exercise 2

★★★★★

This is a very good exercise as it will teach you how to use the print functionality in Java. It also is quite fun to solve and you may increase the difficulty by allowing to scale the flag to any size.

Exercise 3

★★★

Solve some of the exercises stated in Exercise 3 as they are good to practice your knowledge on methods and operations.

Exercise 4

★★★★★

Very important to solve, you must solve the theoretical exercises every week to make sure that you understand them as the more you practice the better your ability to solve theoretical exercises in the exam. This knowledge cannot be acquired in two weeks and thus takes practice.

Exercise 3

Exercise 1

★★★★

This exercise is good to recapitulate concepts from the lecture. As a challenge solve this exercise both iteratively (only loops) and recursively (no loops). 

Exercise 2

★★★★★

This exercise is a must, solve it using recursion as it will make it much easier to solve. 

Exercise 3

★★★☆☆

This exercise was a bonus exercise at some point. It is cumbersome but it can be solved in a somewhat compact form if you put some thought into constructing a decision tree where each leaf is one of the possible digits.

Exercise 4

★★☆☆☆

Solve this exercise when you are done with the other exercises. It is always good to practice more.

Exercise 5

★★★★

This also was a bonus exercise at some point and it is a very good exercise to apply the concepts from the lecture. Make sure to read the good programming practices Quickguide before solving this and apply the concepts learned there especially splitting your code into methods.

Exercise 6

★★★★

This exercise is incredibly important. You must be able to solve these exercises efficiently at the exam, hence practising during the semester is important. 

Exercise 4

Exercise 1

This is a very good exercise to practice both working with iteration / recursion and arrays.

★★★★

Exercise 2

This is also a good exercise to practice working with arrays. Solve at least one of the subexercises.

★★★

Exercise 3

Do this exercise, if you ever want to understand JUnit and use it as a valuable tool at the exam and for future projects now is a good moment to start learning how to use it. Read the corresponding Quickguide for it which will briefly summarise all important aspects of JUnit.

★★★★

Exercise 4

Practising working with loop invariants is the key to understanding them. Do this exercise. I can recommend the corresponding Quickguide for it.

★★★★

Exercise 5

Solving bonus exercises is very good practice for the exam as they are similar to exam exercises both in form / formulation and in what you are asked to do. Solving this is an absolute must.

★★★★★

Exercise 5

Exercise 1

★★★★

This is a very good exercise to practice your Java knowledge with. This is a bonus-style question and thus is comparable to easier exercises one could expect at the exam.

Exercise 2

★★

This exercise is not a must, it is good to get more practice but it does not add much more than the other exercises.

Exercise 3

★★★★

This is very good exercise to practice your understanding of recursion, I highly recommend solving it.

Exercise 4

★★★★

This exercise is very good to recapitulate your EBNF knowledge and make sure you are still able to solve such exercises.

Exercise 5

★★★★

This is this weeks bonus exercise. It was part of an exam (slightly modified) and hence it very suitable to practice for the exam. Absolutely solve this exercise.

Exercise 6

Exercise 1

★★★★

This is this weeks bonus exercise. I can strongly recommend solving it as it is very similar to an exam exercise and hence very good to see where you still struggle and where not.

Exercise 2

★★★☆☆

This is a good exercise as length wise it is similar to an exam exercise, you must do multiple things which will be the case at the exam and you must carefully read the exercise description.

In case you get a InputMismatchException even though everything should be working and you are using a German keyboard layout use the following line to ensure double type values are parsed correctly scannerName.useLocale(Locale.US).

Exercise 3

★★★☆☆

This is a good exercise to practice your JUnit skills with. I can recommend solving this exercise. In addition to being useful it also is quite fun to solve.

Exercise 4

★★★★★

This exercise is a must. Loop Invariants are tricks and you need to practice solving such exercises as they are not easy to understand and it requires practice to be able to solve them.

Exercise 5

☆☆☆

This exercise is purely for fun. I think it can be enjoyable to solve it but that is it. If you do not have enough time to solve the exercises focus on the other exercises. For a recap on how the GUI library works I recommend the following Quickguide.

Exercise 6

★★★☆☆

Even though this is a GUI exercise I can say that it is more helpful that the swiss flag exercise as here the task is more focused on programming and less the GUI part. For a recap on how the GUI library works I recommend the following Quickguide.

Exercise 7

Exercise 1

This exercise again allows you to practice your EBNF skills, I thus highly recommend solving it. 

★★★★★

Exercise 2

This is probably one of the best non-bonus exercises to prepare you for the exam as understanding how a LinkedList works is important to understand how to navigate all kinds of node based datastructures.

★★★

Exercise 3

This is a good addition to the LinkedList exercise, I recommend understanding which methods work differently with the Doubly LinkedList.

★★★☆☆

Exercise 4

This is the bonus exercise. You should really solve this as it is the best thing you can do to practice for the exam.

★★★★★

Exercise 5

This is a GUI exercise but it contains interesting concepts. Do this if you still have time.

★★☆☆

Exercise 8

Exercise 1

The loop invariant exercise is very important to improve your skills in the theoretical exercises.

★★★★★

Exercise 2

This exercise is a really good exercise to prepare for the exam as it was an exam exercise a year ago. I highly recommend solving it.

★★★★★

Exercise 3

This exercise is good to work with JUnit again. 

★★★☆☆

Exercise 4

This is a GUI exercise so do it if you are done with all other exercises.

☆☆☆☆

Timed Bonus

This week there will be a timed bonus exercise. It will be released on the 21.11.2023 at 17:00 and you will have time until 19:00. This is perfect practice for the exam as it gives you an estimate on where you stand even if you do not complete it fully.

★★★★★

Exercise 9

Exercise 1

This is a very typical exam exercise so it is very worth to solve. In addition to that it is also this weeks bonus exercise.

★★★★★

Exercise 2

This exercise is a short but very helpful exercise to improve your skills when it comes to working with linked nodes structures.

★★★★★

Exercise 3

This exercise is fun and every year people tend to spend many hours on getting better scores for it, if you have the time then this can be a very nice exercise.

★★★☆☆

Exercise 4

This exercise may be helpful as it involves working with different classes and teaches you how to implement more complex programs.

★★☆☆☆

Exercise 5

This exercise is very good to make sure you understand inheritance. I highly recommend solving this exercise.

★★★★★

Exercise 10

Exercise 1

★★★★★

Loop Invariant exercises are very important to solve as only with enough practice will you be able to apply the steps detailed in the Quickguide.

Exercise 2

★★★☆☆

This exercise is good to make sure you understand how to lists work. If you have the time makes sure to solve it.

Exercise 3

★★★★

This exercise is very good exam preparation especially with the amount of text. I can highly recommend this exercise.

Exercise 4

☆☆☆☆

Do this exercise if you are done with everything else.

Timed Bonus

★★★★★

This week there will be a timed bonus exercise. It will be released on the 5.12.2023 at 17:00 and you will have time until 19:00. This is perfect practice for the exam as it gives you an estimate on where you stand even if you do not complete it fully.

Exercise 11

Exercise 1

★★★★

Maps are really helpful and important for the exams make sure you understand how to use them. The same goes for Sets.

Exercise 2

★★★★★

This exercise seems not very useful at first. However every single year almost all people that solve it say that this was by far one of the most helpful exercises as it teaches you recurrsion, working with multiple methods, etc. I can highly recommend solving this exercise.

Exercise 3

💀 do this if you really have nothing else to do.

Exercise 4

★★

This exercise may be helpful to work with interfaces a bit, it also teaches you how you can use inheritance to use already existing code.

Exercise 5

★★★★

Loop Invariants are very important for the exam. They tend to come more often at exams so make sure you solve enough such exercises.

Exercise 6

★★★★★

This is this weeks bonus exercise I can highly recommend solving it.

Exercise 12

Exercise 1

★★★★★

Hoare Triple are exam relevant and hence you should solve this exercise.

Exercise 2

★★★☆☆

This exercise may help you understand better how generic types work.

Exercise 3

★★★

This exercise teaches you how to work with the Comparable Interface hence I highly recommend having a look at it.

Exercise 4

★★

This exercise is worth doing similarly to the expression evaluator exercise.

Exercise 5

★★☆☆

Do this if you have time left.

Exercise 6

★★

This exercise is worth doing similarly to the expression evaluator exercise.

Exercise 7

★★★★

This is this weeks bonus exercise and seeing as it was an exam exercise I can highly recommend it.

bottom of page