Complete the code to create an empty array of integers.
var numbers = [[1]]()The code creates an empty array of integers by specifying Int inside the square brackets.
Complete the code to create an array with three string elements.
let fruits = ["Apple", "Banana", [1]]
The array contains fruit names as strings. "Orange" fits the list of fruits.
Fill in the blank so that Swift infers the array type as [Double].
var values = [1, 2, [1]]
3.5 is a double literal, causing Swift to infer [Double]. "3.5" is a string, 3 is an integer (inferring [Int]), and true is a boolean.
Fill both blanks to create an array of booleans with two elements.
let flags: [Bool] = [[1], [2]]
The array contains boolean values true and false. Strings or numbers are not valid booleans.
Fill all three blanks to create a dictionary from strings to integers.
let scores = [[1]: [2], [3]: 90]
The dictionary keys are strings like "Alice" and "Bob". The values are integers like 85 and 90.