How many swaps occur when doing an Insertion sort (to sort the values in increasing
order) on the array storing 8, 7, 6, 5, 4, 3, 2, 1 and 2?
A -
26
B -
None of the others answers
C -
27
D -
28
2-
I have implemented the queue with a linked list, keeping track of a front node and a
rear node with two reference variables. Which of there reference variables will change during an
insertion into an EMPTY queue?
A -
Neither changes
B -
Both change
C -
Only front changes
D -
Only rear changes
3-
If Node A is proper ancestor of Node #
A -
Node B is inserted before Node A
B -
Node B is larger than Node A
C -
Node A is inserted before Node B
D -
Node A is larger than Node B
4-
I have implemented the queue with a linked list, keeping track of a front node and a
rear node with two reference variables. Which of there reference variables will change during an
insertion into an NONEMPTY queue?
A -
Both change
B -
Only rear changes
C -
Neither changes
D -
Only front changes
5-
If algorithm A has running time 7n^2 + 2n + 3,
and algorithm B has running time 2n^2,
and algorithm C has running time 2n^3,
and algorithm D has running time 7log(n),
then which algorithms have the same asymptotic time complexity.
A -
A and B and C
B -
C and D
C -
B and C
D -
A and B
6-
If I insert the integers 1 through # the height of the tree?
A -
O(n)
B -
O(log n)
C -
O(n*log n)
D -
O(n^1/2)
7-
If b is a boolean variable, then the statement
b = b = = false; has what effect?
A -
it causes a run-time error message
B -
it causes a compile-time error message
C -
it changes the value of b if and only if b had value true just before the statement was executed
D -
it always changes the value of b
8-
If this code fragment were executed in an otherwise correct and complete program,
what would the output be?
int a = 3, b = 2, c = 5
if (a > b)
a = 4;
if (b >c)
a = 5;
else
a = 6;
cout << a << endl;
A -
4
B -
3
C -
6
D -
5
9-
If the value of f(x, y, z) is always an integer, which of the following conditions ensures
that the loop below terminates?
while ( (f(x, y, z) != 0)
<.some computation>
A -
the value of(x, y, z) is decreased during each iteration
B -
x, y and z are each decreased during each iteration
C -
x, y and z are each increased during each iteration
D -
the sum of x, y, and z is decreased during each iteration
10-
If the characters D, C, B, A are placed in a queue (in that order), and then
removed one at a time, in what order will they be removed?