Checking Your Prerequisite Knowledge
Following are some questions that will help you to assess whether or not you
have the expected prerequisite knowledge for MTH517.
You should be able to answer the questions easily, and completely.
If you are able to answer the questions, it is likely (but not
necessarily the case) that you have adequate prerequisite knowledge
for MTH517.
- Write a C++ program that:
- Elegantly (use a
typedef
) declares an array of floats
- Allows the user to store values in the array (as many as the
user wants, upto the array size)
- Passes the array to function that uses a loop to sums the values,
and returns the sum for output in the main routine
- Passes the array to a recursive function that uses recursion to
sum the values, and returns the sum for output in the main routine
- Write a C++ class to implement complex numbers, including member
functions to input, output, add, and multiply.
- Write a C++ class to implement a square matrix, including member
functions to input, output, add, multiply, and transpose.
Write a simple driver program to test the class.
- Write a C++ class to implement a linked list, including member
functions to output, add a node a node at the start or end of the list,
add a node before or after a specified node, delete a specified node.
- Write a C++ program that reads in words from a file and stores the words
in alphabetical order in a linked list, with each node holding
the word and a count of the number of occurences of the word.
The file name is supplied as a command line argument, and when the file
has been read, the words and their occurrence counts are output.
- Trace (using pen and paper) the execution of a sort algorithm (choose
one you are familiar with) on an array, showing the contents of the
array each time it changes.
- Write an algorithm for a game of football or baseball. You may assume
that each play has one of a finite number of outcomes, e.g., for
football, possible outcomes are: a gain of N yards, sack, incomplete,
etc.