{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

finalDec2006_solution

finalDec2006_solution - Computer Science 037a Final...

Info icon This preview shows pages 1–3. 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
Image of page 1

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

View Full Document Right 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.
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern