Test your knowledge

  1. Swift uses one of the following mechanisms to automatically deallocate the memory used by instances that aren't referenced anymore:
    1. Automatic Random Garbage Collector.
    2. Automatic Reference Counting.
    3. Automatic Instance Map Reduce.

  2. Swift executes an instance's deinitializer:
    1. Before the instance is deallocated from memory.
    2. After the instance is deallocated from memory.
    3. After the instance memory is allocated.

  3. A deinitializer:
    1. Can still access all of the instance's resources.
    2. Can only access the instance's methods but no properties.
    3. Cannot access any of the instance's resources.

  4. Swift allows us to define:
    1. Only one initializer per class.
    2. A main initializer and two optional secondary initializers.
    3. Many initializers with different arguments.

Get Swift 3 ObjectOriented Programming - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.