Pascal programming exam exercise

Hey, i have to write an exam and here is an example of the actual exam exercise, can someone please explain me how it works and how i'm supposed to do it. Below the code there is a table where the empty spots needs to be filled in order to complete the exercise.