🦅

Swift MCQ

Test your Swift knowledge with 100 multiple choice questions covering fundamentals to advanced concepts, with instant feedback and explanations.

100 Questions 40 Beginner 40 Intermediate 20 Advanced
1

Which company created the Swift programming language?

2

How do you declare an immutable constant in Swift?

3

What is an optional in Swift?

4

What does if let do in Swift?

5

What is a struct in Swift?

6

What is the difference between struct and class in Swift?

7

What is a protocol in Swift?

8

What does guard let do?

9

What is the nil-coalescing operator ?? in Swift?

10

What is an enum in Swift?

11

What is an associated value in a Swift enum?

12

What is string interpolation in Swift?

13

What does the mutating keyword mean on a struct method?

14

What is a closure in Swift?

15

What is the @escaping attribute on a closure parameter?

16

What does the defer statement do?

17

What is a computed property?

18

What does lazy mean on a stored property?

19

What is Swift's Result type?

20

What is the strong reference cycle in Swift?

21

What is a weak reference?

22

What is an unowned reference?

23

What is ARC in Swift?

24

What is Swift's access control default?

25

What does the throws keyword signify on a function?

26

What does try? do in Swift?

27

What is a generic in Swift?

28

What are where clauses in Swift generics?

29

What is the difference between Array and ContiguousArray in Swift?

30

What is a property observer in Swift?

31

What is a typealias in Swift?

32

What is the inout parameter keyword?

33

What does the @discardableResult attribute do?

34

What is Swift's switch statement requirement?

35

What is a tuple in Swift?

36

What is a trailing closure syntax?

37

What does the some keyword do (opaque type)?

38

What is the any keyword in Swift 5.7 (existential type)?

39

What is higher-order function map in Swift?

40

What does @propertyWrapper do?

1

What is Swift's async/await and how does it compare to completion handlers?

2

What is a Swift actor?

3

What is the @MainActor attribute?

4

What is a TaskGroup in Swift concurrency?

5

What is protocol-oriented programming in Swift?

6

What is a protocol extension in Swift?

7

What are associated types in a protocol?

8

What is the difference between value types and reference types regarding mutation?

9

What is @autoclosure?

10

What is the Sendable protocol?

11

What is copy-on-write (COW) in Swift?

12

What is the Hashable protocol?

13

What is Codable in Swift?

14

What is dynamic dispatch vs static dispatch in Swift?

15

What is the @objc attribute used for?

16

What is a subscription type conformance (@dynamicMemberLookup)?

17

What is the difference between throwing and returning Result?

18

What does the @Published property wrapper do (Combine)?

19

What is a KeyPath in Swift?

20

What is SwiftUI's @State property wrapper?

21

What is SwiftUI's @Binding?

22

What is SwiftUI's @ObservedObject?

23

What is the difference between @ObservedObject and @StateObject?

24

What is Swift's Combine framework?

25

What is the difference between publisher and subject in Combine?

26

What is Swift Concurrency's withCheckedThrowingContinuation?

27

What is a Swift associated type with a default?

28

What is Swift's existential container layout?

29

What is @discardableResult when used on property accessors?

30

What are conditional conformances in Swift?

31

What is the @dynamicCallable attribute?

32

What is Swift's withUnsafeMutablePointer?

33

What is Swift's AttributedString?

34

What is the Swift AsyncStream?

35

What is Swift's MainActor isolation checking?

36

What is a Swift package plugin?

37

What is the purpose of Swift's nonisolated keyword?

38

What is Swift's TaskLocal?

39

What is Swift's Clock protocol (Swift 5.7)?

40

What is Swift's withCheckedContinuation for bridging synchronous callbacks?