- Home
- Programming
- C Sharp Programming
41.
Suppose the HouseBoat class implements the IHouse interface implicitly and the IBoat inter-
face 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.
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
42.
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.
- Answer & Explanation
- Report
Answer : [D]
Explanation :
Explanation :
43.
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
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
44.
Which of the following statements is true?
- A.A class can inherit from at most one class and implement at most one interface.
- B.A class can inherit from any number classes and implement any number of interfaces.
- C.A class can inherit from at most one class and implement any number of interfaces.
- D.A class can inherit from any number of classes and implement at most one interface.
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
45.
A program can use the IEnumerable and IEnumerator interfaces to do which of the following?
- A.Use MoveNext and Reset to move through a list of objects.
- B.Use foreach to move through a list of objects.
- C.Move through a list of objects by index.
- D.Use the yield return statement to make a list of objects for iteration.
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :