
Comp128 Final Exam Review
1) Functions – Know how to set up function headers following a problem
specification, including return type and parameter lists. Know when to use the &
and when not to.
2) Decisions – Know how to use if and switch statements. You should be able to
convert from a nested if statement to a switch and vice versa. Know how to use
comparative operators such as ==, !=, <, etc. to do various tests, including testing
to see if a number is in a specified range. Know how to use the logical operators
&&, || and !.
3) Loops – Know the 3 basic loop constructs: while, do .. while and for. You should
be able to switch from one to the other.
4) Streams – Know how to use standard input and output, namely cin and cout.
Understand how to open a file and stream to/from it. Understand how to use
manipulators and stream flags to control the formatting of output.
5) Arrays – Know how to declare and initialize 1-D arrays. Be able to write
functions, which are passed arrays as parameters and need to do some processing
at each cell of the array. Understand how an array variable can also be thought of
as a pointer.
6) Strings – Know how to declare and use C-Strings, including use of functions in
the cstring library such as strcmp() strlen(),strcpy(). Understand how to use the
C++ string class.
7) Classes – Know how to declare a class including public and private member
variables and functions. Be able to implement member functions given their
specification. Know how to declare a variable whose type is a class, then use the
variable to invoke member functions.
8) Program Design – Know how to break down a large problem into smaller tasks
using top-down structured design techniques. Be able to draw a structure chart
showing functions as boxes, and using directed arrows to indicate parameter
passing. Also, know how to draw a simple class diagram, namely for each class a
rectangle divided into 3 compartments for the class name, member variables and
member functions.
9) Testing – be able to construct a driver function (usually main() ) to exercise
functions you have written and see if they are working correctly.