CSE 335 PRACTICE EXAM QUESTIONS WITH
ANSWERS AND EXPLANATIONS
1. A project team must choose among four implementation approaches. Scenario: A navigation
row needs flexible
empty space between its label and accessory icon. Which choice is best?
A. Group
B. Spacer
C. AnyView
D. Divider
Correct Answer: B. Spacer
Explanation: Spacer expands to consume available layout space and can push neighboring views
apart.
2. A project team must choose among four implementation approaches. Scenario: A history
screen needs bounded
batches rather than loading the entire server archive. Which choice is best?
A. Pagination / incremental loading
B. Download an unbounded dataset in one response
C. Create a new app target per page
D. Store page numbers in Keychain only
Correct Answer: A. Pagination / incremental loading
Explanation: Pagination limits transfer and rendering cost for large remote collections.
3. A mobile feature is being debugged or redesigned. The key situation is: A search results screen
should run
view-scoped async loading without blocking rendering. Which option is most appropriate?
A. Use .task for view-scoped asynchronous work
B. Run the operation synchronously inside body
C. Start an unstructured global task with no lifecycle relationship
D. Block the main thread until the request completes
Correct Answer: A. Use .task for view-scoped asynchronous work
Explanation: The task modifier is suitable for asynchronous work tied to a view lifecycle and
supports cancellation when the view
disappears.
4. Choose the strongest answer for this application scenario: A dashboard needs clear UI state
during initial fetch
and retry.
A. Treat an empty result as identical to a transport error
B. Represent loading, success, empty, and error states explicitly
C. Show stale data with no indication of failure
D. Use one Boolean for every possible condition
Correct Answer: B. Represent loading, success, empty, and error states explicitly
Explanation: Explicit resource states make asynchronous UI behavior predictable and testable.
5. A mobile feature is being debugged or redesigned. The key situation is: An account setup page
collects several
pieces of structured user input. Which option is most appropriate?
A. TimelineView
B. Form
C. Canvas
D. LazyHGrid
Correct Answer: B. Form
Explanation: Form groups standard data-entry controls in a platform-appropriate
settings/data-entry presentation.
,6. A mobile feature is being debugged or redesigned. The key situation is: A checkout flow
submits a new order
request. Which option is most appropriate?
A. POST
B. GET
C. HEAD
D. OPTIONS
Correct Answer: A. POST
Explanation: POST is commonly used to submit data that creates or triggers processing of a new
resource/action.
7. Choose the strongest answer for this application scenario: A profile editor lets the user choose
one value from a
defined enumeration.
A. Picker
B. Text
C. ProgressView
D. Divider
Correct Answer: A. Picker
Explanation: Picker represents selection among a known set of alternatives.
8. Choose the strongest answer for this application scenario: A web-service model should map
JSON keys into
Swift properties.
A. NotificationCenter
B. GeometryReader
C. Codable
D. NSLock
Correct Answer: C. Codable
Explanation: Codable supports structured encoding/decoding between Swift models and formats
such as JSON when representations
match.
9. Choose the strongest answer for this application scenario: Multiple components must mutate
one shared
instance rather than independent copies.
A. A struct only
B. A tuple
C. An enum with no associated data
D. A class
Correct Answer: D. A class
Explanation: Classes provide reference semantics and object identity, which are useful when
multiple clients intentionally share one
mutable instance.
10. A mobile feature is being debugged or redesigned. The key situation is: A coordinator needs
to push
destinations based on typed route values. Which option is most appropriate?
A. Hard-code destination state in a global variable
B. A navigation path or value-based destination
C. Use a ZStack as a navigation history
D. Recreate the root view for every detail selection
Correct Answer: B. A navigation path or value-based destination
Explanation: Value-driven navigation can represent and restore multi-step navigation state
explicitly.
, 11. In a timed practice problem, the application has this requirement: A destructive reset action
requires a concise
confirmation prompt. What should be implemented?
A. .sheet
B. ScrollView
C. .alert
D. NavigationLink
Correct Answer: C. .alert
Explanation: Alerts are suited to short, interruptive messages or confirmations requiring
immediate acknowledgment or choice.
12. Choose the strongest answer for this application scenario: A service temporarily returns 503
and the UI must
show a recoverable error.
A. Assume any received bytes mean success
B. Force-unwrap the decoded model
C. Check the HTTP status code and handle failure paths
D. Ignore transport errors and decoding errors
Correct Answer: C. Check the HTTP status code and handle failure paths
Explanation: Robust networking distinguishes transport, HTTP, and decoding failures rather than
assuming all responses are
successful.
13. In a timed practice problem, the application has this requirement: A custom picker must
update the parent
view's selected category. What should be implemented?
A. @Binding
B. @State
C. @Environment
D. @StateObject
Correct Answer: A. @Binding
Explanation: @Binding lets a child read and write state whose source of truth is owned
elsewhere.
14. A project team must choose among four implementation approaches. Scenario: A feature
needs a cancellable
asynchronous HTTP request. Which choice is best?
A. UserDefaults
B. URLSession
C. CoreLocation
D. AVAudioSession
Correct Answer: B. URLSession
Explanation: URLSession is the standard networking API for HTTP requests and data tasks.
15. In a timed practice problem, the application has this requirement: A detail screen should
arrange an image,
description, and action button vertically. What should be implemented?
A. Grid only
B. VStack
C. ZStack
D. HStack
Correct Answer: B. VStack
Explanation: VStack arranges child views vertically in order.
ANSWERS AND EXPLANATIONS
1. A project team must choose among four implementation approaches. Scenario: A navigation
row needs flexible
empty space between its label and accessory icon. Which choice is best?
A. Group
B. Spacer
C. AnyView
D. Divider
Correct Answer: B. Spacer
Explanation: Spacer expands to consume available layout space and can push neighboring views
apart.
2. A project team must choose among four implementation approaches. Scenario: A history
screen needs bounded
batches rather than loading the entire server archive. Which choice is best?
A. Pagination / incremental loading
B. Download an unbounded dataset in one response
C. Create a new app target per page
D. Store page numbers in Keychain only
Correct Answer: A. Pagination / incremental loading
Explanation: Pagination limits transfer and rendering cost for large remote collections.
3. A mobile feature is being debugged or redesigned. The key situation is: A search results screen
should run
view-scoped async loading without blocking rendering. Which option is most appropriate?
A. Use .task for view-scoped asynchronous work
B. Run the operation synchronously inside body
C. Start an unstructured global task with no lifecycle relationship
D. Block the main thread until the request completes
Correct Answer: A. Use .task for view-scoped asynchronous work
Explanation: The task modifier is suitable for asynchronous work tied to a view lifecycle and
supports cancellation when the view
disappears.
4. Choose the strongest answer for this application scenario: A dashboard needs clear UI state
during initial fetch
and retry.
A. Treat an empty result as identical to a transport error
B. Represent loading, success, empty, and error states explicitly
C. Show stale data with no indication of failure
D. Use one Boolean for every possible condition
Correct Answer: B. Represent loading, success, empty, and error states explicitly
Explanation: Explicit resource states make asynchronous UI behavior predictable and testable.
5. A mobile feature is being debugged or redesigned. The key situation is: An account setup page
collects several
pieces of structured user input. Which option is most appropriate?
A. TimelineView
B. Form
C. Canvas
D. LazyHGrid
Correct Answer: B. Form
Explanation: Form groups standard data-entry controls in a platform-appropriate
settings/data-entry presentation.
,6. A mobile feature is being debugged or redesigned. The key situation is: A checkout flow
submits a new order
request. Which option is most appropriate?
A. POST
B. GET
C. HEAD
D. OPTIONS
Correct Answer: A. POST
Explanation: POST is commonly used to submit data that creates or triggers processing of a new
resource/action.
7. Choose the strongest answer for this application scenario: A profile editor lets the user choose
one value from a
defined enumeration.
A. Picker
B. Text
C. ProgressView
D. Divider
Correct Answer: A. Picker
Explanation: Picker represents selection among a known set of alternatives.
8. Choose the strongest answer for this application scenario: A web-service model should map
JSON keys into
Swift properties.
A. NotificationCenter
B. GeometryReader
C. Codable
D. NSLock
Correct Answer: C. Codable
Explanation: Codable supports structured encoding/decoding between Swift models and formats
such as JSON when representations
match.
9. Choose the strongest answer for this application scenario: Multiple components must mutate
one shared
instance rather than independent copies.
A. A struct only
B. A tuple
C. An enum with no associated data
D. A class
Correct Answer: D. A class
Explanation: Classes provide reference semantics and object identity, which are useful when
multiple clients intentionally share one
mutable instance.
10. A mobile feature is being debugged or redesigned. The key situation is: A coordinator needs
to push
destinations based on typed route values. Which option is most appropriate?
A. Hard-code destination state in a global variable
B. A navigation path or value-based destination
C. Use a ZStack as a navigation history
D. Recreate the root view for every detail selection
Correct Answer: B. A navigation path or value-based destination
Explanation: Value-driven navigation can represent and restore multi-step navigation state
explicitly.
, 11. In a timed practice problem, the application has this requirement: A destructive reset action
requires a concise
confirmation prompt. What should be implemented?
A. .sheet
B. ScrollView
C. .alert
D. NavigationLink
Correct Answer: C. .alert
Explanation: Alerts are suited to short, interruptive messages or confirmations requiring
immediate acknowledgment or choice.
12. Choose the strongest answer for this application scenario: A service temporarily returns 503
and the UI must
show a recoverable error.
A. Assume any received bytes mean success
B. Force-unwrap the decoded model
C. Check the HTTP status code and handle failure paths
D. Ignore transport errors and decoding errors
Correct Answer: C. Check the HTTP status code and handle failure paths
Explanation: Robust networking distinguishes transport, HTTP, and decoding failures rather than
assuming all responses are
successful.
13. In a timed practice problem, the application has this requirement: A custom picker must
update the parent
view's selected category. What should be implemented?
A. @Binding
B. @State
C. @Environment
D. @StateObject
Correct Answer: A. @Binding
Explanation: @Binding lets a child read and write state whose source of truth is owned
elsewhere.
14. A project team must choose among four implementation approaches. Scenario: A feature
needs a cancellable
asynchronous HTTP request. Which choice is best?
A. UserDefaults
B. URLSession
C. CoreLocation
D. AVAudioSession
Correct Answer: B. URLSession
Explanation: URLSession is the standard networking API for HTTP requests and data tasks.
15. In a timed practice problem, the application has this requirement: A detail screen should
arrange an image,
description, and action button vertically. What should be implemented?
A. Grid only
B. VStack
C. ZStack
D. HStack
Correct Answer: B. VStack
Explanation: VStack arranges child views vertically in order.