SSD5 Multiple-Choice8+Quiz8

View Assessment Result: Multiple-Choice Quiz 8


A node in a tree that does not have any children is called


(a) a root
(b) an empty node
(c) a leaf
(d) an internal node

Correct answer is (c)

Your score on this question is: 0.00

Feedback:




Your performance was as follows:

1.
A node in a tree that does not have a predecessor is called


(a) a parent node
(b) an internal node
(c) a leaf
(d) a root

Correct answer is (d)

Your score on this question is: 10.00

Feedback:
See section 5.1.1 of the course notes.
(d)


--------------------------------------------------------------------------------

2.
By definition, a(n) _____ graph contains edges that can be traversed in either direction.



(a) disconnected
(b) undirected
(c) connected
(d) directed

Correct answer is (b)

Your score on this question is: 0.00

Feedback:

See section 5.2.1 in the course notes.


(d)



--------------------------------------------------------------------------------

3.
Which of the following is a C++ data structure that represents a list of entries consisting of unique keys and their associated values?



(a) priority_queue
(b) set
(c) stack
(d) map

Correct answer is (d)

Your score on this question is: 10.00

Feedback:

See Chapter 7, page 251, in the course textbook.


(d)


--------------------------------------------------------------------------------

4.
Which of the following is a C++ data structure that represents an ordered list with no duplicate items?



(a) set
(b) priority queue
(c) tree
(d) vector

Correct answer is (a)

Your score on this question is: 0.00

Feedback:

See Chapter 7, page 250, in the course textbook.


(b)


--------------------------------------------------------------------------------

5.
A priority queue can be implemented with which of the following data structures?

A set
A multiset



(a) II only
(b) I only
(c) I and II
(d) None

Correct answer is (a)

Your score on this question is: 0.00

Feedback:

See Chapter 7, page 254, in the course textbook.


(c)


--------------------------------------------------------------------------------

6.
The time to perform depth first search, starting at the first vertex of a graph with n vertices and e edges implemented as an adjacency list has what order?


(a) O(n^2)
(b) O(n)
(c) O(n + e)
(d) O(n * e)

Correct answer is (c)

Your score on this question is: 0.00

Feedback:
See section 5.2.2 of the course notes.
(d)


--------------------------------------------------------------------------------

7.
Djikstra's algorithm may be used to find the _____ path in a graph that contains edges with _____ weights.



(a) longest, positive and negative
(b) longest, only positive
(c) shortest, only positive
(d) shortest, positive and negative

Correct answer is (c)

Your score on this question is: 10.00

Feedback:

See Chapter 15, page 509, in the course textbook.


(c)


--------------------------------------------------------------------------------

8.
Which of the following statements is true of both depth-first and breadth-first searches?



(a) They can each be used calculate the shortest path between two nodes in a weighted graph.
(b) Their implementations each require a stack of nodes.
(c) Their implementations each require a queue of nodes.
(d) From a given starting node, they will not necessarily explore all other nodes in a graph.

Correct answer is (d)

Your score on this question is: 0.00

Feedback:

See section 5.2.2 in the course notes.


(c)


--------------------------------------------------------------------------------

9.
A max heap guarantees that the values in child nodes are _____ the value in the parent node.



(a) greater than
(b) equal to
(c) less than
(d) not related to

Correct answer is (c)

Your score on this question is: 0.00

Feedback:

See section 5.1.1 in the course notes.


(a)


--------------------------------------------------------------------------------

10.
Which of the following sequences cannot represent values visited during a binary search?


(a) 30, 50, 40, 45, 42
(b) 50, 40, 30, 20, 10
(c) 10, 20, 30, 15, 18
(d) 10, 20, 30, 40, 50

Correct answer is (c)

Your score on this question is: 10.00

Feedback:
See section 5.1.1 of the course notes.
(c)


--------------------------------------------------------------------------------

Go to top of assessment.

Total score: 40.00

? Copyright 2008 iCarnegie, Inc. All rights reserved.
In the C++ Standard Template Library, which of the following containers stores only key-value pairs?



(a) list
(b) map
(c) priority_queue
(d) set
Correct answer is (b)

4.
In the C++ Standard Template Library, which of the following containers represents a collection of unique elements?



(a) vector
(b) string
(c) list
(d) set

Correct answer is (d)

Dijkstra's algorithm and the Bellman-Ford algorithm both determine



(a) the shortest path between two nodes in a graph
(b) whether or not a graph is a tree
(c) whether a graph is directed or undirected
(d) the edge with the greatest weight in a graph

Correct answer is (a)

Your score on this question is: 0.00
--------------------------------------------------------------------------------

7.
A graph-searching strategy that processes vertices in layers such that layers closest to the starting point are searched before those that are m

ore distant is known as a _____ search.



(a) breadth-first
(b) heap
(c) depth-first
(d) linear

Correct answer is (a)

Your score on this question is: 10.00

Feedback:


9.
The root node of a min heap contains:



(a) an element whose value is always negative
(b) the element with the smallest value
(c) an element containing the average of all other element values
(d) the element with the largest value

Correct answer is (b)
10.
Consider the following pseudo-code, which indicates part of a standard binary tree algorithm.

print( node )
{
print data;
if( there is a left child ) print( left child );
if( there is a right child ) print( right child );
}

Which of the following is the standard name for this algorithm?



(a) Inorder traversal
(b) Preorder traversal
(c) Binary search
(d) Postorder traversal

Correct answer is (b)

Your score on this question is: 0.00

Feedback:


10.
In a binary tree containing n nodes, the depth of the root node is



(a) 2
(b) n
(c) 0
(d) 1

Correct answer is (c)

Your score on this question is: 0.00

Feedback:


1.
Which of the following is true about the depth of a tree with exactly three nodes?


(a) It is at most three.
(b) It is at most two.
(c) There is no bound on the depth.
(d) It is at most one.

Correct answer is (b)

6.
Each of the following indicates a reasonable way to implement graphs except


(a) a Boolean matrix
(b) a binary search tree
(c) an edge list
(d) an adjacency list

Correct answer is (b)

Your score on this question is: 0.00

Feedback:
See section 5.2.1 of the course

8.
Which of the following statements is true of a breadth-first search?



(a) It processes nodes in order of increasing distance from a starting node.
(b) For graphs whose edges have only positive weights, it is identical to a depth-first search.
(c) It processes nodes in order of decreasing distance from a starting node.
(d) It is identical to the Bellman-Ford algorithm.

Correct answer is (a)

Your score on this question is: 0.00

Feedback:

--------------------------------------------------------------------------------

10.
If numbers 1,2,...,n are inserted into a binary search tree, in order, then the result for large n is a


(a) mildly unbalanced tree
(b) totally unbalanced tree
(c) completely balanced tree
(d) tree where all nodes are full

Correct answer is (b)

Your score on this question is: 10.00

9.
A max heap guarantees that the values in child nodes are _____ the value in the parent node.



(a) equal to
(b) less than
(c) greater than
(d) not related to

Correct answer is (b)

Your score on this question is: 10.00

Feedback:

See section 5.1.1

in the course notes.






1.
Which of the following is true about the total number of nodes in a binary tree with depth two?


(a) It is at most four.
(b) It is at most seven.
(c) It is at most two.
(d) There is no bound on the number of nodes.

Correct answer is (b)

Your score on this question is: 10.00

Feedback:
See section 5.1.1 of the course notes.
(b)


--------------------------------------------------------------------------------

2.
By definition, a(n) _____ graph contains edges that can be traversed in either direction.



(a) connected
(b) disconnected
(c) undirected
(d) directed

Correct answer is (c)

Your score on this question is: 10.00

Feedback:

See section 5.2.1 in the course notes.


(c)



--------------------------------------------------------------------------------

3.
In the C++ Standard Template Library, which of the following containers stores only key-value pairs?



(a) list
(b) map
(c) priority_queue
(d) set

Correct answer is (b)

Your score on this question is: 10.00

Feedback:

See Section 5.1.3, subsection "Maps," in the course notes.


(b)


--------------------------------------------------------------------------------

4.
Which of the following is a C++ data structure that represents an ordered list with no duplicate items?



(a) set
(b) vector
(c) tree
(d) priority queue

Correct answer is (a)

Your score on this question is: 10.00

Feedback:

See Chapter 7, page 250, in the course textbook.


(a)


--------------------------------------------------------------------------------

5.
A priority queue can be implemented with which of the following data structures?

A set
A multiset



(a) I and II
(b) I only
(c) II only
(d) None

Correct answer is (c)

Your score on this question is: 10.00

Feedback:

See Chapter 7, page 254, in the course textbook.


(c)


--------------------------------------------------------------------------------

6.
The time to perform depth first search, starting at the first vertex of a graph with n vertices and e edges implemented as an adjacency list has what order?


(a) O(n^2)
(b) O(n * e)
(c) O(n)
(d) O(n + e)

Correct answer is (d)

Your score on this question is: 10.00

Feedback:
See section 5.2.2 of the course notes.
(d)


--------------------------------------------------------------------------------

7.
A graph-searching strategy that processes vertices in layers such that layers closest to the starting point are searched before those that are more distant is known as a _____ search.



(a) breadth-first
(b) linear
(c) heap
(d) depth-first

Correct answer is (a)

Your score on this question is: 10.00

Fe

edback:

See Chapter 15, page 505, in the course textbook.


(a)


--------------------------------------------------------------------------------

8.
Which of the following statements is true of a breadth-first search?



(a) It processes nodes in order of decreasing distance from a starting node.
(b) For graphs whose edges have only positive weights, it is identical to a depth-first search.
(c) It processes nodes in order of increasing distance from a starting node.
(d) It is identical to the Bellman-Ford algorithm.

Correct answer is (c)

Your score on this question is: 0.00

Feedback:

See section 5.2.2, subsection "Breadth-First Search," in the course notes.


(a)


--------------------------------------------------------------------------------

9.
The root node of a min heap contains:



(a) an element whose value is always negative
(b) an element containing the average of all other element values
(c) the element with the smallest value
(d) the element with the largest value

Correct answer is (c)

Your score on this question is: 10.00

Feedback:

See section 5.1.1 in the course notes.


(c)


--------------------------------------------------------------------------------

10.
If numbers 1,2,...,n are inserted into a binary search tree, in order, then the result for large n is a


(a) totally unbalanced tree
(b) tree where all nodes are full
(c) mildly unbalanced tree
(d) completely balanced tree

Correct answer is (a)

Your score on this question is: 10.00

Feedback:
See section 5.1.1 of the course notes.
(a)




10.
Consider the following pseudo-code, which indicates part of a standard binary tree algorithm.

print( node )
{
if( there is a left child ) print( left child );
print data;
if( there is a right child ) print( right child );
}

Which of the following is the standard name for this algorithm?



(a) Binary search
(b) Inorder traversal
(c) Preorder traversal
(d) Postorder traversal

Correct answer is (b)

Your score on this question is: 0.00

Feedback:
See section 5.1.1 of the course notes.
(c)


相关文档
最新文档