CS246 Study Guide - Final Guide: Linked List, Iterator, Duplicate Code
SchoolUniversity of Waterloo
This preview shows pages 1-2. to view the full 6 pages of the document.
CS 246 Final Review
Winter 2009, Updated: April 4, 2009
1. What does UML stand for and what are the 3 ways it is used?
2. What happens when an exception is thrown and not caught?
3. STL stack has a pop back method that is a void return type. Which design pattern should you use so that the stack
returns the last element as it is popped oﬀ?
4. What advantage does a circular linked-list have over a linear linked-list?
5. What is the diﬀerence between ’is-a’ and ’has-a’ relationship? How would you determine the relationship used in the
6. Suppose T is a instance of a specialized STL type, which element of its iterator is speciﬁed by T.end ()?
7. Suppose you have a queue for type T*. Implement the following function:
private : // some junk..
// some other junk...
Only pages 1-2 are available for preview. Some parts have been intentionally blurred.
void enqueue ( T∗t );
bool isEmpty ();
bool inQueue ( queue& q, T∗t );
// post−condition: returns true iﬀ t points to an object in q.
// The ordering of elements in q is unchanged when function ends.
8. Write a recursive function rprint that prints a linked list backwards.
using namespace std;
string val ;
void rprint ( Node∗n );
9. Why is it necessary to explicitly put extern on variables in headers, but not functions?
You're Reading a Preview
Unlock to view full version