CMPS 144 Fall 2026
Preview of Test #2 (November 18)
The kinds of problems that you should be prepared to answer
on the test include the following:
- Given a relatively simple computational problem similar to one
that you would have solved in developing a solution to any among
Programming Assignments 1 through 4, develop code to solve it.
- Given a scenario within the context of the discrete event simulation
problem of Prog. Assg. #5, be able to explain what the next steps
of the simulation would be.
- Given some relatively simple computational problem (e.g., possibly
involving an array) and a loop invariant to guide you, develop code
to solve the problem in a manner consistent with the given loop
invariant.
(Recall the lectures pertaining to 2-color and 3-color partitioning,
as well as Lab #5, in which you implemented loops that conformed
to specified loop invariants.)
- Show the history of the queue used in the algorithm that performs
a breadth-first search to solve the Single-source Uniform-cost
Shortest Paths problem. (Recall Lab #7.)
- Be able to interpret a diagram depicting a "wraparound array"-based
representation of a queue, and be able to show how that
representation changes as insertions and removals of elements occur.
Similarly for a Link1-based representation.
- Given a code segment that involves Link1 objects,
be able to manually trace its execution and report its results.
(Tracing execution means showing the values of relevant
variables at specified points during execution, as might
be produced by print statements.)
- Given a relatively simple computational problem involving
Link1 objects, develop code that solves it.
(Recall Lab #7.)
- Given a relatively simple computational problem pertaining
to lists-with-cursors, develop code that solves it.
(Recall Lab #8.)
- Develop a class that implements the java.util.Comparator
interface, or the RedBlueClassifier interface, or a
similar kind of interface. (Recall Lab #9.)
- Develop code that makes use of an object that is an instance
of a class that implements an interface such as
java.util.Comparator, RedBlueClassifier,
or a similar interface. (Recall Lab #9.)
- Given a recursive Java method, be able to trace its execution and
show its effects, as in
this table.
(Recall Labs #9 and #10.)
- Given a description of a simple computational problem and
hints about how to solve it using a recursive approach, be able
to devise a recursive Java method that is faithful to those hints.
(Recall Labs #9, 10, and 11.)