Questions

  1. Which statement about reference types is false?

a) Reference types are stored on the heap.
b) Reference types can always be subclassed.
c) Reference types can conform to multiple protocols.

  1. Which statement about value types is true?

a) Value types are stored on the heap.
b) Value types can always be subclassed.
c) Values types can conform to multiple protocols.

  1. What does heap allocation mean?

a) An object allocated on the heap is stored at a fixed place in memory.
b) An object allocated on the heap is stored with a variable size in RAM memory.
c) It means that an object is stored in an optimized location.

  1. You should always use a struct for your data models. True or false?

a) True, because you don't need inheritance.
b) False, it depends on whether your models have an identity.
c) False, because data models should always be subclassed.

  1. What keyword should you add to a function that mutates a property on a struct?

a) mutates.
b) mutating.
c) updates.

  1. Which type of object is not allocated on the heap?

a) A closure.
b) A class.
c) An enum.

  1. Which statement about the stack is true?

a) The stack has a fixed size.
b) The first object added to the stack will be the first object to be removed.
c) It is slow to write objects to the stack.

  1. In which of the following cases would a reference type be a good choice?

a) When you want to create a new button in your app.
b) When writing a networking object.
c) When you write an object that represents a location on a map.

  1. In which of the following cases would a value type be a good choice?

a) When you want to create a new button in your app.
b) When writing a networking object.
c) When you're creating an object that represents a person.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset