Given a non-optional `let count = 5`, what does `count ?? 0` produce?
let count = 5
let result = count ?? 0Read the full question →Every question is hand-checked, every answer comes with an explanation, and your progress builds into a clear picture of where you stand.
Every Swift question shows its code before you answer, so you are reading real Swift, not a description of it.
Once you attempt a question you get the reasoning, not just a tick. That matters most on Swift, where retain cycles and capture lists, struct versus class copying, optionals and forced unwraps, protocol witness dispatch, and actor isolation in structured concurrency.
Progress is tracked per topic across the 51 Swift topics, so revision points at the gaps instead of the whole list.
549 Swift questions right now: 60 easy, 245 medium and 244 hard. That number is read straight from the question table when this page is built, so it is never a rounded marketing figure.
No. Every Swift question, including its code snippet, its difficulty and its topic, is readable without signing in. You need a free account only to submit an answer, see which option is correct, and read the worked explanation. We keep it that way so the platform stays honest about what you actually got right.
Retain cycles and capture lists, struct versus class copying, optionals and forced unwraps, protocol witness dispatch, and actor isolation in structured concurrency.
51 distinct topics are tagged on the Swift questions, including weak side tables, associated types, actors and actor isolation, result builders, existential containers, retain cycles and capture lists. The topic labels come from the questions themselves, so the list matches what you will actually be asked.
Yes. Reading is free and unlimited. A free account unlocks answering, explanations and progress tracking. Pro (₹199 per month) adds AI explanations and AI-graded guesstimates on top; it is not needed to practise Swift MCQs.
iOS, iPadOS, macOS, watchOS engineering, and server-side Swift at a handful of companies.
These are 12 of the 549 Swift questions in the library, pulled live from the question table. The snippet, the difficulty and the topic are all here. The answer options and the explanation are not. Those need a free account.
Retain cycles and capture lists, struct versus class copying, optionals and forced unwraps, protocol witness dispatch, and actor isolation in structured concurrency.
let count = 5
let result = count ?? 0Read the full question →class Box { var n = 0 }
let x = Box()
let y = x
y.n = 42Read the full question →func check(_ n: Int?) -> String {
guard let n = n, n > 0 else { return "invalid" }
return "ok: \(n)"
}
print(check(0))Read the full question →let dict = ["a": 1]
let v = dict["b"]!
print(v)Read the full question →struct Counter { var value = 0 }
let c = Counter()
c.value = 1Read the full question →let value: Int? = 10
if let value = value {
print(value + 1)
}Read the full question →enum Reading: Int {
case low(Int)
case high(Int)
}Read the full question →var list: [Int]? = [1, 2, 3]
let r = list?.removeAll()
print(type(of: r))Read the full question →func read(_ name: String) -> String {
var status = "opened"
defer { status = "closed" }
return status
}Read the full question →let a: Set = [1, 2, 3]
let b: Set = [3, 4, 5]
let result = a.intersection(b)
print(result)Read the full question →let nums: [Int?] = [1, nil, 2, nil, 3]Read the full question →var dict = ["x": 1]
dict["x", default: 0] += 10Read the full question →We keep the correct answer, the explanation and the scoring behind sign-in so the platform stays honest, which is why the correct option and the worked explanation for every Swift question stay behind a free account. Signing in is free and takes a few seconds.
iOS, iPadOS, macOS, watchOS engineering, and server-side Swift at a handful of companies.