Module quiz: Data structures :Programming Fundamentals in Swift (Meta iOS Developer Professional Certificate) Answers 2026
Question 1
Which of the following is optimized for looping over an array?
✅ a for in loop
❌ a repeat while loop
❌ a while loop
Question 2
Which of the following is optimized for looping over a dictionary?
❌ a while loop
✅ a for in loop
❌ a repeat while loop
Question 3
Individual elements of a tuple have index numbers.
✅ True
❌ False
Question 4
Which method would you use to add a value 5 to the end of an array called numbers? (Select all that apply)
✅ numbers += [5]
✅ numbers.append(5)
❌ numbers[5] = 3
Question 5
Individual elements of a tuple can be accessed using a name/label if they were added when it was created.
✅ True
❌ False
Question 6
You can extract all the values from a dictionary using the following syntax:
❌ travelMiles.keys
✅ travelMiles.values
Question 7
Which of the following will remove keys and values from a dictionary? (Select all that apply)
✅ travelMiles[“George”] = nil
✅ travelMiles.deleteValue(forKey:”George”)
Question 8
The following code block terminates code execution:
✅ True
❌ False
Question 9
What is the output of the following code?
❌ The code will produce a compile error.
❌ The array is empty!
✅ The array isn’t empty!
Question 10
How do you access the elements of the following tuple?
✅ Indices.
❌ Labels
🧾 Summary Table
| Question | Correct Answer |
|---|---|
| Q1 | a for in loop |
| Q2 | a for in loop |
| Q3 | True |
| Q4 | numbers += [5], numbers.append(5) |
| Q5 | True |
| Q6 | travelMiles.values |
| Q7 | Both options |
| Q8 | True |
| Q9 | The array isn’t empty! |
| Q10 | Indices |