CS106X
Handout 36
Autumn 2010
December 6
th
, 2010
CS106X Practice Final Exam
Exam Facts
Offering 1
When:
December 10
th
, 2009 at 8:30 a.m.
Where:
Gates B01 and B03
Offering 2
When:
December 10
th
, 2009 at 3:30 p.m.
Where:
TBD
SCPD students can either come to campus on Friday morning, or they can take the exam
remotely anytime on Friday, provided you email me ahead of time so I can email you the
exam.
My cell and fax numbers will be printed on the front page of the exam.
You can
call me during if you have questions, and you can use the fax number to get us a copy of
your exam.
Hold on to your original until you get the faxed copy back.
You don’t need to
take the exam at the office, and you don’t need a proctor.
Just selfadminister so you have
maximum flexibility on when you take it.
Coverage
The final is comprehensive and covers material from the entire quarter, but will tend to
focus on the topics covered after the midterm, which means be prepared for recursive
backtracking, memoization, nittygritty implementationside work (pointers, linked lists,
trees, graphs, hash tables, function pointers, and so on), and inheritance.
It will be a 3hour exam. It will be open book/open note, but no electronics.
This handout is intended to give you practice solving problems that are comparable to
those which will appear on the exam.
We highly recommend working through the
problems in testlike conditions to prepare for the actual exam.
Many of our section
problems have been taken from previous exams and chapter exercises from the reader
often make appearances in same or similar forms on exams, so both of those resources are
a valuable source of study material as well.
Be sure to bring the reader with you to the exam. We won't repeat the standard class
definitions on the exam, so the reader appendix will come in handy for looking up the
library interfaces.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Problem 1: Recursive Backtracking and the 70
2
Puzzle
It’s a little known fact that the sum of the first 24 positive squares—that is, 1 + 4 + 9 + … +
23
2
+ 24
2
—is equal to 4900, which just happens to be the square of 70.
For math nerds
around the globe, this leads to the question of whether or not 24 square tiles of area 1, 4,
9, 16, and so forth can be laid down to completely cover a 70 x 70 board.
Here’s a partial tiling of a 70 x 70 board where tiles with sides of unit lengths 15 – 24 have
been placed, but tiles with sides of length 1 – 14 have not.
Your job is to use recursive backtracking to determine whether or not such a tiling exists.
You should assume that the following functions exist and operate as described:
// returns true if and only if a square of the specified dimension could be
// placed without overlapping the edges or any previously placed squares such
// that the lower left corner of the tile covers the cell at (row, col)
CanPlaceSqaure(Grid<bool>& board, int dimension, int row, int col);
// Updates the board to reflect that a square tile of the specified dimension
// has been placed such that its lower left corner covers the cell at (row, col)
This is the end of the preview.
Sign up
to
access the rest of the document.
 Fall '08
 Cain,G
 Graph Theory, virtual void, virtual void misspiggy, virtual void animal

Click to edit the document details