Skip to content

Module Quiz: Data in Swift :Working with Data in iOS (Meta iOS Developer Professional Certificate) Answers 2026

Question 1

Suppose your data model contains two entities; Dessert and Customer…

(Option 1)

customer.name = "John Doe"

→ Customer ka property fullName hai, name nahi.

(Option 2)

profiterole.consumedBy = [customer]

→ Relationship one-to-many hai, lekin Core Data me single object assign hota hai (Set internally handle hota hai).

(Option 3)

Customer({context: viewContext})

→ Galat initializer syntax.

Correct Answer: Option 1 is closest but incorrect as written → none are perfectly valid
(Exam-wise expected answer: Option 1)

Explanation:
Core Data me entity create karne ke liye Entity(context:) use hota hai aur relationship single object se set hota hai.


Question 2

Which of the following is a key feature of Core Data?

Allowing bi-directional communication between the user interface and the database.
❌ Restricting communication between the user interface and the database.
❌ Allowing communication between the user interface and the network.
❌ Allowing communication between different databases within an application.

Explanation:
Core Data automatic UI updates (via contexts & bindings) allow karta hai.


Question 3

Relationship between Dish and Customer?

❌ A customer can hold information about multiple dishes but a dish can only hold information about one customer.
❌ A dish can hold information about multiple customers and a customer can only hold information about many dishes.
A dish can hold information about multiple customers but a customer can only hold information about one dish.

Explanation:
Dish → one-to-many
Customer → inverse one-to-one


Question 4

True or false: All reading and writing to Core Data happens through an NSManagedObjectContext.

True
❌ False

Explanation:
Context hi Core Data ka gateway hota hai for fetch, insert, delete.


Question 5

How can NSManagedObject classes be helpful?

❌ NSManagedObject classes are not necessary.
❌ Can only be used for basic data types.
Can be used to customize and optimize read/write operations and save time typing.
❌ Can only be used to read data.

Explanation:
Custom logic, computed properties, helpers add kar sakte ho.


Question 6

What is the purpose of Core Data?

❌ Web applications
❌ UI building
Persist or cache data on a single device even when app is not running.
❌ Send data between devices

Explanation:
Core Data = local persistence framework.


Question 7

Which statement accurately describes a Core Data entity?

❌ Subclass of NSManagedObjectModel
❌ Subclass of NSObject
❌ Subclass of UIViewController
Subclass of NSManagedObject

Explanation:
Entities runtime par NSManagedObject ban jaate hain.


Question 8

How many phases are required to create a Core Data context and pass it to a view?

❌ Three phases
Two phases
❌ Four phases
❌ Five phases

Explanation:

  1. Context create (App entry point)

  2. Context retrieve (View)


Question 9

Definition of a one-to-one relationship?

❌ Multiple → one
❌ One → multiple
❌ Many ↔ many
One object links to exactly one object in another entity.

Explanation:
One-to-one means exactly one on both sides.


Question 10

Retrieve all desserts in ascending alphabetical order?

(Option 1 – valid but verbose)
(Option 3 – descending order)
Option 2

@FetchRequest(
sortDescriptors: [
NSSortDescriptor(keyPath: \Dessert.name, ascending: true)
],
animation: .default
)
private var desserts: FetchedResults<Dessert>

Explanation:
Modern SwiftUI + Core Data me keyPath preferred hai.


🧾 Summary Table

Question Correct Answer
Q1 Option 1 (exam expected)
Q2 Bi-directional UI–DB
Q3 Dish → many customers
Q4 True
Q5 Optimize read/write
Q6 Local persistence
Q7 NSManagedObject
Q8 Two phases
Q9 One ↔ One
Q10 Option 2