MIDTERM CSU670 Fall 2003 Wednesday, October 22 Karl Lieberherr YOUR NAME: Open book and open notes. Question 1: 30 points Question 2: 32 points Question 3. 30 points Question 4: 21 points 113 points Question 1: ================================================== UNKNOWN0 = = "trip" DayTripList UNKNOWN1 = : EDayTripList | NDayTripList UNKNOWN2 = = "end" ("end" can also be put at end of UNKNOWN0) UNKNOWN3 = = DayTrip DayTripList UNKNOWN4 = = "day" Day DTKind LocationList UNKNOWN5 = : ELocationList | NLocationList UNKNOWN6 = = "-" UNKNOWN7 = = Location LocationList UNKNOWN8 = : Luxury | NE (note that we must have exactly two sublcasses by SELF-DESCRIBING) UNKNOWN9 = NE : Normal | Economy (8 and 9 have choices; e.g. UNKNOWN8 = : Normal | X .) Question 2: ================================================== UNKNOWN0 = ClassGraph UNKNOWN1 = ClassGraph UNKNOWN2 = true UNKNOWN3 = false UNKNOWN4 = List l = Main.cg.gather(this, "from Cd_graph to Syntax_vertex"); for (ListIterator i=l.listIterator(); i.hasNext();) { System.out.println(" Syntax_vertex " + ((Syntax_vertex) i.next()).get_string()); } Question 3: ================================================== UNKNOWN1 = FruitList : EFruitList | NFruitList. EFruitList = "()". NFruitList = "(" Fruit FruitList ")". Fruit : Apple | Orange. Apple = "a". Orange = "o". Main = . Question 4: ==================================================== Note: 0, 1, 2 may be permuted UNKNOWN0 = Cd_graph UNKNOWN1 = Adj UNKNOWN2 = Adj_list (because Adj_list is a superclass of Cd_graph) UNKNOWN3 = Cd_graph UNKNOWN4 = first UNKNOWN5 = Adj UNKNOWN6 = Adj