It is important to learn different sorting methods #
A -
depending on your teacher, you may have to use his/her favorite
B -
It isnt important, they all get the same end result
C -
its fun to sort using different methods
D -
some ways of sorting are faster then others
2-
It would be most appropriate to use a recursive method to solve a problem that
A -
involes storing data in a two-dimensional vector
B -
requires a lot of memory
C -
involves a substantial number of conditionals and nested loops
D -
involves evaluation of the factorial method
3-
Jobs sent to a printer are generally placed on a
A -
binary search tree
B -
priority queue
C -
queue
D -
stack
4-
Let x and y be variables of type double with only positive values. Of the following,
which best describes the condition under which the boolean expression, x + y = = x, can have the
value true?
A -
only when x is much greater than y
B -
only when y > x
C -
only when the computer has 16-bit words
D -
it can never have the value true
5-
Let the following struct be used to create linked lists:
struct listnode {
int data;
listnode* next;
};
Let p point to the head of an existing linked list with more than one element. The following code
segment is supposed insert the node pointed to by q at the end of the linked list pointed to by p?
listnode* temp;
temp = p;
while (temp != NULL)
while = temp ->next;
__________= q;
A -
temp->data
B -
q->next
C -
temp->next
D -
NULL
6-
Let C(X) be the number of leaves in a binary tree rooted at T. Assume that IsLeaf
returns 1 if T is a leaf. Which of the following observations leads to a recursive implementation?
A -
C(T)=C(T.LEFT) + C(T.RIGHT)
B -
C(T)=C(T.LEFT) + C(T.RIGHT) + 1
C -
C(T)=C(T.LEFT) + C(T.RIGHT) + IsLeaf(T)+1
D -
C(T)=C(T.LEFT) + C(T.RIGHT) +IsLeaf(T)
7-
Let the following struct be used to create linked lists:
Struct treenode {
int data;
treenode* left;
treenode* right;
};
And function printNODE print all data in tree
void printNODE(treenode *top) {
if (top != ______) {
printNODE (top->right);
cout << top->data;
printNODE(top->left);
}
}
The missing word is:
A -
top
B -
top-right
C -
top->left
D -
NULL
8-
Linked list C++ application is organized into three files. They are ____, ____ and ____
A -
header file, source code file, application file
B -
header file, footer file, source code file
C -
Both a) and b)
D -
Neither a) nor b)
9-
New nodes are added to the ____ of the queue.
A -
back
B -
middle
C -
front
D -
None of the above
10-
One difference between a queue and a stack is:
A -
Queues require linked lists, but stacks do not
B -
Queues use two ends of the structure; stacks use only one
C -
Satcks use two ends of the structure, queues use only one