Question |
Good |
Fails |
Why strong references are not used for enums? |
1 |
1 |
Given the following variable: var foo: [String?]. What type does foo.compactMap { $0 } returns? |
2 |
0 |
What is the difference between Any and AnyObject? |
2 |
0 |
What is the difference between weak and strong references? |
1 |
1 |
What is the output of this function?
func foo() -> String {
var x = "bar"
guard let y = x else { return "foo" }
if y == "bar" {
return "fighters"
}
return x
} |
0 |
2 |
When this code is executed, what will the foo constant contain?
let foo = ["a", "b", "c"].map { [$0, $0] } |
2 |
0 |
What output will be be produced by the following code?
for i in stride(from: 1, to: 6, by: 2) {
print(i)
} |
1 |
1 |