CMPS 144 Fall 2022
Test #1 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 given loop invariant.
(Recall the 2-color partitioning problem from Lab #4.
Imagine how one might do 3-color partitioning!)
- Given a relatively simple abstraction (e.g., a pair of dice or a
line segment), 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.
(Recall the Counter class hierarchy, the Temperature
class from Lab #3, and the TimeOfDay class from Prog. Assg. #1.
- 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. (Recall StringSorter and its
child classes from Lab #4.)
- Given a class hierarchy (e.g., Counter and its descendants in
Lab #3) 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.)
- Show the history of a queue used in the algorithm that solves
the Single-source Uniform-cost Shortest Paths problem.
(Recall Lab #6.)