name ____________________________________________
Computer Science E-22
Practice Final Exam
This exam consists of three parts. Part I has 10 multiple-choice questions that you must
complete. Part II consists of 4 multi-part problems, of which you must complete 3, and
Part III consists of a single multi-part problem that you must complete. Show your work
in Parts II and III so that partial credit may be awarded when necessary.
You have two hours to complete the exam. The questions are worth a total of 100 points.
In order to properly budget your time, plan on spending approximately one minute per point.
You may use a single 8.5-inch x 11-inch sheet of notes (handwritten on both sides).
Please turn off and put away all other materials (including phones and watches).
Do all your work on the exam itself. Keep everything stapled together. Good luck!
Important: Please put an X through the SCORE box for the
problem from part II that you do not want us to grade.
Problem Max. Score SCORE
I 30
II-1 15
II-2 15
Important:
II-3 15 Put an X
through the
II-4 15 empty SCORE
box of the
III 25 problem from
Part II that you
TOTAL 100 do not want us
to grade.
David G. Sullivan, Ph.D. page 1 of 14
, Computer Science E-22: Data Structures Practice Final Exam
Part I. Multiple-choice (3 pts. each)
Write your answers in the table at the bottom of the cover sheet.
1. Suppose that items A, B, C, D and E are pushed, in that order, onto an initially
empty stack S. S is then popped four times; as each item is popped off, it is
inserted into an initially empty queue.
If two items are then removed from the queue, what is the next item that will be
removed from the queue?
A. item A
B. item B
C. item C
D. item D
E. item E
2. If the binary tree below is printed by a preorder traversal, what will the result be?
6
/ \
17 22
/ \ / \
9 4 16 12
A. 9 4 17 16 12 11 6
B. 9 17 6 4 16 22 12
C. 6 9 17 4 16 22 12
D. 6 17 22 9 4 16 12
E. 6 17 9 4 22 16 12
3. A graph implementation that uses a two-dimensional array to represent the edges
would be most reasonable for which of the following cases?
A. 1000 nodes, 1200 edges
B. 100 nodes, 4000 edges
C. 1000 nodes, 10000 edges
D. 10 nodes, 20 edges
E. none of these, since a graph can only be represented by a linked structure.
David G. Sullivan, Ph.D. page 2 of 14
Computer Science E-22
Practice Final Exam
This exam consists of three parts. Part I has 10 multiple-choice questions that you must
complete. Part II consists of 4 multi-part problems, of which you must complete 3, and
Part III consists of a single multi-part problem that you must complete. Show your work
in Parts II and III so that partial credit may be awarded when necessary.
You have two hours to complete the exam. The questions are worth a total of 100 points.
In order to properly budget your time, plan on spending approximately one minute per point.
You may use a single 8.5-inch x 11-inch sheet of notes (handwritten on both sides).
Please turn off and put away all other materials (including phones and watches).
Do all your work on the exam itself. Keep everything stapled together. Good luck!
Important: Please put an X through the SCORE box for the
problem from part II that you do not want us to grade.
Problem Max. Score SCORE
I 30
II-1 15
II-2 15
Important:
II-3 15 Put an X
through the
II-4 15 empty SCORE
box of the
III 25 problem from
Part II that you
TOTAL 100 do not want us
to grade.
David G. Sullivan, Ph.D. page 1 of 14
, Computer Science E-22: Data Structures Practice Final Exam
Part I. Multiple-choice (3 pts. each)
Write your answers in the table at the bottom of the cover sheet.
1. Suppose that items A, B, C, D and E are pushed, in that order, onto an initially
empty stack S. S is then popped four times; as each item is popped off, it is
inserted into an initially empty queue.
If two items are then removed from the queue, what is the next item that will be
removed from the queue?
A. item A
B. item B
C. item C
D. item D
E. item E
2. If the binary tree below is printed by a preorder traversal, what will the result be?
6
/ \
17 22
/ \ / \
9 4 16 12
A. 9 4 17 16 12 11 6
B. 9 17 6 4 16 22 12
C. 6 9 17 4 16 22 12
D. 6 17 22 9 4 16 12
E. 6 17 9 4 22 16 12
3. A graph implementation that uses a two-dimensional array to represent the edges
would be most reasonable for which of the following cases?
A. 1000 nodes, 1200 edges
B. 100 nodes, 4000 edges
C. 1000 nodes, 10000 edges
D. 10 nodes, 20 edges
E. none of these, since a graph can only be represented by a linked structure.
David G. Sullivan, Ph.D. page 2 of 14