iOS Development IOS App Development Fundamentals 2 — Questions and Answers
Question 1: Which framework introduced in 2019 uses a declarative syntax for building iOS user interfaces?
- UIKit
- SwiftUI (Correct answer)
- AppKit
- Core Graphics
Correct answer: SwiftUI
SwiftUI uses a declarative syntax where you describe what the UI should do rather than how to build it step by step.
Question 2: In Swift, which keyword declares a variable whose value cannot change after assignment?
- var
- let (Correct answer)
- const
- final
Correct answer: let
The 'let' keyword declares an immutable constant in Swift, while 'var' declares a mutable variable.
Question 3: What is the primary purpose of the AppDelegate in a UIKit-based iOS app?
- Rendering all views
- Handling app-level lifecycle events (Correct answer)
- Storing user data
- 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 4: Which file format is used to manage app configuration and metadata such as bundle identifier and permissions?
- Info.plist (Correct answer)
- Podfile
- Package.swift
- Main.storyboard
Correct answer: Info.plist
Info.plist holds key app configuration including bundle ID, version, and usage permission descriptions.
Question 5: What does Auto Layout primarily enable in an iOS app?
- Automatic code generation
- Adaptive UI across different screen sizes (Correct answer)
- Faster network requests
- Background data syncing
Correct answer: Adaptive UI across different screen sizes
Auto Layout uses constraints to create responsive layouts that adapt to varying device screen sizes and orientations.
Question 6: Which Swift feature safely handles the absence of a value?
- Tuples
- Optionals (Correct answer)
- Enums
- Closures
Correct answer: Optionals
Optionals represent either a value or nil, forcing safe handling of missing values.
Question 7: What is the entry point attribute for a SwiftUI app's main structure?
- @main (Correct answer)
- @StateObject
- @Published
- @Environment
Correct answer: @main
The @main attribute marks the App structure as the program's entry point in SwiftUI.
Which framework introduced in 2019 uses a declarative syntax for building iOS user interfaces?