App Development with Swift Certified User — Questions and Answers
Question 1: What does code coverage measure in the context of iOS testing?
- The percentage of source code executed during tests (Correct answer)
- The total number of lines of code in the app
- The number of test cases written for a target
- The memory consumed during a test run
Correct answer: The percentage of source code executed during tests
Code coverage measures what percentage of your source code is actually executed when the test suite runs.
Question 2: What does pagination in a REST API solve?
- Authenticates requests with page-scoped tokens
- Caches responses by page number
- Limits the number of items returned per request to avoid large payloads (Correct answer)
- Compresses response data into pages
Correct answer: Limits the number of items returned per request to avoid large payloads
Pagination breaks large datasets into smaller chunks, reducing response payload size and server load for each request.
Question 3: Which actor type in Swift concurrency guarantees its code runs on the main thread?
- GlobalActor
- MainActor (Correct answer)
- TaskActor
- UIActor
Correct answer: MainActor
@MainActor ensures the annotated code executes on the main thread, ideal for UI updates.
Question 4: What does the `guard` statement do in Swift?
- Handles errors thrown by a function
- Exits the current scope if a condition is false (Correct answer)
- Iterates over a sequence
- Declares a deferred action
Correct answer: Exits the current scope if a condition is false
`guard` evaluates a condition and requires early exit from the current scope if the condition is false.
Question 5: Which iOS 17+ API provides a lightweight, Codable-based persistence solution?
- Realm
- SwiftData (Correct answer)
- CloudKit
- GRDB
Correct answer: SwiftData
SwiftData, introduced in iOS 17, offers a Swift-native, Codable-friendly persistence layer that integrates seamlessly with SwiftUI.
Question 6: What is used for data storage in apps?
- SQLite
- iCloud
- Core Data (Correct answer)
- Document Storage
Correct answer: Core Data
Core Data is Apple's powerful and flexible framework for managing and persisting application data in iOS, macOS, watchOS, and tvOS apps. It provides an object-oriented way to interact with data, handling the underlying storage mechanisms (like SQLite) for developers. While other options exist, Core Data is Apple's native and recommended solution for structured data persistence.
Question 7: Which directory in the iOS sandbox is backed up to iCloud and suitable for user data?
- Library/Caches
- Documents (Correct answer)
- Library/Preferences
- tmp
Correct answer: Documents
The Documents directory is included in iCloud backups and is the correct location for user-generated content that should be preserved.
Question 8: What is the entry point file that defines an app's overall structure in a SwiftUI project?
- AppDelegate.m
- Main.storyboard
- Info.plist
- The App struct marked with @main (Correct answer)
Correct answer: The App struct marked with @main
A SwiftUI app's structure is defined by an App struct annotated with @main.
Question 9: Which SwiftUI modifier creates a visual animation when state changes?
- .animation(_:value:) (Correct answer)
- .withAnimation(_:)
- .animate(duration:)
- .transition(_:)
Correct answer: .animation(_:value:)
The `.animation(_:value:)` modifier automatically animates changes to the specified value using the given animation curve.
Question 10: 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 11: What is the main thread rule in UIKit?
- Network calls must be made on the main thread
- All UI updates must be performed on the main thread (Correct answer)
- Background threads can update labels but not images
- UIView animations must run on a background thread
Correct answer: All UI updates must be performed on the main thread
UIKit is not thread-safe and requires all updates to the view hierarchy to happen on the main thread.
Question 12: What is the entry point attribute for a SwiftUI app's main structure?
- @Published
- @Environment
- @StateObject
- @main (Correct answer)
Correct answer: @main
The @main attribute marks the App structure as the program's entry point in SwiftUI.
Question 13: Why should UI updates always be performed on the main thread?
- It saves battery
- It is faster
- Background threads cannot access memory
- UIKit/SwiftUI are not thread-safe for UI work off the main thread (Correct answer)
Correct answer: UIKit/SwiftUI are not thread-safe for UI work off the main thread
UI frameworks require updates on the main thread because they are not thread-safe, and off-main updates cause crashes or glitches.
Question 14: What does the Command Pattern enable designers to accomplish?
- Encapsulating all necessary information (Correct answer)
- Automating common tasks
- Allowing loosely coupled behavior
- Making code more readable
Correct answer: Encapsulating all necessary information
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. By encapsulating the receiver, the action, and the parameters, it provides all the necessary information to perform an action at a later time.
Question 15: What kind of app can be created using Xamarin?
- Cross-platform native (Correct answer)
- Universal Windows Platform app
- A Windows Phone app
- A Windows 8 app
- Windows Store app
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 16: What happens when Xcode execution reaches a line where a breakpoint is set?
- All variable values are automatically logged to the console
- App execution pauses so you can inspect variables and program state (Correct answer)
- The line is marked as potentially buggy in the issue navigator
- That line of code is skipped and execution continues
Correct answer: App execution pauses so you can inspect variables and program state
A breakpoint suspends execution at that exact line, giving you the opportunity to inspect the call stack, variables, and memory.
Question 17: 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 18: What does JSON decoding with `JSONDecoder` require of Swift types?
- They must inherit from NSObject
- They must implement a custom init
- They must conform to NSCoding
- They must conform to Decodable (Correct answer)
Correct answer: They must conform to Decodable
`JSONDecoder` can decode any Swift type that conforms to the `Decodable` protocol, automatically mapping JSON keys to properties.
Question 19: What can media players do besides play files from a server?
- Serve ads to users
- Serve advertisements
- Store and manage user data
- Distribute content to users (Correct answer)
- Analyze user behavior
Correct answer: Distribute content to users
Modern media players are often integrated with content distribution platforms, allowing them to not only play files but also facilitate the delivery and management of various forms of media content to users. This includes streaming services, downloading content for offline viewing, and organizing personal media libraries, going beyond simple playback from a single server.
Question 20: What does `@Binding` do in SwiftUI?
- Persists a value across app launches
- Creates a two-way connection to a state value owned by another view (Correct answer)
- Observes changes in an external object
- Reads a value from the environment
Correct answer: Creates a two-way connection to a state value owned by another view
`@Binding` creates a reference to a `@State` value in another view, enabling child views to read and write that state.
Question 21: Which UIKit class provides a reusable grid-based layout for views?
- UIStackView
- UICollectionView (Correct answer)
- UITableView
- UIScrollView
Correct answer: UICollectionView
UICollectionView displays ordered data items in a flexible, customizable layout, including grids and flow layouts.
Question 22: What is the purpose of the measure { } block in XCTest?
- Benchmarking the performance of a block of code (Correct answer)
- Measuring UIView dimensions at runtime
- Measuring network response latency
- Counting the number of iterations in a loop
Correct answer: Benchmarking the performance of a block of code
The measure block runs the enclosed code ten times by default and reports the average and standard deviation of execution time.
Question 23: In UIKit, what manages a single screen of content and its views?
- UIApplication
- UIViewController (Correct answer)
- UIScene
- UIView
Correct answer: UIViewController
A UIViewController manages a view hierarchy for one screen of an app.
Question 24: Which class is the central object in a Core Data stack?
- NSManagedObjectContext
- NSPersistentStore
- NSPersistentContainer (Correct answer)
- NSFetchRequest
Correct answer: NSPersistentContainer
`NSPersistentContainer` encapsulates the Core Data stack setup, providing the managed object model, context, and persistent store coordinator.
Question 25: What is the primary purpose of the AppDelegate in a UIKit-based iOS app?
- Storing user data
- Rendering all views
- Handling app-level lifecycle events (Correct answer)
- Managing Auto Layout constraints
Correct answer: Handling app-level lifecycle events
The AppDelegate responds to application-level lifecycle events such as launch, background, and termination.
Question 26: What is the purpose of the viewDidLoad() method in a UIViewController?
- Called once after the view is loaded into memory (Correct answer)
- Called when the app terminates
- Called when memory is low
- Called every time the view appears
Correct answer: Called once after the view is loaded into memory
viewDidLoad() runs once after the controller's view is loaded, ideal for one-time setup.
Question 27: What is the purpose of a UITableViewCell reuse identifier?
- To register the cell class with Interface Builder
- To uniquely identify each row's data
- To style cells with a specific color
- To efficiently recycle cells as they scroll off screen (Correct answer)
Correct answer: To efficiently recycle cells as they scroll off screen
Reuse identifiers allow UITableView to dequeue previously allocated cells instead of creating new ones, improving scroll performance.
Question 28: In SwiftUI, what is the basic building block for displaying text on screen?
- UILabel
- Text (Correct answer)
- Label
- TextView
Correct answer: Text
The Text view displays read-only text in SwiftUI.
Question 29: In SwiftUI, which property wrapper creates mutable state owned by a view?
- @Published
- @Binding
- @State (Correct answer)
- @Environment
Correct answer: @State
@State declares a source of truth for mutable, view-local data in SwiftUI.
Question 30: Which HTTP method is used to create a new resource on a REST API?
- POST (Correct answer)
- GET
- PUT
- PATCH
Correct answer: POST
The HTTP POST method is conventionally used to submit data to a server to create a new resource.
Question 31: Which operating system is required to run Xcode for iOS development?
- macOS (Correct answer)
- Linux
- ChromeOS
- Windows
Correct answer: macOS
Xcode only runs on macOS, so a Mac is required for native iOS development.
Question 32: What is the official integrated development environment (IDE) for building iOS apps?
- Xcode (Correct answer)
- Eclipse
- Visual Studio
- Android Studio
Correct answer: Xcode
Xcode is Apple's official IDE for developing apps across all Apple platforms.
Question 33: Which iOS framework enables push notifications from a remote server?
- Apple Push Notification service (APNs) (Correct answer)
- Background Fetch
- UserNotifications only
- CloudKit
Correct answer: Apple Push Notification service (APNs)
APNs is Apple's infrastructure for delivering remote push notifications from a server to iOS devices.
Question 34: Which SwiftUI container arranges views horizontally side by side?
- HStack (Correct answer)
- VStack
- Grid
- ZStack
Correct answer: HStack
An HStack arranges its child views horizontally.
Question 35: Which keyword declares a variable that can be changed later in Swift?
- let
- dynamic
- mutable
- var (Correct answer)
Correct answer: var
The 'var' keyword declares a mutable variable in Swift.
Question 36: In Swift, which keyword declares a constant whose value cannot change?
- final
- const
- let (Correct answer)
- var
Correct answer: let
The 'let' keyword declares an immutable constant in Swift.
Question 37: What app will the testers install to interact with your app?
- Apple App Store
- Google Play Test
- Firebase
- TestFlight (Correct answer)
- Google Play Test
Correct answer: TestFlight
TestFlight is Apple's official platform for beta testing iOS, watchOS, and tvOS apps. Developers invite testers to download and install the TestFlight app on their devices, which then allows them to install and test pre-release versions of the developer's app. This app facilitates feedback collection and crash reporting from the testers.
Question 38: Which SwiftUI container arranges its child views vertically?
- VStack (Correct answer)
- ZStack
- HStack
- List
Correct answer: VStack
A VStack stacks its child views vertically.
Question 39: What account is required to publish an app on the Apple App Store?
- AWS account
- Apple Developer Program membership (Correct answer)
- Microsoft Partner account
- Google Play account
Correct answer: Apple Developer Program membership
Publishing to the App Store requires a paid Apple Developer Program membership.
Question 40: What is a Swift enum with associated values used for?
- Defining protocol requirements
- Replacing classes with value semantics
- Storing additional data alongside each case (Correct answer)
- Creating value types with methods only
Correct answer: Storing additional data alongside each case
Swift enums with associated values allow each case to store custom associated data of specified types.
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