Questions

  1. Which of the following is relevant in Protocol-Oriented Programming?

a) The type an object has.
b) The object's superclass.
c) What an object can do.

  1. Which of the following is not a downside of subclassing?

a) Shared functionality.
b) A fixed subclassing hierarchy.
c) A complex inheritance graph.

  1. Protocols can inherit from several other protocols. True or false?

a) True.
b) False.

  1. An associated type has to be a struct or class. True or false?

a) True.
b) False.

  1. In which two ways can a struct specify what type an associated type for a protocol is?

a) By using a typealias.
b) By using generics on the struct.
c) By conforming to a protocol.

  1. What does T mean in genericFunction<T>()?

a) It refers to a type called T.
b) It refers to a type that conforms to a T protocol.
c) T is a placeholder for the generic type.