Algorithms and OOD (CSC 207 2014S) : Assignments

Makeup for Examination 2

This makeup is still in draft form.

A few of you had some significant problems on exam 2. Since there were unit tests for exam 2, I don't think that a makeup that simply asks you to correct your already buggy implementations is appropriate. I've also had very little luck with such makeup examinations. Hence, this makeup primarily asks you to reflect in new ways on a few issues from the examination.

Policies and other notes

Additional issues


Clone the repository at

Makeup Problem 1

As the examination suggested, I try to use some interesting approaches in my unit tests. For this problem, you need to explore and explain a few of those approaches. Your goal is to explain the approaches to someone who hasn't seen my code, but wants guidance in strategies for writing more sophisticated unit tests. You can treat them as if they are 'blog posts.

a. Explain how one might use factories in writing unit tests. You may need to teach yourself about factories in order to complete this problem.

b. Explain at least two ways in which one might use permutations in testing. For example, you might explain about randomized permutations and all permutations.

Makeup Problem 2

In the repository, you will find two implementations of filtered iterators, along with a skeletal set of unit tests. Both implementations passed my unit tests, but one has a large number of flaws. Your goal is to write a set of tests that will identify some of those flaws. (I believe that the good implementation is correct; you will get extra credit if you identify flaws in that implementation.) Your tests must illustrate the following flaws:

Ideally, you will find that BadFilteredIterator fails these five tests (and passes the two sample tests) and that GoodFilteredIterator passes all the tests.

Copyright (c) 2013-14 Samuel A. Rebelsky.

Creative Commons License

This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit or send a letter to Creative Commons, 543 Howard Street, 5th Floor, San Francisco, California, 94105, USA.