Sun, 29th Nov 2015, 02:29 Problems where you have to insert missing instructions

A student writes:

> Dr. Patt, I did look over the 2013 exam previously when you told
> me to in the previous emails, and Part A was highly understandable. I just
> need to work more on inserting lines of instructions to a pre-written code.
> Thank you for your help,
> <<name withheld to protect the student who needs to work more...>>

I decided to share my response to this student with the whole class since
this seems to be one of the tougher kinds of problems to solve.  As I told
you last Monday, I will hold a special review session this Monday evening
to go over the 2nd midterm and we will be spending a good part of the time
on how to approach this kind of problem.  Until then, let me give you a few

When you see a problem that asks you to fill in the missing instructions,
the first thing to do is read the problem statement to make sure you
understand what the problem is that the program is supposed to solve.
If you don't understand what is being asked for, you will have zero chance
of inserting the missing instructions.

Then look at the code with the missing instructions.  Try to see what each
part of the program is doing.  Try to relate the instructions that are shown
to the requirements stated in the problem.  Try to figure out what is missing
in order to make the program complete the job.  Each problem is different so
memorizing will not work.  But going back and forth between what the program
is going to have to do and what the instructions that are given do, you should
be able to figure out what is missing.

More Monday evening.

I hope you are enjoying the weekend, and ready to attack the end of the

Yale Patt