Written Questions
Written Questions
This assignment includes written questions about a really useful debugging tool called valgrind. The questions can be completed individually or with your partner.
Before you do the written part, read about valgrind from the help pages:
Meh, I don't want to read right now, we're in the lab, ready to work on the coding part! Do we have to do the written questions first?
No, you can dive into coding now and wait to do the written questions until later. But it's useful to know about
valgrindwhen you need to debug your code, so you might not want to put it off until the last minute.
These questions use the programs in the exercises subdirectory of the assignment repository. For each one, compile with make and then run it under valgrind, reading the output carefully — valgrind gives a lot of output, but there are important clues buried in it. Ask for help if you have trouble interpreting it!
Question 1 – Exercise 1
Compile exercise01.cpp using make, then run:
valgrind --leak-check=full ./exercise01
Question 2 – Exercise 2
Compile exercise02.cpp using make, then run:
valgrind --leak-check=full ./exercise02
Question 3 – Exercise 3
Compile exercise03.cpp using make, then run:
valgrind --leak-check=full ./exercise03
Note: If valgrind gives multiple errors, your answer should focus on the first one.
Question 4 – Exercise 4
Compile exercise04.cpp using make, then run:
valgrind --leak-check=full ./exercise04
Question 5 – Exercise 5
Compile exercise05.cpp using make, then run:
valgrind --leak-check=full ./exercise05
Question 6 – Exercise 6
Compile exercise06.cpp using make, then run:
valgrind --leak-check=full ./exercise06
(When logged in, completion status appears here.)