Presentation is loading. Please wait.

Presentation is loading. Please wait.

Clicker quiz 10/1/13 CSE 1102 Fall 2013.

Similar presentations


Presentation on theme: "Clicker quiz 10/1/13 CSE 1102 Fall 2013."— Presentation transcript:

1 Clicker quiz 10/1/13 CSE 1102 Fall 2013

2 The above code illustrates what recipe?
public class Sun extends Ellipse { public Sun(Color c) { super(c); } public Sun() { this(Color.yellow); The above code illustrates what recipe? Default value [correct] Accessors and mutators Parts that know about their containers Sharing the interface Invisible sun

3 The above code illustrates what recipe?
public class Sun extends Ellipse { private Color _myColor; public Sun(Color c) { super(c); _myColor = c;; } public Color getColor(){ return _myColor; public void setColor(Color col){ _myColor = col; The above code illustrates what recipe? Default value Accessors and mutators [correct] Parts that know about their containers Sharing the interface Here comes the sun

4 public class Forest { Bird _tweety; } Suppose _tweety is declared to be a Bird (as above). Given this diagram the actual type of _tweety can be Bird Bird, Crow, or Duck [correct] Bird or Animal Bird, Crow, Duck, or Animal

5 Using only the information in this diagram, if we want to be able to make the assignment
sporty = new Car(3); sporty would have been declared a Car Car or Vehicle Car or PeopleMover Car, Vehicle, or PeopleMover [correct]

6 Clicker questions 10/1/13 CSE 1102 Fall 2013

7 public class <ContainerClass> {
private <PartClass> _<part>; public <ContainerClass>(…) { _part = new <PartClass>(this); } public class Hat { private HatPart _myHatPart; public Hat() { _myHatPart = new HatPart(this); } In the above code, to what does this in line 7 refer? A constructor for <ContainerClass> A constructor for <PartClass> _part An instance of <ContainerClass> [correct] An instance of <PartClass> A constructor for Hat A constructor for HatPart _myHatPart An instance of Hat [correct] An instance of HatPart

8 Given the above diagram, which line of code is not legal?
Vehicle oily = new OilTanker(200); Car frank = new Car(); PeopleMover pm = new Car(3); OilTanker oily = new Truck(42); [correct] More than two of these are not legal

9 Vehicle robyn; robyn = new Car(200); In the code above, after robyn gets instantiated, which methods can be invoked on robyn? (i.e. robyn.???) holdPeople, tootHorn, carryCargo, and move holdPeople, tootHorn, and move holdPeople and move carryCargo and move [correct] carryCargo only

10 Truck oily = new OilTanker(200); oily.move(); In the code above, which move method gets executed? The move method defined in OilTanker [correct] The move method defined in Truck The move method defined in Vehicle All of the above The code does not work


Download ppt "Clicker quiz 10/1/13 CSE 1102 Fall 2013."

Similar presentations


Ads by Google