CPSC 225 |
Intermediate Programming |
Spring 2025 |
CPSC 225 Exam 2 Review Information
The exam will be held during the Thursday lab period in Rosenberg
009. Take care of any necessary business before class
so that you do not need to leave the room during the exam.
Though it will be in the lab, the exam will be written (not on the
computer). It will be closed book, but you may have one page of
notes which you will turn in with your exam. Important: "One
page" means one side of an 8.5x11" piece of paper
— hardcopies only, you may not use a tablet or laptop
or other device to access your notes during the exam. (It's fine to
create your notes electronically if you want, just make sure you
print them out before class!) In addition, your notes must be
personally prepared by you — you may not use generative AI
to produce a set of notes, copy another student's notes, or make
copies of your own for others. (Creating your own notes is an
essential part of the learning process — deciding what to
include requires engagement with the material which reinforces
understanding and improves long-term retention of the material,
provides an opportunity for review in order to identify gaps in your
knowledge in time to ask questions before the exam, increases
confidence in what you do know, and encourages taking ownership of
your own learning.)
The exam will primarily cover new material not on the previous
exam, up to but not including binary trees. Specific topics are
listed below.
Topics
Linked Lists
- working with linked lists (the necessary variables and classes;
typical operations like retrieve, insert, remove, visiting all of the
elements; how to figure out algorithms for new operations)
- working with variations of linked lists (doubly-linked lists,
tail pointers, circular lists; how to figure out algorithms for
new operations)
- implementing operations with linked lists
Analysis of Algorithms
- the idea of the growth rate of a function, what asymptotic
analysis means, and why these things are of interest when talking
about the running time of an algorithm
- the difference between O(1), O(log n), O(n), O(n log n),
O(n2), and O(2n) — which are better and worse,
how much difference there is between them, which are practical to wait
for and which aren't, some examples of algorithms that give rise to
each
- what "best case" and "worst case" behavior refers to
- determining the running time of an algorithm (big-Oh)
- knowing/determining the running time of operations involving
arrays and linked lists
- using the notion of algorithmic efficiency to choose efficient
implementations of collections for particular applications
Streams
- byte streams vs character streams (what the difference is, why
you'd pick one or the other, how to distinguish them in Java)
- the difference between nozzles/wrappers and hoses in the
streams classes, and which streams classes fall into which category
- getting streams connected to standard input, standard output, files
- reading and writing streams, including using Scanner
- using the streams abstraction to write flexible, reusable code
You should be familiar with the various classes relating to streams
that were introduced in class (including what
they are for), but you do not need to memorize all of their methods —
you will be provided with an excerpt from the API for any you are
asked to use.
ADTs and Collections
- definition of ADT
- common collections ADTs (List, Stack, Queue, Priority Queue) and
for each, the idea and purpose, typical operations
- lookup and related ADTs (Map/Dictionary, Set)
- common applications, such as using a priority queue to sort
and a stack to reverse
- using the Java Collections Framework's implementations of these
ADTs (including how to choose where there are several options for
concrete classes such as ArrayList and LinkedList or
HashMap and TreeMap)
- iterators (the concept, using them to iterate through Java Collections)
- Comparator and specifying how to order elements in a
priority queue
For using Java Collections classes, you should be familiar with the
various interfaces, classes, and methods but you do not need to
memorize any methods — you will be provided with an excerpt from the
API for any you are asked to use.
Questions
Types of questions you might encounter include (but are not limited to):
- defining a term
- tracing code involving linked lists to determine what it does,
or where it goes wrong
- writing code or a method to manipulate a linked list in some
way, including handling special cases (use pictures to help you
work it out!)
- determining the running time of a section of code (big-Oh), or
ordering/grouping several things based on their running times
- comparing and contrasting the efficiency of different
implementations for an operation (e.g. one using a sorted array,
one using an unsorted linked list)
- describing one of the streams classes and when it would be
appropriate to use it
- writing code to read from or write to a stream or read
from/write to a file
- describing a particular ADT (List, Stack, Queue,
PriorityQueue, Map, Set) and when it would be appropriate to use it
- identifying an appropriate ADT (List, Stack, Queue,
PriorityQueue, Map, Set) for a particular application
- writing code to accomplish a task using the Java Collections
Framework given
an English or pseudocode description of the task
When asked to write code, you will be graded on syntax — while you
won't lose points for occasional typo sorts of errors (like a
missing semicolon) which would be easily caught by Eclipse, frequent
or major mistakes which indicate that you don't know what the
correct syntax should be or would get in the way of being able to
produce a working program (even with the assistance of Eclipse) will
lose points.