CPSC 225 Intermediate Programming Fall 2005

Exam Review Information

Midterm 1

Midterm 1 will be written (not on the computer) and in a regular class period. It will be closed book/notes.

The main topics that will be covered are listed below.

Basic C++ Programming

Functions

Arrays

Classes & Objects

Characters & Strings

There are a lot of routines for manipulating characters and strings (both C-strings and C++ strings) - you should know the major ones (generally those mentioned above and/or those used in homeworks) and should be familiar with the others, but you won't be expected to memorize every possible routine. For the less common things, you might be given a list of function prototypes (but no descriptions) and be asked to use the appropriate one(s) to accomplish a particular task.

Files

Things like formatting of output (two decimal places, in columns, etc) might appear on a bonus but wouldn't be required.

Miscellaneous

Again, you don't have to know every standard library function in existence, but you should know how to use the ones used in class examples and homeworks (like sqrt, pow, rand, srand).

Stacks & Queues


You are responsible for everything in the assigned reading (chapters 1-5, 6.1-6.2, 7.1-7.2, 8-9, 10.1-10.2, 11.1, and 12) even if it wasn't specifically mentioned in class and/or it isn't specifically listed above. However, the exam is only 55 minutes long - which limits the number and depth of the questions asked. Given this constraint (and the fact that the exam is closed book), the focus will be on the essentials that every C++ programmer really ought to know without looking it up. This means the basic syntax and semantics of the topics listed above, along with knowing when it is appropriate to use what. It is fair to say that there will be more emphasis on new topics in C++ and differences between C++ and Java than there will be on just writing a basic program which is virtually identical to its Java counterpart, though certainly one couldn't get very far by completly ignoring the similarities. Somewhat sneaky but important/common C++ quirks or differences may appear; very sneaky and uncommon quirks are more likely to be relegated to bonuses if they appear at all.

Sample Problems

You should expect questions involving reading/tracing code, writing code, and short answers about code or concepts. Reading/tracing code (e.g. indicating what the output would be, numbering statements in the order they are executed, or describing what occurs) demonstrates knowledge of the semantics of an operation. Writing code demonstrates knowledge of syntax, semantics, and when it is appropriate to use a given construct.

In terms of specific topics, it is likely (though not guaranteed) that there will be at least a question involving the semantics of parameter passing, something involving manipulation of arrays, a class implementation question, and a question involving file I/O.

If you are looking for pre-exam practice, try the book's self-test exercises and end-of-chapter programming projects. You can practice reading code by looking at the examples on the syllabus page.


Midterm 2

Midterm 2 will be a take-home exam. It will be open book/notes. Specifically, this means that you can use your own copy of the course textbook, your own notes made prior to the time the exam was handed out, your own lab solutions, and any materials or examples posted on the course webpage or linked directly to it. You may use a computer.

The main topics that will be covered are listed below. The emphasis will be on topics which are new since the last exam, but it is not possible to completely avoid earlier topics.

Pointers & Dynamic Memory Allocation

Linked Lists

Inheritance

Applications


You are responsible for everything in the assigned reading (Savitch 8.2, 10.1-10.3, 14-15, 17.1-17.2) even if it wasn't specifically mentioned in class and/or it isn't specifically listed above.

Sample Problems

You should expect questions involving reading/tracing code, writing code, and short answers about code or concepts. Reading/tracing code (e.g. indicating what the output would be, numbering statements in the order they are executed, or describing what occurs) demonstrates knowledge of the semantics of an operation. Because you are allowed to use a computer on the exam, any tracing questions will require you to show your work and/or explain how you achieved the result - just produce the output of the trace will not earn any credit. Writing code demonstrates knowledge of syntax, semantics, and when it is appropriate to use a given construct.

In terms of specific topics, it is likely (though not guaranteed) that there will be at least a question involving linked lists, one involving binding, and one involving writing subclasses.

If you are looking for pre-exam practice, try the book's self-test exercises and end-of-chapter programming projects. You can practice reading code by looking at the examples on the syllabus page.


Final Exam

The final exam will be in the scheduled time slot. Most of it will be written (not on the computer), but there might be a component on the computer. It will be closed book/notes.

Approximately 1/3 to 2/3 of the exam will specifically address topics which are new since the last exam (though it is not possible to completely avoid earlier topics due to the cumulative nature of the material). Those main topics are listed below. The remainder of the exam will specifically address earlier material.

Templates

Recursion

Trees & Binary Trees

Testing & Debugging


You are responsible for everything in the assigned reading (chapters 13, 16, 17.4) even if it wasn't specifically mentioned in class and/or it isn't specifically listed above. You are also responsible for material covered in class that is not in the book. However, since the exam is a closed book exam, you will not be expected to have memorized every little bit of syntax or C++ library function - focus on the syntax and library functions used in class and on the homeworks/projects.

Sample Problems

As with the midterms, you should expect questions involving reading/tracing code, writing code, and short answers about code or concepts. Reading/tracing code (e.g. indicating what the output would be, numbering statements in the order they are executed, or describing what occurs) demonstrates knowledge of the semantics of an operation. Writing code demonstrates knowledge of syntax, semantics, and when it is appropriate to use a given construct. There may also be synthesis questions which require applying your knowledge of C++ and program design to make a choice or discuss several alternatives to solving a problem. Examples include comparing the pros/cons of two syntax alternatives or explaining when it is appropriate to apply a particular technique.

In terms of specific topics, it is likely (though not guaranteed) that there will be at least a question involving recursion (most likely writing and/or tracing a recursive function) and one involving manipulating binary trees (i.e. implementing some operation on a binary tree, either directly with the linked structure or using the BinaryTree ADT). Major topics from the midterms are also likely question topics: parameter passing, arrays, class implementation, reading/writing files, linked lists, writing subclasses, and types of C++ expressions.

The following practice questions are for just that - practice. You may see one of these questions (or a similar one) on the exam - and you may not. If, however, you are comfortable with solving all of them, you should be in very good shape for solving any question that does come up on the exam.

Linked list practice questions, in a rough order from easiest to hardest: (thanks to Nick Parlante)

Other linked list questions might be to implement one or more methods of a stack, queue, or priority queue using a linked list to store the elements.

For binary trees, you might be asked to write code to directly manipulate the linked tree structure such as:

Or, you might be asked to manipulate an instance of the BinaryTree class. Perhaps:

Other binary tree questions might be to implement one or more methods of a priority queue or binary search tree using a binary tree.


Valid HTML 4.01!