• ¿Documento equivocado? Cámbialo gratis
  • Escrito por estudiantes que aprobaron
  • Inmediatamente disponible después del pago
  • Leer en línea o como PDF
Vender
¿Dónde estudias?
Tu idioma
Document preview thumbnail
Vista previa 3 fuera de 21 páginas
Examen

Cse 335 Exam 2 Questions With Answers And Explanations

Document preview thumbnail
Vista previa 3 fuera de 21 páginas

Cse 335 Exam 2 Questions With Answers And Explanations

Vista previa del contenido

CSE 335 EXAM 2 QUESTIONS WITH
ANSWERS AND EXPLANATIONS
1. A code review focuses on this situation: A screen duplicates API construction in several button
closures. Which
design decision best addresses it?
A. Perform database mutations directly in body
B. Start duplicate requests on every body evaluation
C. Keep networking and persistence off the View layer
D. Put all URL parsing into Text views
Correct Answer: C. Keep networking and persistence off the View layer
Explanation: Separating data/service work from rendering avoids side effects during view
recomputation and improves testability.
2. A code review focuses on this situation: A history view needs records from one category sorted
newest first.
Which design decision best addresses it?
A. Use a filtered/sorted query
B. Load every record and ignore the filter forever
C. Encode the sort order into the app icon
D. Store a separate database for each sort order
Correct Answer: A. Use a filtered/sorted query
Explanation: Queries should express selection and ordering close to the persistence layer when
appropriate.
3. Tests should replace production data access with a deterministic in-memory implementation.
Which choice is
most appropriate?
A. Duplicate persistence logic in each feature
B. Put all HTTP and database code directly in every View
C. Repository abstraction
D. Use only static global functions with hidden dependencies
Correct Answer: C. Repository abstraction
Explanation: A repository can centralize data access and hide whether data comes from local
storage, network services, or a
combination.
4. A new contact object must be tracked by the app's model container. Which choice is most
appropriate?
A. Insert through the model context and save as appropriate
B. Place the object in an image asset catalog
C. Assign the object only to a local constant
D. Write the object into a navigation title
Correct Answer: A. Insert through the model context and save as appropriate
Explanation: Persistent model objects must be inserted into the data context so the persistence
layer tracks them.
5. A code review focuses on this situation: A feature needs a cancellable asynchronous HTTP
request. Which
design decision best addresses it?
A. AVAudioSession
B. URLSession
C. CoreLocation
D. UserDefaults
Correct Answer: B. URLSession
Explanation: URLSession is the standard networking API for HTTP requests and data tasks.

,6. A code review focuses on this situation: A contact deletion must update the underlying store,
not only the
current array. Which design decision best addresses it?
A. Remove the navigation destination only
B. Hide the row only and leave the object stored
C. Delete the model object through the persistence context
D. Set every property to an empty value
Correct Answer: C. Delete the model object through the persistence context
Explanation: Removing a persistent object requires deleting it from the model context/store, not
merely hiding its view.
7. A detail screen shows cached content while a refresh may independently fail. Which choice is
most appropriate?
A. Represent loading, success, empty, and error states explicitly
B. Treat an empty result as identical to a transport error
C. Use one Boolean for every possible condition
D. Show stale data with no indication of failure
Correct Answer: A. Represent loading, success, empty, and error states explicitly
Explanation: Explicit resource states make asynchronous UI behavior predictable and testable.
8. An app is being revised because of this need: A list should display favorites in alphabetical
order from persistent
storage. Which change is the best fit?
A. Load every record and ignore the filter forever
B. Encode the sort order into the app icon
C. Store a separate database for each sort order
D. Use a filtered/sorted query
Correct Answer: D. Use a filtered/sorted query
Explanation: Queries should express selection and ordering close to the persistence layer when
appropriate.
9. During implementation, this requirement arises: Rapidly changing search text launches a new
request for each
query. What should the developer use?
A. Restart the entire application
B. Block the main thread until all requests finish
C. Let every stale request finish and overwrite newer results
D. Cancel obsolete tasks
Correct Answer: D. Cancel obsolete tasks
Explanation: Cancellation prevents outdated asynchronous work from wasting resources or
racing newer requests.
10. During implementation, this requirement arises: A screen should show only incomplete tasks
ordered by due
date. What should the developer use?
A. Load every record and ignore the filter forever
B. Use a filtered/sorted query
C. Encode the sort order into the app icon
D. Store a separate database for each sort order
Correct Answer: B. Use a filtered/sorted query
Explanation: Queries should express selection and ordering close to the persistence layer when
appropriate.

, 11. A code review focuses on this situation: A remote configuration response should be reused
until its TTL
expires. Which design decision best addresses it?
A. Cache reusable responses with a clear invalidation policy
B. Cache forever with no expiry or versioning
C. Always redownload immutable resources on every redraw
D. Store all response bytes in a UI label
Correct Answer: A. Cache reusable responses with a clear invalidation policy
Explanation: Caching can reduce latency and network use, but cached data needs defined
freshness/invalidation behavior.
12. During implementation, this requirement arises: A user creates a note that must still exist
after relaunch. What
should the developer use?
A. Write the object into a navigation title
B. Insert through the model context and save as appropriate
C. Assign the object only to a local constant
D. Place the object in an image asset catalog
Correct Answer: B. Insert through the model context and save as appropriate
Explanation: Persistent model objects must be inserted into the data context so the persistence
layer tracks them.
13. A coordinator needs to push destinations based on typed route values. Which choice is most
appropriate?
A. Recreate the root view for every detail selection
B. Hard-code destination state in a global variable
C. Use a ZStack as a navigation history
D. A navigation path or value-based destination
Correct Answer: D. A navigation path or value-based destination
Explanation: Value-driven navigation can represent and restore multi-step navigation state
explicitly.
14. An app is being revised because of this need: A newly created task should become part of the
persistent store.
Which change is the best fit?
A. Write the object into a navigation title
B. Assign the object only to a local constant
C. Place the object in an image asset catalog
D. Insert through the model context and save as appropriate
Correct Answer: D. Insert through the model context and save as appropriate
Explanation: Persistent model objects must be inserted into the data context so the persistence
layer tracks them.
15. A background network request finishes and the visible loading state must change. Which
choice is most
appropriate?
A. Mutate UI state from an arbitrary background context
B. Disable concurrency entirely
C. Update UI-observed state on the main actor
D. Store every UI value in UserDefaults
Correct Answer: C. Update UI-observed state on the main actor
Explanation: UI-facing state should be mutated on the main actor to preserve thread-safety
expectations of the UI framework.

Información del documento

Subido en
10 de octubre de 2026
Número de páginas
21
Escrito en
2026/2027
Tipo
Examen
Contiene
Preguntas y respuestas
$15.99

¿Documento equivocado? Cámbialo gratis Dentro de los 14 días posteriores a la compra y antes de descargarlo, puedes elegir otro documento. Puedes gastar el importe de nuevo.
Escrito por estudiantes que aprobaron
Inmediatamente disponible después del pago
Leer en línea o como PDF

Seller avatar
Los indicadores de reputación están sujetos a la cantidad de artículos vendidos por una tarifa y las reseñas que ha recibido por esos documentos. Hay tres niveles: Bronce, Plata y Oro. Cuanto mayor reputación, más podrás confiar en la calidad del trabajo del vendedor.
Favorgrades
3.8
(199)
Vendido
854
Seguidores
377
Artículos
57829
Última venta
1 semana hace



Por qué los estudiantes eligen Stuvia

Creado por compañeros estudiantes, verificado por reseñas

Calidad en la que puedes confiar: escrito por estudiantes que aprobaron y evaluado por otros que han usado estos resúmenes.

¿No estás satisfecho? Elige otro documento

¡No te preocupes! Puedes elegir directamente otro documento que se ajuste mejor a lo que buscas.

Paga como quieras, empieza a estudiar al instante

Sin suscripción, sin compromisos. Paga como estés acostumbrado con tarjeta de crédito y descarga tu documento PDF inmediatamente.

Student with book image

“Comprado, descargado y aprobado. Así de fácil puede ser.”

Alisha Student

Preguntas frecuentes