Download HONR280

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

B-tree wikipedia , lookup

Lattice model (finance) wikipedia , lookup

Red–black tree wikipedia , lookup

Quadtree wikipedia , lookup

Interval tree wikipedia , lookup

Binary search tree wikipedia , lookup

Transcript
HONR280
Fall 2003
P.VanHise
MIDTERM EXAM REVIEW
Part I Choose the BEST answer or complete the sentence.
1. For computers to do anything (besides sit on a desk and collect dust)
they need 2 things:
a. data structures and algorithms.
b. programs and data.
c. codes and algorithms.
d. searches and sorts.
2. A _____________ is a set of instructions used by a computer to perform a
specific task or solve a problem.
3. Alphanumeric information stored and processed in a computer is called __________.
4. ASCII is a subset of _______________, used today to code data and languages used
worldwide.
5. The basic element used to store data in a computer is a
a. byte tree
b. array
c. binary digit
d. code
6. Which of the following statements is TRUE?
a. ASCII is used to comptess data for transmission.
b. ASCII and Huffman codes are equal in length.
c. Huffman coding uses fixed length codes.
d. Decoding a Huffman coded message requires a tree.
7. True or False: The same Huffman code will achieve optimal compression for
any message.
8. A byte consists of _____ bits.
a. 8
b. 2
c. 4
d. 32
9. When data is transmitted, such as over telephone lines, the time it takes
a. is the same no matter what coding method is used.
b. can be much longer if ASCII is used.
c. can be much shorter if the code is NOT compressed.
d. depends on the weather.
10. In a Huffman tree the characters of the message appear in the ____________
nodes of the tree.
11. A binary search is very efficient but requires the data to be
a. in numerical or alphabetical order.
b. stored in a array.
c. not large.
d. topologically sorted.
12. Which of the following is not a type of computer programming instruction?
a. search
b. assignment
c. decision
d. loop
13. Which of the following is true?
a. The Selection sort and the Bubble sort produce the same results but the
Insertion sort produces a different ranking.
b. The Selection, Bubble and Insertion sorts all follow the same algorithm.
c. The Selection, Bubble and Insertion sorts have the same loop invariant.
d. Either the Selection, Bubble or Insertion sort may be used to sort datat
into descending order.
14. When sorting data into ascending order, after 'j' iterations of the loop, the 'j' highest
values are in their proper places in the array.
a. Selection
b. Bubble
c. Insertion
d. none
15. When sorting data into ascending order, after 'j' iterations of the loop, the 'j' lowest
values are in their proper places in the array.
a. Selection
b. Bubble
c. Insertion
d. none
16. When sorting data into ascending order, after 'j' iterations of the loop, the 'j' first
values in the array are in order with respect to themselves.
a. Selection
b. Bubble
c. Insertion
d. none
17. A collection of data that is related in some way and is stored in a computer under a
single name is called a(n) _______________.
18. A data structure in which data is stored in sequentially indexed contiguous locations
is called a(n) ___________________.
19. A data structure that is often used to represent a relation (a set of ordered pairs) and
is an abstraction of a real world situation is called a(n) __________________.
20. A data structure that is a special type of graph which is connected, directed, and in
which any path between two nodes that exists is unique is called a __________.
21. A topological sort
a. is unique for each problem.
b. is the same as an ascending order sort.
c. can be done by only one algorithm.
d. requires precedence rules.
22. A ____________ graph is one in which each edge is given a value and the length of
a path is the sum of the ____________ of the edges in the path.
23. If ABCADEF represents a path in some graph. The length of that path is
a. 7
b. 6
c. cannot be determined
d. this could not represent a path in any graph
24. The number of edges incident on a vertex of a graph is called the ___________ of
the vertex.
a. path
b. degree
c. weight
d. orientation
25. A _________ is a list of consecutive edges in a graph.
26. Which of the following is true?
a. Euler proved that no graph can be traversed by a path that includes consecutive
edges where each edge in the graph is included exactly once.
b. An Eulerian Path is possible only in a graph that is not connected.
c. An Eulerian Path exists only when the degree of each vertex is even.
d. Euler proved that an Eulerian path exists only when there are exactly 0 or 2
vertices with odd degree.
27. A graph is used as an ________________ of real life situations.
28. True or False: A graph is a data structure in computer science.
29. In computer science the edges in a graph are stored in a(n)
a. adjacency matrix b. array
c. Huffman Code
d. tree
30. Which of the following is true?
a. The main diagonal of an adjacency matrix is all 1's.
b. If the main diagonal of an adjacency matrix is all 0's, there are no loops in
the graph it represents.
c. There is no symmetry in an adjacency matrix.
d. An adjacency matrix is a three dimensional array.
31. True or False: In a binary tree there is a unique path from the root to each node.
32. In a binary tree each node (vertex)
a. must have 2 children.
b. may have 2 parents.
c. is internal or terminal.
d. is a leaf.
33. Which of the following is true?
a. The height of a tree with only 1 node, the root node, is one.
b. The height of a tree is the length of the path from the root to the deepest level.
c. The height of a tree equals the log 2 of the number of terminal nodes.
d. The height of a tree is not related to the number of comparisons needed
when searching for a value in the tree.
34. The maximum number of leaves in a tree of height 4 is
a. 4
b. 8
c. 12
d. 16
35. True or False: A binary search tree takes approximately log 2 n comparisons to
visit each node.
36. In the worst case the number of comparisons needed to search for a value in the
following tree is:
a. 2
b. 3
c. 7
d. 40
25
15
10
35
20
30
40
37. True or False: The following is a binary search tree.
20
30
10
5
15
8 1
12 18
25
35
38. The height of the tree in number 37 is
a. 11
b. 4
c. 3
d. 2
39. A spanning tree is
a. a subtree of a graph that contains all the edges of the tree.
b. a subtree of a graph that contains all the vertices of the tree.
c. a subtree of a graph that contains all the vertices and all the edges of a tree.
d. a subtree of a graph that contains select vertices and all edges of a tree.
40. A _____________ spanning tree is a spanning tree of a graph in which the sum
of the weights of the edges is as small as possible.