Sample Exams 2

Sample Exams 2 - CS 2050 Exam 2 S2009 Instructions: Mark...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CS 2050 Exam 2 S2009 Instructions : Mark the single best answer for each of the following 28 questions (scored out of 25). 1. Which of the following best describes an Abstract Data Type (ADT)? (1) An ADT is an object of a particular class which can be treated as a generic entity. (2) An ADT is an implementation of a class that uses data hiding and encapsulation. (3) An ADT is a conceptual entity that can be operated on by a defined set of rules. (4) An ADT is a class which supports the comparable interface. (5) An ADT is a class which is declared to be abstract within a Java interface. 2. Which of the following cannot be implemented using a linked list? Mark (5) if all can be. (1) Stack (2) Queue (3) Priority Queue (4) Bag (5) All of the above can be implemented with a linked list. 3. Which of the following is most associated with expression "first come, first served"? (1) Stack (2) Queue (3) List (4) Set (5) Bag 4. Given a circular linked list implementation of a queue of size N with a single pointer to the node representing the front of the queue, what is the complexity to perform N dequeue operations? (1) O(N) (2) O(N 2 ) (3) O(2 N ) (4) None of the above because the N dequeues will empty the queue, i.e., leave it with O(1) size. (5) It is not possible to use a circular linked list without both a front and a rear pointer. 5. What is the complexity to find a specified key in a balanced binary tree which is not necessarily a BST? (1) O(log(N)) (2) O(N) (3) O(N*log(N)) (4) O(N 2 ) (5) A binary tree cannot be searched for a specified key unless it is a BST 6. What is the complexity to find a specified key in a BST which is not necessarily balanced? (1) O(log(N)) (2) O(N) (3) O(N*log(N)) (4) O(N 2 ) (5) A BST cannot be searched for a specified key unless it is balanced 7. What is the complexity to find a specified key in a BST which is balanced but not perfectly balanced? (1) O(log(N)) (2) O(N) (3) O(N*log(N)) (4) O(N 2 ) (5) A BST cannot be searched for a specified key unless it is perfectly balanced 8. Given a balanced BST, what is the complexity to insert a single new key using the simple BST insertion algorithm? (1) O(log(N)) (2) O(N) (3) O(N*log(N)) (4) O(N 2 ) (5) The complexity depends on whether the tree was constructed from a random sequence of keys 9. Suppose N keys are inserted in random order into a BST using the simple BST insertion algorithm. What will be the height of the tree? (1) O(log(N)) (2) O(N) (3) O(N 2 ) (4) expected O(N 2 ) (5) The height will be determined by the particular order in which the keys are inserted, so no Big-Oh expression for the height can be given.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
10. Given the tree of the previous question, what is the complexity to find a specified key?
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/06/2010 for the course CS 2050 taught by Professor Uhlmann during the Fall '09 term at Missouri (Mizzou).

Page1 / 34

Sample Exams 2 - CS 2050 Exam 2 S2009 Instructions: Mark...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online