CMPS 144 Fall 2026
Oct. 9 test preview
The kinds of problems you can expect on the test include the following:
- Given some relatively simple computational problem (e.g., involving
an array) and a loop invariant to guide you, develop code to solve
the problem in a manner consistent with the specified loop invariant.
(Recall the lectures pertaining to finding the maximum value in an
array, 2-color partitioning, linear and binary search, etc.)
as well as Lab #5, in which you implemented a loop to perform 2-color
partitioning.)
- Given an array whose elements are in ascending order (from least to
greatest) and a search key, trace execution of the binary search
algorithm, which finds the lowest-numbered location in the array
containing a value greater than or equal to the search key.
(Tracing execution means showing the values of relevant variables
(namely, low, high, and mid)
at particular "moments in time" (namely, initially and at the end
of each loop iteration).)
- Develop Java code that solves some computational problem similar to
one that you would have worked on during any of Labs #1-5 or
Prog. Assgs. #1-#3 (TennisGameState, Interval).
- Given a relatively simple abstraction (e.g., a pair of dice, a
line segment, a calendar date), develop a Java class to implement it.
If other classes are provided as potential building blocks
(e.g., SixSidedDie, PointOnPlane),
use them in that implementation.
- Given a relatively simple Java class that lacks some desired
functionality, develop a child class that provides that functionality.
Among the examples of this covered in lecture or lab are
- the Coin class and its descendants,
BiasedCoin and BiasedCoinWithCounts
- the Counter class and its child
ResetableCounter, the latter of which added
functionality by which a client program could reset
a counter to its initial value
- the parent/child Java classes in Lab #3:
- SixSidedDie and its child
SixSidedDieWithCounts
- Counter and its child ReversibleCounter
- Temperature and its child Temperature2
Given an abstract Java class that "expects" its children to
supply the implementation of one or more of its abstract
method(s) (i.e., methods whose bodies are omitted), develop
such a child class. Examples from Lab #4
- BoundedCounter and its children,
- StringSorter and its children,
- FilterOfInt and its children
Given a class hierarchy (e.g., Counter and its descendants in
Lab #4) and a program that makes use of objects from classes in that
hierarchy, be able to trace execution of that program and report its
results. (In particular, that would involve understanding, with respect
to a method call obj.doSomething(), which version of the
doSomething)() method actually gets called (among the
possibly multiple versions found in classes in the hierarchy).
Show the history of a pair of stacks used in evaluating a
fully-parenthesized expression. Recall Lab #6.