finalDec2006_solution

finalDec2006_solution - Computer Science 037a Final...

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

View Full Document Right Arrow Icon
Computer Science 037a Final Examination P a rt I: True/False and multiple choice answers. Circle your answers on the question sheet, and fill them in on the Scantron form 1. [1 mark] A stack is a first-in first-out data structure. a) True b) False 2. [1 mark] A stack is an example of a linear data structure. a) True b) False 3. [1 mark] If a queue data structure is implemented using an underlying array-based list to hold its items, the enqueue , dequeue and peek operations will all have O(1) time complexities. a) True b) False 4. [1 mark] Class LinkedList is derived from an array-based class List. a) True b) False 5. [1 mark] The class Queue extends the class Stack . a) True b) False 6. [1 mark] A list node object for a doubly-linked list requires the same amount of memory as a node for a singly linked list . a) True b) False
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 7. [1 mark] Suppose we have a LinkedList implementation that uses head and tail pointers. By making it a doubly-linked list rather than a singly-linked list, the improvement in time complexity for the removeHead operation is: a) From O(n) to O(1) b) From O(1) to O(n) c) From O(n) to O(log 2 n) d) From O(1) to O(n-1) e) None of the above 8. [1 mark] A C++ function should never return as its value the address of one of its local variables. a) True b) False 9. [1 mark] The call frame at the top of the call stack is associated with the most recently-called function that has not yet finished executing. a) True b) False 10. [1 mark] The template class for List can be thought of as a blueprint (or a pattern ) for a family of list classes that differ only in the kinds of data items they can store. a) True b) False 11. [2 marks] The C++ declaration LinkedList< Queue<int *> *> s; Creates a statically-allocated linked list object called s that can hold in each of its nodes a pointer to a queue object that contains pointers to int objects. a) True b) False 12. [1 mark] It is possible to use iterators to traverse a doubly-linked-list a) True b) False
Background image of page 2
The binary tree drawn below is for use with the next five questions. Data values are not shown in the nodes, but the nodes are labeled with letters. 13. [1 mark] The subtree rooted at node C contains 5 nodes. a) True b) False 14. [1 mark] The tree contains 4 nodes at level 3. a) True b) False 15. [1 mark] Node J is an interior node. a) True b) False 16. [1 mark] The tree contains 3 leaf nodes. a)
Background image of page 3

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

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/26/2009 for the course CS cs1037 taught by Professor Yuri during the Fall '07 term at UWO.

Page1 / 13

finalDec2006_solution - Computer Science 037a Final...

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

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