Browse all practice questions for the SwiftUI Coffee App – Data Models, Views, and Layouts Practice Test. Search by topic, open any question and review its full explanation, then test yourself in the practice quiz.

SwiftUI Coffee App – Data Models, Views, and Layouts Practice Test course image
All questions

These questions are part of the practice quiz. Start practicing

  • A quick way to write an array using square brackets is known as which of the following?
  • What UI should be presented when there is no data to show?
  • In addition to dark mode, which appearance should be tested to ensure proper rendering?
  • Which SwiftUI view is used to display textual content?
  • Which SwiftUI mechanism is commonly used to manage UI data changes?
  • When should you use the build shortcut in relation to Preview?
  • What is the purpose of a tile view in the coffee app architecture?
  • Which layout arranges views vertically for a page?
  • Which statement best summarizes the intended workflow for handling Preview failures?
  • In Xcode debugging, what marker pauses execution on a chosen line to inspect values such as quantity or totalPrice?
  • Which term refers to a shape with rounded corners used as a card background?
  • Which SwiftUI view is used to present plain text content, such as a label or caption?
  • The Xcode container for an app and its settings, source files, assets, targets, and build configuration.
  • The computed property where a SwiftUI View describes its visible content.
  • What is the name of the modifier that changes how a Picker is presented, such as as a menu or a segmented control?
  • Which Xcode component helps identify compile-time errors quickly?
  • Which component provides a tappable region that navigates to a detail view?
  • Which modifier proposes a width, height, or alignment for a view to keep image cards consistently sized?
  • A property that calculates its value whenever read instead of storing a fixed value. Use it for totalPrice so it updates with selected options.
  • Which binding controls the visibility of a SwiftUI sheet?
  • In SwiftUI, the call Image("latte") must match what specifically?
  • An image that adds appearance but no information. Mark it hidden from accessibility when appropriate so VoiceOver users are not given noise. Term?
  • Which SwiftUI element represents a modal screen presented over the current screen with an example using .sheet?
  • Which example demonstrates currency formatting in SwiftUI?
  • Which SwiftUI view loads and displays an image from the asset catalog?
  • Which of the following describes a property that stores a value and does not calculate itself?
  • What is SwiftUI?
  • The mismatch example Image("coldBrew") vs asset named "coldbrew" illustrates what rule?
  • What is the purpose of opening the Issue Navigator after a build?
  • Which of the following describes an edge case testing scenario?
  • To place two views side by side, which SwiftUI container is appropriate?
  • Which type represents a true-or-false value?
  • In an enum with a raw type, what can provide a display string for each case?
  • Which SwiftUI control is designed to select one value from a set of choices?
  • The single authoritative place a piece of data is stored.
  • Which description best defines a unit test?
  • Which concept describes a two-way connection to mutable state that reads and writes back changes?
  • Which property wrapper stores UI state?
  • What term describes organizing code so UI, data, and calculations have distinct homes, making the app easier to read, test, and change?
  • Which protocol enables a value to be used as a stable identity and be hashed in SwiftUI?
  • What term describes a custom view designed to be used repeatedly with different data, such as CoffeeTileView being reusable because it receives a Coffee property?
  • What Swift feature safely unwraps an optional by conditionally binding its value?
  • Which type of property automatically updates when its dependent values change?
  • What term describes a type that holds multiple values and allows SwiftUI's ForEach to create a view for each item?
  • What is the recommended workflow name described for handling Preview failures?
  • Which term describes a concrete value created from a type, such as a latte being an instance of Coffee?
  • What is Swift used for in Apple development?
  • Which SwiftUI feature formats a numeric price as localized currency?
  • Which Xcode tool runs a virtual iPhone or other Apple device?
  • To allow an image to resize and fit different frames, which modifier is commonly applied?
  • Which construct helps constrain a numeric input within a lower and upper bound, such as 1 to 5?
  • What Swift term describes a closed range like 1...5 that bounds a value?
  • Which term describes a value that may be present or absent?
  • Which code element constructs a new instance with properties like name and basePrice?
  • Which modifier clips a view to a shape, ensuring corners match the card?
  • Which code snippet demonstrates loading an SF Symbol by name?
  • What is an IDE?
  • Moving price rules from a UI view into a data model or related enum demonstrates which practice?
  • Which Swift keyword creates a constant?
  • The starting definition of a SwiftUI app. Xcode creates a type such as CoffeeApp that conforms to App and presents the first scene/window.
  • Which Swift construct is a reference type, useful when identity or shared mutable state matters?
  • Which term describes a layout instruction for how views line up in SwiftUI?
  • What is a single value inside an enum called?
  • What term describes a reusable collection of Apple code and APIs that provides views, layout containers, and modifiers?
  • What process compiles source code and resources into an app?
  • Text that communicates meaning, not just appearance. "Review order" is clearer than "Continue" when the button opens the review sheet. The term is what?
  • Which term denotes the comfortable tappable target area for a control?
  • Accessibility guidance: communicate status with text, symbols, or shapes in addition to color. For example, show "Selected" as well as a color change. This guidance is to not rely on color alone. Which principle is described?
  • Which term describes a named value that may change over time?
  • Which action should you take if Preview fails and you want to diagnose errors?
  • What term represents the percentage applied to calculate tax in code?
  • What is the history of screens the user has pushed into navigation called?
  • What value represents the absence of a value in an optional?
  • What is the term for a block of code passed to another piece of code, such as the closure in a loop?
  • Which of the following best describes a property?
  • Which term refers to a semantic font group such as Title, Headline, or Body?
  • What is the name of Apple's built-in icon library used for scalable symbols in SwiftUI?
  • What do you call the visible content of a control, such as its title or label?
  • A SwiftUI property wrapper for small pieces of mutable state owned by a view. Example: @State private var quantity = 1.
  • Which term refers to the set of types, methods, and rules a framework exposes for you to use?
  • Which operator is used to compare values, such as equal to (==) or not equal (!=)?
  • In SwiftUI, which semantic grouping is used to organize related controls for scanning?
  • In development, what is a placeholder?
  • Which Swift construct defines a type with a fixed list of related choices such as Size, Milk, Flavor, and Shots?
  • Which SwiftUI control provides plus and minus buttons to adjust a numeric value?
  • Which example shows an explicit type annotation in Swift?
  • Which Swift concept controls where code can be used, with common levels like private, internal (default), and public?
  • Which library provides scalable icons such as plus for SwiftUI?
  • Code used to create a new instance of a type, such as Coffee(name: ..., basePrice: ...), is an example of which concept?
  • In SwiftUI, what describes how the framework updates the UI when underlying data changes?
  • Which sequence describes the core steps when a Preview failure occurs?
  • Which Image modifier shows the whole image while preserving aspect ratio, unused space may remain?
  • Which UI control allows the user to pick one value from multiple options?
  • What common data-cleaning step is illustrated by removing leading and trailing spaces from user input?
  • Which modifier adds a subtle shadow to separate cards from the background?
  • When a screen includes an informative image, what should you provide?
  • Which term describes the visible content of a control that communicates what action will occur?
  • Which design principle states one type or view should have one clear job, with examples like keeping Coffee for data and a tile view for displaying one coffee?
  • Which Image modifier may crop content by filling the available frame while preserving aspect ratio?
  • Which SwiftUI layout container layers views front-to-back, often used to place text over an image?
  • Which SwiftUI container allows content to scroll when larger than available space?
  • Which protocol allows a value to be identified and hashed, commonly required for UI selections?
  • Which description best defines a UI test?
  • In SwiftUI data modeling, which type is commonly used for lightweight models with no identity requirement?
  • The current state or value VoiceOver should announce is called what?
  • Which statement best describes a Swift source file's role in an Xcode project?
  • Which of the following best describes how a button's label should be chosen?
  • Which term describes a value that cannot be changed after it is assigned?
  • A mismatch between an image name and asset capitalization would cause which issue?
  • What is Apple's screen reader called?
  • Changing a mutable value. In SwiftUI, change @State in an action—for example, showingSheet = true—so the UI can update.
  • A semantic role announced by assistive technology such as button, header, selected, or adjustable corresponds to which accessibility concept?
  • Which action should you take first when you encounter an error after a build?
  • What is the act of promising that a type follows a protocol called?
  • Which term refers to the programmatic name used primarily in automated UI tests?
  • Which UI control provides an editable single-line text input in SwiftUI?
  • Which Image modifier lets the image change size, typically paired with a frame?
  • Which statement makes another framework available in a Swift file?
  • Which Swift method trims whitespace and newline characters from the start and end of a string?
  • What term describes the feature that lets the body return one concrete type conforming to View while Swift hides the exact type?
  • A concise spoken name for an element, especially an icon-only button. Example: accessibilityLabel.
  • How should money values be displayed in user interfaces?
  • What problem occurs while the app is running, such as accessing invalid data?
  • Which term describes a UI style where you declare the interface for current data rather than manually updating each element?
  • What SwiftUI shape has rounded corners and can be used as a card background or clip shape?
  • Which term describes the screen shown after a navigation action?
  • An opaque return type that means the body returns one concrete type that conforms to View, while Swift hides its exact complicated type.
  • Why might additional errors appear after addressing the first error?
  • What does refactoring primarily involve?
  • Which control flow statement runs a block of code only when a condition is true?
  • Which property is provided by a type conforming to CaseIterable to access all its cases?
  • Which screen shows the review sheet that summarizes the completed drink, special request, subtotal, tax, total, and place-order action?
  • The screen shown by a navigation action (tapping a row) is called what?
  • Which binding name is commonly used to control the visibility of a SwiftUI sheet?
  • Which feature allows an enum to have a string label associated with each case, such as 'Small'?
  • Which protocol makes all enum cases available for iteration, enabling you to build a picker from all cases?
  • What is the recommended practice when an image on the screen conveys information needed to understand or use the screen?
  • Which Swift construct is described as a value type used to model data that should be copied rather than referenced?
  • Which action is recommended first when you see a red error in the IDE during development?
  • In UI testing, what helps tests locate elements reliably?
  • What is a type annotation?
  • Which term refers to a SwiftUI type that describes the visible content such as HomeView or CustomizationView?
  • What term refers to a problem that prevents code from building?
  • Which of the following is the SwiftUI shape name for a rectangle with rounded corners?
  • The user's chosen system text size is called what?
  • Which term describes a type that represents app data and rules, such as a Coffee.swift module that holds drink data, customizations, and pricing logic?
  • Which file typically contains the initial user interface of a SwiftUI app?
  • What term refers to a named group of image files stored in an asset catalog?
  • Which modifier draws a view behind the modified content, suitable for a card fill or background color?
  • In SwiftUI, which keyword declares a mutable variable often managed by a property wrapper?
  • Which control is used for a Boolean on/off choice?
  • What is the name of the selected build-and-run configuration in Xcode, for example choosing the CoffeeApp scheme and an iPhone simulator?
  • Which layout behavior should be tested on both small and large devices?
  • What is the effect of mutating a @State property inside an action?
  • To stack elements vertically on a home screen, which container should you use?
  • What SwiftUI presentation modifier shows a modal screen over the current view?
  • The difference in brightness/color between text and its background is called what?
  • What describes a list of requirements that a type agrees to meet?
  • Which layout arranges views horizontally for rows?
  • What should you do after fixing the first error?
  • Which modifier clips a view to a shape, such as rounding image corners to match a card?
  • A UI style where you state the desired interface for current data instead of manually changing each screen element step by step. SwiftUI is declarative.
  • A stable identifier SwiftUI uses to distinguish repeated data and views is called what?
  • Which term describes an ordered collection that provides direct access to elements by index?
  • What is the term for a non-blocking Xcode message about code that may be risky, unused, or incomplete?
  • What is type inference?
  • Which left-side Xcode panel is used to browse project files, folders/groups, targets, and resources?
  • What is a primary benefit of keeping the data/pricing model independent from presentation views?
  • What control opens a destination view when tapped?
  • In the CoffeeTileView, which coffee property is used to display the image via Image(coffee.assetName)?
  • What issue occurs when text is longer than the space allocated by its container?
  • In an empty state, what is a recommended user experience?
  • Which term describes a type that defines a set of related, fixed values?
  • The starter SwiftUI view Xcode creates, often kept in its own file.
  • What prefix gets a binding from a property wrapper?
  • Which modifier adds subtle elevation to a view to give it depth against the background?
  • Which type is used to represent text such as a coffee name or a description?
  • A SwiftUI type that describes visible interface content. HomeView, CoffeeTileView, and CustomizationView are examples.
  • The stable programmatic name used mainly by UI tests, not the spoken accessibility label, is called what?
  • Which accessibility property provides a spoken description of an icon or control for screen readers?
  • Which term is used for an image that VoiceOver should ignore because it conveys no information?
  • SwiftUI view that repeats content for every item in a collection is called what?
  • Extra spoken guidance that explains the result of an action.
  • What is the default Swift access level if none is specified?
  • Logic that derives subtotal, tax, and total from the current Coffee choices. Keep it in the Coffee model or related enums rather than scattered through views.
  • Data that affects what a view displays. When state changes, SwiftUI recalculates the affected view body.
  • Which syntax declares an optional string type that is mutable?
  • What testing focus helps ensure the layout works with large text settings?
  • A property wrapper for a value a child view can edit but does not own. Use it when a parent owns the state and passes editable access down.
  • Why should you not use let for a Picker selection that must change?
  • Which design concept describes making an app accessible for people with disabilities including VoiceOver, readable text, contrast, and usable controls?
  • Which file usually contains the home screen's code in a simple SwiftUI app?
  • What could be the consequence of ignoring the first error after a build?
  • Which practice supports localization and regional formatting across languages and regions?
  • Which SwiftUI container manages a stack of screens and enables navigation?
  • Which Swift construct is a function that belongs to a type?
  • Which feature allows rapid layout inspection and testing in a SwiftUI workflow?
  • Which item in SwiftUI represents a unit that can apply a sequence of modifiers to a view?
  • Which symbol reverses a Boolean condition?
  • What is Xcode?
  • Which SwiftUI modifier adds empty space around a view to improve tap targets and visual breathing room?
  • After building with Command-B, where should you open the first error to fix it?
  • Which phrase describes the string identifier used to load a resource from Assets.xcassets, where capitalization matters?
  • In SwiftUI, when a child view is allowed to modify data but the owner remains the source, this is done via which mechanism?
  • What property defines the vertical or horizontal space between adjacent views in a stack?
  • What does model-view separation aim to achieve?
  • Which Swift type is a value type used to group related data or behavior?
  • In the syntax { item in ... }, what is 'item' called?
  • Which Xcode area lists warnings and errors to help you locate the file and line that needs attention?
  • Which term describes a named value stored on or calculated by a type?
  • Which control triggers an action when the user taps it?
  • Which SwiftUI concept is described as data that affects what a view displays and triggers a recalculation when it changes?
  • Which view groups greeting text, a featured drink, category chips, and the popular drinks row?
  • To layer text over an image in SwiftUI, which layout container is typically used?
  • Which type is used for quantities and counts?
  • In the described process, what is the primary purpose of building with Command-B before running?
  • Which container is described as useful when the customization screen is mostly Pickers, Toggles, and TextFields?
  • Which Swift construct executes code only when a condition is true?
  • Which type is used for decimal numbers like money amounts?
  • When the real data source is not yet connected, what is the role of mock data?
  • What is the name of the reusable visual card that represents a single drink and can display an image, name, and description?
  • What is the technique called when multiple modifiers are applied in sequence, where order matters?
  • What term describes the path information between app parts, from the menu array to tile, then navigation destination, customization, and confirmation?
  • If Preview fails, which tool is used to review compile errors?
  • Why should hard-coded strings be avoided in the UI code?
  • Which Swift keyword declares a mutable value?
  • An ordered collection of values of one type is called what?
  • Which tool pauses a running app and allows inspection of variables, call stacks, and execution, especially when behavior differs from expectations?
  • What best describes mock data in development?
  • Which term refers to the feature that reads interface element properties for accessibility?
  • The Xcode resource library storing images, colors, and app icons is called what?
  • In a simple SwiftUI app, which file usually contains the home screen's code?
  • What is the term for the string identifier that loads a resource from Assets.xcassets, with exact spelling and capitalization?
  • What is the term for a method that configures a SwiftUI view's appearance, layout, behavior, or accessibility?
  • Which term defines a reusable named block of code that performs work?
  • Which SwiftUI concept uses a stable identity to help track changes in lists?
  • The protocol SwiftUI screen components conform to. A custom view usually starts as struct HomeView: View { var body: some View { ... } }.
  • What is the keyboard shortcut to build the project in Xcode?
  • A property that keeps a value in memory. Example: let basePrice: Double is stored; it does not calculate itself.
  • Swift vs SwiftUI
  • What describes the product Xcode builds from a project?
  • Which screen allows a customer to change a coffee's options using controls such as Picker, Toggle, Stepper, and TextField?
  • To validate visual accessibility in a coffee app, what should you test?
  • Which control is typically bound to a boolean state to switch features on or off?
  • What is the name of the reusable view that displays a single coffee item?
  • A protocol for data with a stable id property; ForEach can omit the id parameter when a type conforms to it. Which protocol is this?
  • Which accessibility feature provides additional spoken information about a control's result after an action?
  • Which statement best describes the relationship between Swift and UIKit vs SwiftUI?
  • What is the name of the control that builds and launches the selected target in the chosen simulator or connected device?
  • The comfortably tappable area for an interactive control is called what?
  • Which keyword restricts use of a property or method to its enclosing type?
  • What term describes a temporary interface that takes focus until dismissed?
  • A semantic font choice such as .title, .headline, or .body that adapts to Dynamic Type and maintains a consistent visual hierarchy is called what?
  • If a data type conforms to Identifiable, ForEach can usually omit which parameter?
  • What is a benefit of using semantic text in code rather than hard-coded literals?
  • In the CoffeeTileView, which coffee property is used to display the drink's description via Text(coffee.description)?
  • What is Xcode's live design preview feature for SwiftUI views called?
  • In a SwiftUI app, where is the home-screen code commonly kept?
  • What is the horizontally scrolling variant called?
  • An initializer error occurs when?
  • Which SwiftUI container groups controls for settings-like screens and is commonly used to organize content?
  • What term describes the named input a function, initializer, or closure receives?
  • Which concept states that color alone should not be used to convey important information?
  • Which control is used to increment or decrement numeric values such as quantity or number of shots in a coffee customization?
  • What is the name of the text output area in Xcode used to print values and read error messages during development?
  • What is a common benefit of using an opaque return type in SwiftUI?
  • In the CoffeeTileView, which coffee property is used to display the drink's name via Text(coffee.name)?
  • What is the term for the single authoritative place a piece of data is stored in a SwiftUI app?
  • Which of the following is an example of modeling a Coffee object using a struct?
  • What is the primary purpose of testing edge cases in a coffee-ordering app?
Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy