0% found this document useful (0 votes)
171 views

Exam2 Study Guide

This study guide provides information about Exam 2 for the CIS44 class, which will be this Thursday at 11:00 AM and last 2 hours. It is closed book. The study guide then provides 16 multiple choice or short answer questions covering topics like queues, stacks, sorting algorithms including bubble sort, selection sort, insertion sort, and merge sort. Questions cover concepts like enqueue, dequeue, isFull, isEmpty as applied to array-based and linked implementations of queues. Questions also cover recursion, factorials, Fibonacci sequence, and merging two sorted stacks into a third sorted stack.

Uploaded by

Jerald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
171 views

Exam2 Study Guide

This study guide provides information about Exam 2 for the CIS44 class, which will be this Thursday at 11:00 AM and last 2 hours. It is closed book. The study guide then provides 16 multiple choice or short answer questions covering topics like queues, stacks, sorting algorithms including bubble sort, selection sort, insertion sort, and merge sort. Questions cover concepts like enqueue, dequeue, isFull, isEmpty as applied to array-based and linked implementations of queues. Questions also cover recursion, factorials, Fibonacci sequence, and merging two sorted stacks into a third sorted stack.

Uploaded by

Jerald
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CIS44 Exam2 Study guide

EXAM2 is this Thursday at 11:00 AM 2 hours long


Closed book

1. The method for adding an element to the back of a queue is called


a. push
b. enqueue
c. add
d. none of the above

2. Given a linked list containing the following values: first -> 5 -> 15 -> 20 -> null, which of the
following best describes what needs to happen when 10 is added to the list?

a. The node containing 5 must be changed to point to the node which contains 10. Then
the node containing 10 can be added.
b. The value from the first node (10) is copied over the value 5. Then the first node is
deleted. Then first is set to the node that now contains 10.
c. Create a node and place 10 in that node and then make first to point to the node
containing 10.
d. None of the above.

2- A data structure which exhibits FIFO behavior is known as

a. An array.
b. A Queue.
c. A vector.
d. None of the above.

3. In an array-based implementation of a queue, a possible solution to dealing with the full condition
is to
a. maintain a count of queue items
b. check for frontIndex equal to backIndex
c. wait for an arrayFullExcetion to be thrown
d. all of the above

4. After the following statements execute, what item is at the front of the queue?
QueueInterface<String> zooDelivery = new LinkedQueue<>();
zooDelivery .enqueue(“lion”);
zooDelivery .enqueue(“tiger”);
zooDelivery .enqueue(“cheetah”);
String next = zooDelivery .dequeue();
next = zooDelivery .dequeue();
zooDelivery .enqueue(“jaguar”);

a. “cheetah”
b. “jaguar”
c. “tiger”
“lion”

5. Where will you find the item added earliest to a queue?


a. at the back
b. at the front
c. in the middle
d. randomly

6- Given the following values (use firt-middle last median technique):

65 13 102 45 2 12 10 99 40

Show the pivot and the two partitions made using the quick sort.

What are the pivot values of partition-1 and partion-2.


7- Use the following values of the array after the first 3 iterations of bubble sort:

65 13 102 45 2 12 10 99 40

bubble sort:

selection sort:

insertion sort:

8- Implement enqueue method using a circular array.


9- Implement PUSH using an array
10- Implement POP using an array
11- Implement isFull using array
12- Implement isEmpty using an array

13- Write the method to check if a queue implemented using a circular array is full.
14- Write Fibonacci recursively.
15- Write the factorial recursively.

16- There are two stacks that each have stored integer values in sorted format in ascending order.
Create another stack containing the content of both stack by using the merge technique. Note
that the third stack must have values in ascending order as well. After this process is complete
the first two stacks must have their original values.

THESE ARE WHAT ELSE I MAY ASK YOU –


I will give you a infix expression and ask you to convert it to postfix using stack or paper and
pencil technique.

Merge sort – May give you the code for the merge part and ask you questions – the actual
code you should be able to write

You might also like