CIS 120 Midterm: CIS 120 UPenn Midterm2 sp12 solutions

54 views13 pages

Document Summary

Fill in the blank with the correct term from the list at the bottom of the page. The variable e is a type parameter, and may appear elsewhere in the de nition of the interface. Terms: class constructor encapsulation extend heap inherit object static supertype workspace class table dynamic class extension generics implement instantiation stack static type subtype. Recall the ocaml queue type from lecture and hw05. type "a qnode = { v: "a; mutable next: "a qnode option} type "a queue = { mutable head : "a qnode option; mutable tail : "a qnode option } The next few questions concern the four stack/heap con gurations shown below and labeled (a), (b), (c) and (d). There are no responses required on this page, so if you would like to carefully remove this page from the exam booklet you may. (a) (b) Q. tail is reachable by following next pointers from q. head. Circle either satisfies or does not satisfy below.