L-19 MCS 275 Wed 21 Feb 2001
Review Sheet for Exam I, Friday 23 February 2001
The aim of this sheet is to help you to prepare for the
upcoming exam. While it contains some sample questions, the list of
questions is by no means exhaustive.
The material covered are chapters 10 and 11 of the text book.
Chapter 9 was used for revisional purposes. Although no specific
questions on material of Chapter 9 will be asked, you must be
familiar with arrays, pointers, and two-dimensional structures.
In addition to the text book, look at
- The programs posted at
the course web site.
- The solution of the quizzes. If you missed the handout,
look at the course web site.
- Homework exercises, consult the notes of the discussion sessions.
- Project solutions. Although you will not be asked to write
complete programs, some programming concepts (like how to deal
with two-dimensional arrays) worked out there are very valuable.
Note that we spent 6 lectures on Chapter~10 and 9 lectures on Chapter~11.
Recursion is a very important concept in problem solving: you must
know the binary search algorithm and the principles of divide and conquer.
However, string processing is equally important. Study the prototypes
and definitions of strlen, strcmp, strcpy, and
strcat. Know about the sentinel in strings.
The quizzes give you a good idea of the style of questions.
Here is a list of typical questions:
What does this program do?
Here you are asked to study a piece of code and to give the output.
This piece of code may involve some character processing
(recall the arithmetic with ASCII codes) or the effects of recursion
(know how to write out the execution stack of recursive function calls
and the arguments of the functions).
Transform a given program
The transformation may involve
- A conversion from arrays into pointers, or vice versa.
For example:
you have a string processing algorithm with arrays,
convert the program using pointer arithmetic, or the
other way round.
- Rewrite an iterative algorithm as a recursive one,
or transform a recursive algorithm into an iterative version.
Especially the lecture where we reverse the characters in
a string and digits in a number is very instructive about
the different types of recursion.
Execute an algorithm on an example
Binary search and divide \& conquer are extremely important
problem solving techniques.
We have seen binary search with strings (look for a word in
a dictionary or for a name in a phone book) and on an array
of sorted integer numbers (see the first question of quiz 6).
Give the C code for...
Given the prototype of a function, or the definition of
some mathematical function (for example, Fibonacci numbers or
Chebychev polynomials), write C code to compute this definition.
Do not memorize the actual code for programs we have seen, but
familiarize yourself with important constructs such as
traversing an array with recursion, passing a result through
with an accumulating parameter in a recursive function, etc...
In preparing for the exam, it could be good to try to solve
the quizzes again, without looking first at the answer,
or try to think about variants.