Study Guides (390,000)
CA (150,000)
UW (7,000)
CS (400)
CS246 (20)

CS246 Study Guide - Final Guide: Linked List, Iterator, Duplicate Code

Computer Science
Course Code
Ric Holt
Study Guide

This preview shows pages 1-2. to view the full 6 pages of the document.
CS 246 Final Review
Sean Hsueh
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 off?
4. What advantage does a circular linked-list have over a linear linked-list?
5. What is the difference between ’is-a’ and ’has-a’ relationship? How would you determine the relationship used in the
class interface?
6. Suppose T is a instance of a specialized STL type, which element of its iterator is specified by T.end ()?
7. Suppose you have a queue for type T*. Implement the following function:
class T
private : // some junk..
T ();
// some other junk...

Only pages 1-2 are available for preview. Some parts have been intentionally blurred.

class queue
queue ();
void enqueue ( Tt );
Tdequeue ();
bool isEmpty ();
bool inQueue ( queue& q, Tt );
// postcondition: returns true iff 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.
#include <string>
#include <iostream>
using namespace std;
struct Node
string val ;
void rprint ( Noden );
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