Module quiz: Structures and classes :Programming Fundamentals in Swift (Meta iOS Developer Professional Certificate) Answers 2026
Question 1
A struct is a value type. What does this mean?
✅ Each instance keeps a unique copy of its data
❌ Instances share a single copy of the data
Question 2
What is the output of the following code?
❌ 20
❌ 100
✅ 80.0
❌ 0.2
Question 3
What is the output of the following code?
❌ 5, 5
✅ 20, 5
❌ 20, 20
❌ 5, 20
Question 4
What is the output of the following code?
❌ 5, 20
✅ 20, 20
❌ 5, 5
❌ 20, 5
Question 5
What is the output of the following code?
❌ Jeep has 3 wheels
❌ Jeep has 5 wheels
✅ Jeep has 4 wheels
Question 6
What is the output of the following code?
❌ 0.0
❌ 2.0
✅ 4.0
Question 7
Which of the following statements best describes the differences between structures and classes in Swift? (Select all that apply)
✅ Classes are known as reference types while structures are known as value types.
❌ Structures can use inheritance and by that extend the subclass.
✅ Structures come with an auto-generated memberwise initializer, while with classes you must create your own.
Question 8
Why should a structure be used as a starting point when creating a new data type and not a class? (Select all that apply)
❌ Because in Swift standard library you will find that reference types are primary used.
✅ Because a structure is a value type, and a class is a reference type.
✅ Because a local change in the code when using a structure will not affect other parts of the code.
Question 9
What are the correct statements regarding stored and computed properties in classes?
❌ A computed property is read-only
❌ A stored property is primary used when there is a need to encapsulate a block of computational code.
✅ A computed property does not store a value.
Question 10
When creating a class initializer, when would it be necessary to use the self keyword?
❌ When a class property is assigned a default value.
✅ When name of the property in the class is the same as the name of the parameters in the initializer.
❌ When there are more than 4 parameters in the class initializer.
🧾 Summary Table
| Question | Correct Answer |
|---|---|
| Q1 | Each instance keeps a unique copy |
| Q2 | 80.0 |
| Q3 | 20, 5 |
| Q4 | 20, 20 |
| Q5 | Jeep has 4 wheels |
| Q6 | 4.0 |
| Q7 | 1st & 3rd options |
| Q8 | 2nd & 3rd options |
| Q9 | Computed property does not store value |
| Q10 | When property & parameter names are same |