Skip to content
tezvyn:

Top 30 Easy iOS & Swift Concepts Quiz for Beginners

30 easy multiple-choice iOS & Swift concept questions, the vocabulary and first principles, the parts you need before anything else makes sense. They come from 30 bites in the iOS & Swift library, the gentlest slice of the 180 iOS & Swift concept questions in the library. Answer them here or read straight down. Every question carries the correct option, why it is correct, and a link to the bite it came from.

SwiftUI, UIKit, Xcode, Swift language, Apple platforms

30 questions. Pick an answer, or open “Show the answer” to read it.

Answers are graded in your browser. Nothing is saved, and no XP or streak is earned here. The app keeps score.

  1. Question 1 of 30

    A Swift function tries to compile the line let total = 0 followed later in the same function by total = total + 10. What happens?

    Show the answer

    Answer: c · It fails to compile, because let creates a constant that can only be assigned once, and the second line attempts a second assignment

    let enforces single assignment for any type, value or reference, and the compiler catches a second assignment as an error before the program ever runs. Option A is wrong because the let versus var distinction is unrelated to value versus reference semantics, and option C is wrong because Swift never silently ignores a reassignment, it is a hard compile error.

    Read the full bite: Variables and Constants in Swift

  2. Question 2 of 30

    What is the main benefit of using control flow statements like if and for in Swift?

    Show the answer

    Answer: c · They allow a program to make decisions and repeat specific actions.

    Control flow statements are essential because they enable programs to make decisions based on conditions and to repeat blocks of code, moving beyond a simple linear execution. While they can help structure logic to avoid errors, their primary role isn't automatic error fixing or direct speed optimization.

    Read the full bite: Swift Control Flow: Directing Your Code's Path

  3. Question 3 of 30

    When a struct and a class instance are independently passed to functions that modify them, which statement accurately describes the effect on the original instances?

    Show the answer

    Answer: b · The original class is modified, but the original struct remains unchanged.

    Structs are value types, so passing them to a function creates a copy, and modifications within the function do not affect the original. Classes are reference types, meaning the function receives a reference to the original instance, so changes made through that reference will modify the original object.

    Read the full bite: Value vs. Reference Semantics in Swift

  4. Question 4 of 30

    When is the Swift Result type most advantageous for handling failable operations?

    Show the answer

    Answer: d · When an asynchronous operation needs to explicitly communicate either a success value or a specific error.

    The Result type shines in asynchronous programming, providing a standard and type-safe way to pass either a success value or a specific error, especially when errors cannot be propagated with 'throws' across completion handler boundaries. Option A is incorrect because 'throws' is generally preferred for synchronous functions.

    Read the full bite: The Result Type: Modeling Success and Failure

  5. Question 5 of 30

    Consider a protocol with a default method implementation provided by a protocol extension. If a type conforming to this protocol also implements that same method, which version will be executed?

    Show the answer

    Answer: d · The type's specific implementation will be executed, taking precedence over the default.

    The card explicitly states: "If the conforming type provides its own implementation for a method, the type's specific version is called at runtime, overriding the default." This allows for customization while still providing a fallback. Option A is incorrect because the type's specific implementation takes precedence.

    Read the full bite: Protocol Extensions: Default Behavior for Free

  6. Question 6 of 30

    Which statement accurately describes the primary role of an Xcode project?

    Show the answer

    Answer: d · It acts as a central blueprint, organizing references to all files, build settings, and instructions needed to build an app.

    An Xcode project serves as a central repository that organizes references to all necessary files, build settings, and instructions for building an app, acting as its blueprint. It does not directly contain all files within the .xcodeproj file, nor is it solely a text editor or just for App Store deployment.

    Read the full bite: Xcode Project: Your App's Blueprint and Toolbox

  7. Question 7 of 30

    What is the primary advantage of using Interface Builder for UI development?

    Show the answer

    Answer: d · It enables visual design and arrangement of UI components, accelerating layout.

    Interface Builder's main benefit is its visual approach to UI design, allowing developers to quickly lay out screens without writing extensive layout code. While it connects to code, it does not remove the need for code files or automatically generate all UI logic, and programmatic UI is an alternative method.

    Read the full bite: Interface Builder: Visual UI Design for iOS/macOS

  8. Question 8 of 30

    What is the primary advantage of using an Asset Catalog for managing images in an iOS application?

    Show the answer

    Answer: b · It automates the selection and delivery of the correct image variant (e.g., resolution, appearance) for the current device context.

    The card emphasizes that Asset Catalogs solve the "chaos of managing multiple versions" by automatically serving "the perfect version for the current context" (B). While assets are compiled into an optimized format, the primary advantage is the intelligent management and automatic selection of different variants, not just compression (C). Options A and C describe scenarios explicitly mentioned as "when not to use it" for Asset Catalogs.

    Read the full bite: Asset Catalogs: Your App's Smart Media Library

  9. Question 9 of 30

    Which task is explicitly stated as NOT a primary responsibility of a UIView?

    Show the answer

    Answer: c · Managing application state or performing network operations

    The card states that non-visual tasks like network requests, data processing, or managing application state should not live in view code. The other options describe core functions of a UIView.

    Read the full bite: UIView: The Building Block of iOS UIs

  10. Question 10 of 30

    Which UIViewController lifecycle method is best for refreshing data or UI that might have changed while the view was hidden?

    Show the answer

    Answer: a · viewWillAppear

    viewWillAppear is called every time the view is about to become visible, making it ideal for refreshing data or UI that might have changed. viewDidLoad is only called once when the view is first loaded, not for subsequent refreshes.

    Read the full bite: The UIViewController Lifecycle: From Creation to On-Screen

  11. Question 11 of 30

    Which statement accurately describes a fundamental characteristic of UIStackView's rendering behavior?

    Show the answer

    Answer: b · It acts as an invisible layout manager and does not render any visual elements itself.

    UIStackView is explicitly described as an "invisible box" and a "non-rendering" class. It manages layout but does not draw any visual content itself, meaning it cannot have a background color or border directly, making option C a common misconception.

    Read the full bite: UIStackView: Layouts Without Manual Constraints

  12. Question 12 of 30

    Which statement accurately characterizes a SwiftUI View?

    Show the answer

    Answer: a · It is a lightweight, declarative description of a UI element, frequently recreated by the framework.

    A SwiftUI View is a lightweight, declarative recipe or blueprint for UI, not the actual persistent UI element itself, and is frequently recreated. Option D is incorrect because it describes a common misconception, treating it like a heavy, persistent UIKit UIView.

    Read the full bite: SwiftUI's View: A Blueprint, Not a Building

  13. Question 13 of 30

    In SwiftUI, how does a ZStack arrange its child views along the Z-axis?

    Show the answer

    Answer: d · The first view declared is positioned at the back, with subsequent views layered on top.

    A ZStack layers views from back to front, meaning the first view listed is at the back, and the last view is at the front. Option B describes the opposite behavior, which is a common misconception.

    Read the full bite: SwiftUI Stacks: Arrange Views Vertically, Horizontally, and in Layers

  14. Question 14 of 30

    What is the primary reason iOS transitions an app from the BACKGROUND to the SUSPENDED state?

    Show the answer

    Answer: a · To free up CPU cycles and battery while retaining the app's state in memory for a quick relaunch.

    The SUSPENDED state freezes the app in memory, stopping all code execution to conserve CPU and battery, yet allows for a fast return to the ACTIVE state. It does not allow for continued background tasks, nor does it immediately terminate the app.

    Read the full bite: iOS App States: From Launch to Suspension

  15. Question 15 of 30

    Which task is most appropriate for the AppDelegate according to its intended purpose?

    Show the answer

    Answer: c · Initializing global services like analytics and crash reporting at app launch.

    The AppDelegate is designed for global, lifecycle-tied tasks such as initializing core services like analytics at launch. Other options like managing UI display, data validation, or network requests are considered business logic that should be delegated to specialized objects, not the AppDelegate, to avoid bloating it.

    Read the full bite: The AppDelegate: Your App's Central Command

  16. Question 16 of 30

    In the Model-View-Controller (MVC) pattern, what is the primary role of the Controller?

    Show the answer

    Answer: b · To mediate between the Model and View, translating user actions into Model updates and View refreshes.

    The Controller's primary role is to act as the intermediary, receiving user actions from the View, interacting with the Model, and then updating the View. Options A and B describe the Model and View respectively, while option D refers to a common anti-pattern and a goal for improving MVC, not the Controller's fundamental function.

    Read the full bite: Model-View-Controller (MVC): Separating App Logic from UI

  17. Question 17 of 30

    For which navigation pattern is UINavigationController primarily designed?

    Show the answer

    Answer: b · Guiding users through a hierarchical, drill-down sequence of screens.

    UINavigationController is designed for hierarchical, 'drill-down' navigation, managing a stack of screens from general to specific. Options A and B describe use cases for UITabBarController and modal presentations, which the card explicitly advises against for this controller.

    Read the full bite: UINavigationController: Stack-Based Screen Management

  18. Question 18 of 30

    For which scenario is a UITabBarController the most appropriate choice?

    Show the answer

    Answer: b · Allowing users to switch between an app's main, independent sections like "Feed" and "Profile."

    A UITabBarController is designed for top-level navigation between distinct, non-sequential sections of an app, as described in option B. Options A and B describe sequential or hierarchical navigation, which are better suited for a UINavigationController, while option C is a modal presentation, not a primary navigation pattern.

    Read the full bite: UITabBarController: Your App's Main Switchboard

  19. Question 19 of 30

    When using a Storyboard Segue, how is data typically passed from the source view controller to the destination view controller?

    Show the answer

    Answer: a · By implementing the prepare(for:sender:) method in the source view controller to configure the destination.

    The card explicitly states, "To pass data, you implement the prepare(for:sender:) method in the source view controller." This method is called just before the transition, allowing the source to configure the destination view controller. Other options describe alternative data passing patterns or incorrect understandings of segue mechanics.

    Read the full bite: Storyboard Segues: Visual UI Flow in iOS

  20. Question 20 of 30

    When is SwiftUI's TabView the most appropriate UI component to use?

    Show the answer

    Answer: a · When allowing users to navigate between 2-5 distinct, equally important app sections.

    The card specifies that TabView is ideal for "primary, top-level navigation" with "between two and five main sections." It explicitly advises against using it for secondary navigation or when there are more than five main sections.

    Read the full bite: TabView: SwiftUI's Built-in Tab Bar

  21. Question 21 of 30

    For which type of data persistence is UserDefaults most appropriately used?

    Show the answer

    Answer: b · A boolean flag indicating if the app's tutorial has been completed

    UserDefaults is designed for small, non-critical user preferences like a boolean flag. Sensitive data like API tokens should not be stored in UserDefaults, even if encrypted, as it's not secure; large data like e-books or image collections would slow down the app and are not suitable for this lightweight store.

    Read the full bite: UserDefaults: Your App's Junk Drawer for Settings

  22. Question 22 of 30

    How does an app typically gain access to a user's sensitive data, such as photos or contacts, when operating within the App Sandbox?

    Show the answer

    Answer: b · It must declare an 'entitlement' and often receive explicit user permission through a system prompt.

    The card states that an app must declare an 'entitlement' and often receive user approval to access resources outside its container. Option A is incorrect because the sandbox prevents automatic access; explicit permission is always required for sensitive data.

    Read the full bite: App Sandbox: A Digital Playpen for Your App

  23. Question 23 of 30

    Which scenario best illustrates the appropriate use of FileManager?

    Show the answer

    Answer: a · Saving a photo taken by the user to the app's sandbox.

    FileManager is ideal for persisting user-generated content like files to the app's dedicated storage, such as saving a photo. Storing small preferences (option B) is better suited for UserDefaults, and managing complex structured data (option D) is better for databases. Performing large file I/O on the main thread (option C) should be avoided to prevent UI freezes.

    Read the full bite: FileManager: Your App's Interface to the File System

  24. Question 24 of 30

    When using Swift's Codable protocol, which scenario would typically require custom implementation beyond the default synthesis?

    Show the answer

    Answer: b · The JSON keys do not exactly match the Swift property names.

    Option B is correct because the card explicitly states that the default implementation will fail if JSON keys don't match Swift property names, requiring a custom CodingKeys enum. Option C is incorrect as Codable automatically handles nested Codable types.

    Read the full bite: Swift's Codable: Effortless JSON & Data Parsing

  25. Question 25 of 30

    What is the primary reason URLSession tasks should always be performed asynchronously in an iOS app?

    Show the answer

    Answer: d · To prevent the app's user interface from becoming unresponsive or freezing.

    The card explicitly states that "The biggest footgun is blocking the main UI thread, which freezes your app; always perform network tasks asynchronously." This directly addresses the need to keep the UI responsive. While asynchronous operations enable concurrency (Option C), the critical reason for their mandatory use in UI apps is to avoid blocking the main thread.

    Read the full bite: URLSession: The Core of iOS Networking

  26. Question 26 of 30

    What is the fundamental purpose of a URLRequest in iOS networking?

    Show the answer

    Answer: d · To define the specific details and configuration of a network call.

    URLRequest acts as a blueprint, defining the URL, HTTP method, headers, and body for a network call. It does not execute the request; that responsibility belongs to URLSession.

    Read the full bite: URLRequest: The Blueprint for a Network Call

  27. Question 27 of 30

    Which task is the primary function of JSONDecoder in a Swift application?

    Show the answer

    Answer: b · Transforming raw JSON Data received from an API into structured Swift types.

    The card explicitly states JSONDecoder bridges the gap between unstructured JSON and strongly-typed Swift data, automating the conversion of JSON Data into safe, usable Swift objects. Option D describes the function of JSONEncoder, which performs the opposite task.

    Read the full bite: JSONDecoder: Turning JSON into Swift Types

  28. Question 28 of 30

    Which task is the primary responsibility of JSONEncoder in a Swift application?

    Show the answer

    Answer: a · Converting Swift objects into a standardized JSON format for external use.

    JSONEncoder's fundamental purpose is to serialize Swift objects into JSON data, preparing them for tasks like sending to a server or saving to a file. It does not directly handle network transmission or the reverse process of parsing JSON.

    Read the full bite: JSONEncoder: Turning Swift Objects into JSON

  29. Question 29 of 30

    A table view cell sets both cornerRadius and a shadow on the same CALayer, and scrolling starts to stutter. What is the most likely cause?

    Show the answer

    Answer: d · masksToBounds combined with a shadow forces Core Animation to render the layer offscreen every frame

    Clipping needed for cornerRadius combined with a shadow cannot be composited directly, so Core Animation rasterizes the layer offscreen each frame, which is expensive; it is not a missing feature or a layout problem.

    Read the full bite: CALayer

  30. Question 30 of 30

    For which UI development task is UIBezierPath the most appropriate tool?

    Show the answer

    Answer: b · Defining the shape of a custom, non-rectangular UI element.

    UIBezierPath is specifically designed for drawing custom, non-rectangular shapes programmatically, making it ideal for unique UI elements. For images, UIImage is used; for games, SpriteKit or Metal are better; and for simple rounded corners, the UIView's cornerRadius property is more efficient.

    Read the full bite: UIBezierPath: Drawing Custom Shapes in Code

Could you explain these out loud?

That is what an interview actually tests. Tezvyn gives you questions like these with what the interviewer is really checking, the answer that lands, and the mistake that ends the conversation, in the four minutes before your next meeting.

The iPhone app is on the way

We are building it. Until it lands, nothing here is held back from you: every interview card, your saved cards, streaks and the job board all work in Safari, plus hundreds of free practice quizzes of thirty questions each. Sign in and it all carries over to the app the day it arrives.

Want it as an icon? Tap Share at the bottom of Safari, then Add to Home Screen. It opens full screen and the cards you have read stay available offline.

Get it on Google PlayiPhone app coming soon