1. Which the following statements about the base keyword is false? a.A constructor can use at most...

Question:

1. Which the following statements about the base keyword is false? a.A constructor can use at most one base statement. b.A constructor cannot use both a base statement and a this statement. c.The base keyword lets a constructor invoke a different constructor in the same class. d.If a constructor uses a base statement, its code is executed after the invoked constructor is executed. 

2. Which the following statements about the this keyword is false? a.A constructor can use at most one this statement. b.A constructor can use a this statement and a base statement if the base statement comes first. c.The this keyword lets a constructor invoke a different constructor in the same class. d.If a constructor uses a this statement, its code is executed after the invoked constructor is executed. 

3. Suppose you have defined the House and Boat classes and you want to make a HouseBoat class that inherits from both House and Boat. Which of the following approaches would not work? a.Make HouseBoat inherit from both House and Boat. b.Make HouseBoat inherit from House and implement an IBoat interface. c.Make HouseBoat inherit from Boat and implement an IHouse interface. d.Make HouseBoat implement both IHouse and IBoat interfaces. 

4. Suppose the HouseBoat class implements the IHouse interface implicitly and the IBoat interface explicitly. Which of the following statements is false? a.The code can use a HouseBoat object to access its IHouse members. b.The code can use a HouseBoat object to access its IBoat members. c.The code can treat a HouseBoat object as an IHouse to access its IHouse members. d.The code can treat a HouseBoat object as an IBoat to access its IBoat members. 

5. Which of the following is not a good use of interfaces? a.To simulate multiple inheritance. b.To allow the code to treat objects that implement the interface polymorphically as if they were of the interface's "class." c.To allow the program to treat objects from unrelated classes in a uniform way. d.To reuse the code defined by the interface.

6. Suppose you want to make a Recipe class to store cooking recipes and you want to sort the Recipes by the MainIngredient property. In that case, which of the following interfaces would probably be most useful? a.IDisposable b.IComparable c.IComparer d.ISortable 

7. Suppose you want to sort the Recipe class in question 6 by any of the properties MainIngredient, TotalTime, or CostPerPerson. In that case, which of the following interfaces would probably be most useful? a.IDisposable b.IComparable c.IComparer d.ISortable

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  answer-question
Question Posted: