CIS 200 Final Exam
CIS 200 Final Exam
You MUST sign the following statement (will not be graded if unsigned):
“I did not use any resources other than the course text book, class slides, class
assignments, notes taken, and/or class videos.”
That is: internet resources, non-class text books, asking anyone other than the
instructor, etc. are NOT allowed for this exam.
_____________________________
Internet and canvas comparison tools will be used to compare what you submit
to internet sites and other student submissions.
Any student violating these statement will receive a grade of zero on the exam and a
grade of E for the class regardless of any other work completed.
Instructions: Type your answers where possible. Work all problems and show all
of your work. Not showing all of your work will result in a loss of points for that
problem. That is, show the formula and your calculations not just the number
calculated.
1) Describe in your own words the operations that are performed on a
stack? Copying from class slide or class text results in loss of points.
4) How are the operations on stacks and queues similar and how are they
different.
5) Show the operator and operand stacks (and the resulting code sequence)
for each step of the following: A = ((B + C) * D) / (E + F).
b) lost object
c) indirect addressing
d) direct addressing
7) Describe
a) What is meant by heap (memory) management? How does it work?
b) What is the difference between static memory and heap memory? How
are they related?
10) What is the purpose of a circular list? Give an example of where one
might be used.
11) Can a list be linked in more than 2 ways? If so, what would be the
purpose? If not, why not?
12) We covered binary search in an array (reminder: see recursion slide
set) in the first half of the semester and a binary search using a tree
in the second half. Which is more efficient – a binary search (array) or
binary search (tree)? (hint: start answer with “it depends on ...”)
13) What criteria might you use for choosing which search algorithm to
use (i.e. to determine if you would use a binary search with an array
versus a binary search tree)?
40
25 75
15 30 73 80
10 27 35
29
a. For tree:
Root: Height: Number levels:
Siblings: Level:
15) Create a binary search tree using the following input (show steps):
50, 22, 101, 23, 18, 76, 63, 45, 47, 41, 83, 100, 98. How many
comparisons to find 41 and 103?
b) in-order sequence
c) post-order sequence
17) Is the tree from #15 balanced or not? Why or why not? Why would you
want to have the tree balanced?
18) What is a “Full Binary Tree” compared to a “Complete Binary Tree”? Is
the tree from #15 complete and/or full? Why or why not?
19) Describe the three ways a key value data can be deleted in a binary
search tree.
20) What is the difference between shallow and deep copying? When would
each be used?
22) What does the min-heap data structure look like after the following
steps (A = add, R = remove)? A(50), A(30), A(22), A(1), A(101), A(15),
R, R, A(6), A(18), R, R, A(22)
23) Describe how the heap sort algorithm works. Show the steps of
creating a max-heap from the following numbers: 11, 21, 6, 9, 35, 18,
26, 2, 14, 4, 1, 45 then show the heap sort to order the values.
24) Describe how “random access” files work in C++. What data structure
uses a similar data access process?
25) What is the purpose of a try-catch block? Why would you nest them?
What is not required but should be included every time you include one in
a program?
26) What is the difference between a user thrown exception and a system
thrown exception? Give an example of when would you code for each of
them.
27) Is a priority queue different from a heap? Explain why or why not.
30)Explain how template classes work. When would you code one?