Consider the following segment of C code:
Int data[] = { 10, 20, 30};
Printf ( "%u \n", data, &data[0] )
What can be used said about the result:
A -
The outputs would not be the same, but "data" and "&data[0]" are both addresses
B -
The outputs would be the same and "data" and "&data[0]; are both addresses
C -
The outputs would not be the same
D -
The outputs would be the same, but "data" and "&data[0]" are not both addresses
2-
Consider the following method:
pblic static void foo(int x) {
cout<<" " + x;
if (x > 0)
foo(x-3);
}
What is the output of the method call foo(6)?
A -
6 3 0
B -
6 3
C -
3 6
D -
0 3 6
3-
Consider the following Sort algorithms:
Quicksort, Insertion Sort, Bubble Sort
Which is the fastest on an already sorted array?
A -
None of the other answers
B -
Bubble Sort
C -
Insertion Sort
D -
Quicksort
4-
Consider the following method:
pblic static void foo(int x) {cout<<" " + x;
if (x > 0)
foo(x-3);
cout<<" " + x;
}
What is the output of the method call foo(6)?
A -
0 3
B -
0 3 6
C -
6 3
D -
6 3 0
5-
Consider this binary search tree.
Suppose we remove the root, replacing it with something from the left subtree. What will be the
root
A -
1
B -
2
C -
4
D -
5
6-
Consider a binary_tree_node implementation with pointers. Which expression indicates
that t represents an empty tree?
A -
(t = = NULL)
B -
(t->data() = = 0)
C -
(t->data() = = NULL)
D -
((t->left() = = NULL) && (t->right() = = NULL))
7-
Consider this AVL tree in picture
Suppose we remove the node 8. What will be the new root?
A -
2
B -
4
C -
8
D -
10
8-
Consider this AVL tree in picture
Suppose we remove the node 4. What will be the new root?
A -
2
B -
4
C -
8
D -
10
9-
Consider this AVL tree in picture
Suppose we remove the node 10. What will be the new root?