Swift MCQ
Test your Swift knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.
Which company created the Swift programming language?
2How do you declare an immutable constant in Swift?
3What is an optional in Swift?
4What does if let do in Swift?
5What is a struct in Swift?
6What is the difference between struct and class in Swift?
7What is a protocol in Swift?
8What does guard let do?
9What is the nil-coalescing operator ?? in Swift?
10What is an enum in Swift?
11What is an associated value in a Swift enum?
12What is string interpolation in Swift?
13What does the mutating keyword mean on a struct method?
14What is a closure in Swift?
15What is the @escaping attribute on a closure parameter?
16What does the defer statement do?
17What is a computed property?
18What does lazy mean on a stored property?
19What is Swift's Result type?
20What is the strong reference cycle in Swift?
21What is a weak reference?
22What is an unowned reference?
23What is ARC in Swift?
24What is Swift's access control default?
25What does the throws keyword signify on a function?
26What does try? do in Swift?
27What is a generic in Swift?
28What are where clauses in Swift generics?
29What is the difference between Array and ContiguousArray in Swift?
30What is a property observer in Swift?
31What is a typealias in Swift?
32What is the inout parameter keyword?
33What does the @discardableResult attribute do?
34What is Swift's switch statement requirement?
35What is a tuple in Swift?
36What is a trailing closure syntax?
37What does the some keyword do (opaque type)?
38What is the any keyword in Swift 5.7 (existential type)?
39What is higher-order function map in Swift?
40What does @propertyWrapper do?
What is Swift's async/await and how does it compare to completion handlers?
2What is a Swift actor?
3What is the @MainActor attribute?
4What is a TaskGroup in Swift concurrency?
5What is protocol-oriented programming in Swift?
6What is a protocol extension in Swift?
7What are associated types in a protocol?
8What is the difference between value types and reference types regarding mutation?
9What is @autoclosure?
10What is the Sendable protocol?
11What is copy-on-write (COW) in Swift?
12What is the Hashable protocol?
13What is Codable in Swift?
14What is dynamic dispatch vs static dispatch in Swift?
15What is the @objc attribute used for?
16What is a subscription type conformance (@dynamicMemberLookup)?
17What is the difference between throwing and returning Result?
18What does the @Published property wrapper do (Combine)?
19What is a KeyPath in Swift?
20What is SwiftUI's @State property wrapper?
21What is SwiftUI's @Binding?
22What is SwiftUI's @ObservedObject?
23What is the difference between @ObservedObject and @StateObject?
24What is Swift's Combine framework?
25What is the difference between publisher and subject in Combine?
26What is Swift Concurrency's withCheckedThrowingContinuation?
27What is a Swift associated type with a default?
28What is Swift's existential container layout?
29What is @discardableResult when used on property accessors?
30What are conditional conformances in Swift?
31What is the @dynamicCallable attribute?
32What is Swift's withUnsafeMutablePointer?
33What is Swift's AttributedString?
34What is the Swift AsyncStream?
35What is Swift's MainActor isolation checking?
36What is a Swift package plugin?
37What is the purpose of Swift's nonisolated keyword?
38What is Swift's TaskLocal?
39What is Swift's Clock protocol (Swift 5.7)?
40What is Swift's withCheckedContinuation for bridging synchronous callbacks?
What is structured concurrency in Swift 5.5+?
2What is the Swift type system's existential type erasure limitation?
3How does Swift implement generics specialization?
4What is the Swift runtime's metadata system?
5What are result builders in Swift?
6What is the Swift concurrency model's cooperative thread pool?
7What is the ~Copyable protocol and noncopyable types in Swift?
8What is the difference between opaque (some) and existential (any) types?
9What is macro expansion in Swift 5.9?
10What is the Swift Observation framework (@Observable)?
11What is Swift's witness table and how does it relate to protocol performance?
12What is the Swift compiler's whole-module optimization (WMO)?
13What is Swift's memory layout and how does Unsafe APIs expose it?
14What is the Sendable checking and actor-isolated closure interaction?
15What is Swift's _modify accessor?
16What is Swift's Unmanaged<T> type?
17What is Swift's type metadata and how does it enable generics?
18What is Swift's opaque type and its interaction with primary associated types?
19What is the Swift actor reentrancy problem?
20What is the difference between Task and TaskGroup in structured concurrency?