Figure 2 contains two linked lists, A and B. Determine which one of the following five
statements is the correct statement.
A -
Both A and B can be used for the implementation of queue. A is more efficient than B for removal of data
B -
Only B can be used in the implementation of a queue
C -
Both A and B can be used in the implementation of queue. B is more efficient than A for removal of data
D -
Both A and B can be used in the implementation of queue, with an equivalent effciency for removal of items
2-
Give the binary tree with root A. the root has left child B and right child C. B has left
child D and right child E. There are no other nodes in the tree.
The height of the tree is
A -
0
B -
3
C -
1
D -
2
3-
Give the binary tree with root A. the root has left child B and right child C. B has left
child D and right child E. There are no other nodes in the tree.
Which of the following traversals yields ABCDE?
A -
All of the others answers
B -
inorder
C -
preorder
D -
None of the others answers
4-
Give binary tree and segment to add nodes into tree
BinarySearchTree aTree = new BinarySearchTree (); insert (aTree, "M");
insert (aTree, "C");
insert (aTree, "A");
insert (aTree, "F");
insert (aTree, "R");
insert (aTree, "O");
After buildingthe tree, root node will be:
A -
R
B -
A
C -
O
D -
M
5-
Given an Item pointer iptr that points to a dynamically allocated Item object, which of
the following would return the dynamically allocated memory to the system?
A -
delete iptr:
B -
iptr = NULL:
C -
iptr->~Item():
D -
delete *iptr:
6-
Given a 5 element stack S (from top to bottom: 2, 4, 6,8, 10), and an empty queue Q,
remove the elements one-by-one from S and insert them into Q as you remove them from S, then
remove them one-by-one from Q and re-insert them into S as you remove them from Q.
S now looks like (from top to bottom):
A -
2, 4, 6, 8, 10
B -
10, 2, 4, 6, 8
C -
2, 10, 8, 4, 6
D -
10, 8, 6, 4, 2
7-
Given an empty queue Q, what does it look like after the following operations?
Enqueue (Q, 5)
Enqueue (Q, 2)
Enqueue (Q)
Enqueue (Q, 3)
Enqueue (Q)
A -
5
B -
None of the others
C -
9
D -
3
8-
Given an empty queue P, what does it look like after the following operations?
Push (P, 225)
Push (P, 5)
Push (P, 2)Push (P)
Push (P, 3)
Push (P)
A -
None of the others
B -
5
C -
3
D -
9
9-
Given the binary tree with root A. The root has left child B and right child C. B has left
child D and right child E. there are no other nodes in the tree.
The height of the tree is
A -
1
B -
3
C -
4
D -
2
10-
Give binary tree and segment to add nodes into tree
BinarySearchTree aTree = new BinarySearchTree ();
insert (aTree, "M");
insert (aTree, "C";
insert (aTree, "A";
insert (aTree, "F";
insert (aTree, "R";
insert (aTree, "O";
After buildingthe tree, root node will be: