App Development with Swift Certified User — Questions and Answers
Question 1: What does the `lazy` keyword do when applied to a stored property in Swift?
- Marks the property as optional
- Makes the property thread-safe
- Delays initialization until the property is first accessed (Correct answer)
- Prevents the property from being mutated
Correct answer: Delays initialization until the property is first accessed
A `lazy` stored property is not initialized until the first time it is accessed, which is useful for expensive setup.
Question 2: In some cases, developers need to capsulate command execution into separate objects, what is this called?
- The Command Pattern (Correct answer)
- The Module Pattern
- The Pipe Pattern
- The Service Pattern
- The FIFO Pattern
Correct answer: The Command Pattern
The Command Pattern is a behavioral design pattern that encapsulates a request as an object, thereby allowing for parameterization of clients with different requests, queuing or logging of requests, and support for undoable operations. It decouples the object that invokes the operation from the object that knows how to perform it. This pattern is useful for implementing features like undo/redo functionality, transaction systems, and menu operations.
Question 3: Which property wrapper in SwiftUI creates a source of truth for a value type owned by the current view?
- @State (Correct answer)
- @Published
- @Binding
- @Environment
Correct answer: @State
@State declares a view-owned mutable source of truth for a value type.
Question 4: What does the `async/await` version of URLSession data task return?
- (Data, URLResponse, Error)
- (Data, URLResponse) (Correct answer)
- Result<Data, Error>
- AnyCancellable
Correct answer: (Data, URLResponse)
The async `URLSession.data(for:)` method returns a tuple of `(Data, URLResponse)` and throws an error on failure.
Question 5: Which keyword declares a variable that can be changed later in Swift?
- var (Correct answer)
- dynamic
- mutable
- let
Correct answer: var
The 'var' keyword declares a mutable variable in Swift.
Question 6: Which Swift collection stores key-value pairs?
- Set
- Dictionary (Correct answer)
- Stack
- Array
Correct answer: Dictionary
A Dictionary stores unordered key-value pairs in Swift.
Question 7: What kind of app can be created using Xamarin?
- Windows Store app
- A Windows Phone app
- A Windows 8 app
- Universal Windows Platform app
- Cross-platform native (Correct answer)
Correct answer: Cross-platform native
Xamarin is a Microsoft-owned framework that allows developers to build cross-platform applications for iOS, Android, and Windows using C# and the .NET framework. Crucially, Xamarin compiles the C# code into native UI and API calls, resulting in apps that perform and look like native applications on each platform, rather than web-based or hybrid apps.
Question 8: Which SwiftUI container arranges views horizontally side by side?
- Grid
- ZStack
- HStack (Correct answer)
- VStack
Correct answer: HStack
An HStack arranges its child views horizontally.
Question 9: Which framework provides on-device persistent storage with an object graph in modern iOS apps?
- Combine
- Core Data (Correct answer)
- MapKit
- URLSession
Correct answer: Core Data
Core Data manages an object graph and provides persistence for structured app data.
Question 10: What language can you use to build iOS apps?
- Java
- Python
- Swift or Objective-C (Correct answer)
- C#
Correct answer: Swift or Objective-C
Swift is Apple's modern, powerful, and intuitive programming language designed for building apps across all Apple platforms. Objective-C is its predecessor, an older but still supported language that was the primary language for iOS development for many years. Both languages are fully supported for creating iOS applications within Xcode.
Question 11: Which Swift collection type stores key-value pairs?
- Set
- Array
- Dictionary (Correct answer)
- Tuple
Correct answer: Dictionary
A Swift Dictionary stores associations between keys of one type and values of another type.
Question 12: Which iOS framework enables push notifications from a remote server?
- CloudKit
- Apple Push Notification service (APNs) (Correct answer)
- UserNotifications only
- Background Fetch
Correct answer: Apple Push Notification service (APNs)
APNs is Apple's infrastructure for delivering remote push notifications from a server to iOS devices.
Question 13: What is the purpose of the Info.plist file in an iOS app?
- Renders the UI
- Stores app configuration and metadata (Correct answer)
- Holds user passwords
- Contains the app's source code
Correct answer: Stores app configuration and metadata
Info.plist stores key configuration values and metadata about the app.
Question 14: What does the 'guard' statement do in Swift?
- Loops over a collection
- Exits early if a condition is not met (Correct answer)
- Defines a protocol
- Catches errors only
Correct answer: Exits early if a condition is not met
A guard statement requires a condition to be true to continue; otherwise it exits the current scope early.
Question 15: Which Xcode tool helps you detect memory leaks and performance issues at runtime?
- Interface Builder
- Simulator
- Instruments (Correct answer)
- Asset Catalog
Correct answer: Instruments
Instruments profiles apps for leaks, allocations, time, and other runtime metrics.
Question 16: In UIKit, what manages a single screen of content and its views?
- UIViewController (Correct answer)
- UIView
- UIApplication
- UIScene
Correct answer: UIViewController
A UIViewController manages a view hierarchy for one screen of an app.
Question 17: What does ARC (Automatic Reference Counting) manage in Swift?
- Network caching
- Memory by tracking object references (Correct answer)
- App permissions
- Auto Layout constraints
Correct answer: Memory by tracking object references
ARC automatically tracks and frees memory used by class instances when no references remain.
Question 18: Which XCTest API is used to test asynchronous operations that complete after a delay?
- XCTestExpectation (Correct answer)
- XCAsyncResult
- XCTAwait
- XCTAssertAsync
Correct answer: XCTestExpectation
XCTestExpectation creates a waitable condition that keeps the test alive until the async operation fulfills it or it times out.
Question 19: What is the name of Apple's IDE for developing apps?
- CodeMate
- Code::Blocks
- Appcelerator Studio
- Xcode (Correct answer)
- Appcelerator
Correct answer: Xcode
Xcode is the integrated development environment (IDE) provided by Apple for developing software for macOS, iOS, iPadOS, watchOS, and tvOS. It includes a suite of tools for software development, such as a code editor, debugger, and interface builder, making it the primary tool for creating Apple platform applications.
Question 20: What does ARC stand for in iOS memory management?
- Allocated Region Collector
- Automatic Reference Counting (Correct answer)
- Automatic Resource Caching
- Asynchronous Runtime Closure
Correct answer: Automatic Reference Counting
Automatic Reference Counting tracks and frees objects when no strong references remain.
Question 21: Which Xcode tool lets you visually inspect the view hierarchy as a 3D layer breakdown at runtime?
- Memory Graph
- Console
- Instruments
- View Debugger (Correct answer)
Correct answer: View Debugger
The View Debugger pauses the running app and renders a 3D exploded view of all UI layers and constraints.
Question 22: Which tool in Xcode is used to profile performance and detect memory leaks?
- Asset Catalog
- Instruments (Correct answer)
- Simulator
- Interface Builder
Correct answer: Instruments
Instruments is Xcode's profiling tool for analyzing performance and memory.
Question 23: What does the 'po' command do when typed in the Xcode LLDB debugger console?
- Profiles the object's current memory footprint
- Pauses the current operation immediately
- Prints the description of an object to the console (Correct answer)
- Points the instruction pointer to the next executable line
Correct answer: Prints the description of an object to the console
'po' (print object) calls the object's description property and outputs it in the debugger console.
Question 24: In MVVM architecture, what is the primary responsibility of the ViewModel?
- Configuring the build settings
- Rendering pixels to the screen
- Holding presentation logic and state for the view (Correct answer)
- Managing the database schema
Correct answer: Holding presentation logic and state for the view
The ViewModel exposes presentation state and logic, decoupling the view from the model.
Question 25: In SwiftUI, which property wrapper creates mutable state owned by a view?
- @State (Correct answer)
- @Published
- @Environment
- @Binding
Correct answer: @State
@State declares a source of truth for mutable, view-local data in SwiftUI.
Question 26: What is the official integrated development environment (IDE) for building iOS apps?
- Xcode (Correct answer)
- Visual Studio
- Eclipse
- Android Studio
Correct answer: Xcode
Xcode is Apple's official IDE for developing apps across all Apple platforms.
Question 27: What does `NSFetchRequest` do in Core Data?
- Migrates data between model versions
- Defines a query to retrieve managed objects from the persistent store (Correct answer)
- Observes changes in the managed object context
- Creates new managed objects in the context
Correct answer: Defines a query to retrieve managed objects from the persistent store
`NSFetchRequest` specifies the entity, predicates, sort descriptors, and result type used to query the persistent store.
Question 28: What is an Optional in Swift?
- A UI component
- A required parameter
- A type of loop
- A type that can hold either a value or nil (Correct answer)
Correct answer: A type that can hold either a value or nil
An Optional represents a value that may be present or absent (nil).
Question 29: What OS does Xcode run on?
- iOS
- Linux
- GNU/Linux
- Mac OS X (Correct answer)
- Microsoft Windows
Correct answer: Mac OS X
Xcode is an exclusive development tool for Apple's ecosystem. It is designed to run specifically on macOS (formerly Mac OS X) and cannot be natively installed or run on other operating systems like Windows or Linux. This ensures a tightly integrated development experience within the Apple environment.
Question 30: What is certificate pinning in iOS networking?
- Validating a server's certificate against a known copy bundled in the app (Correct answer)
- Requiring a PIN code before making requests
- Caching TLS handshake results
- Limiting requests to pinned IP addresses
Correct answer: Validating a server's certificate against a known copy bundled in the app
Certificate pinning prevents man-in-the-middle attacks by comparing the server's certificate to a trusted copy embedded in the app bundle.
Question 31: On what platform can users interact with the testers to provide feedback on your app?
- Windows
- IOS (Correct answer)
- Android
Correct answer: IOS
While testing platforms like TestFlight (which runs on iOS) facilitate interaction, the question asks about the *platform* where users interact. TestFlight is an app *on* the iOS platform that enables this interaction. Therefore, the interaction happens on the iOS platform itself, through the TestFlight app, allowing testers to run the app on their iOS devices and submit feedback directly.
Question 32: What is the file extension for a Swift source code file?
- .swift (Correct answer)
- .sft
- .swf
- .sw
Correct answer: .swift
Swift source files use the .swift extension.
Question 33: Which tool distributes beta builds of an iOS app to testers before App Store release?
- TestFlight (Correct answer)
- Xcode Cloud
- CocoaPods
- Swift Package Manager
Correct answer: TestFlight
TestFlight distributes pre-release builds to internal and external testers.
Question 34: What is a power feature added in iOS 11 with the use of machine learning?
- Background App Refresh
- ARKit
- Face ID
- 3D Touch
- Core ML (Correct answer)
Correct answer: Core ML
Core ML is Apple's framework introduced in iOS 11 that allows developers to integrate machine learning models directly into their apps. It provides a unified way to leverage pre-trained models for tasks like image recognition, natural language processing, and predictive text, enabling powerful on-device intelligence without requiring a network connection.
Question 35: What does the 'func' keyword do in Swift?
- Declares a function (Correct answer)
- Declares a class
- Creates a loop
- Imports a framework
Correct answer: Declares a function
The 'func' keyword is used to define a function in Swift.
Question 36: Which Swift feature safely handles the absence of a value?
- Closures
- Enums
- Optionals (Correct answer)
- Tuples
Correct answer: Optionals
Optionals represent either a value or nil, forcing safe handling of missing values.
Question 37: What is the main benefit of using dependency injection in an iOS app?
- Improved testability and decoupling (Correct answer)
- Smaller binary size
- Faster compile times
- Automatic UI layout
Correct answer: Improved testability and decoupling
Dependency injection makes components easier to test and swap by removing hard-coded dependencies.
Question 38: Which Swift operator is used for nil-coalescing?
- ?!
- ?? (Correct answer)
- !?
- ||
Correct answer: ??
The nil-coalescing operator `??` unwraps an optional and provides a default value if the optional is nil.
Question 39: What type of problem does the Memory Graph Debugger in Xcode primarily help identify?
- CPU usage spikes
- Frame rate drops in animations
- Retain cycles and memory leaks (Correct answer)
- Network latency issues
Correct answer: Retain cycles and memory leaks
The Memory Graph Debugger visualizes object reference graphs to help find retain cycles that prevent deallocation.
Question 40: What is the entry point attribute for a SwiftUI app's main structure?
- @main (Correct answer)
- @Published
- @StateObject
- @Environment
Correct answer: @main
The @main attribute marks the App structure as the program's entry point in SwiftUI.
App Development with Swift Certified User
The Apple App Development with Swift Certified User exam tests knowledge of Swift programming, Xcode, UIKit/SwiftUI, and core iOS app development concepts. It validates foundational skills in building, debugging, and deploying iOS applications.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds