Here are some MCQ with answers on Swift Core Data:
- What is the primary framework used for data modeling in Core Data?
a) Core Data
b) Core Foundation
c) Core Graphics
d) Core Text
Answer: a) Core Data
- What is the purpose of the NSManagedObject class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: b) It is used to manage the lifecycle of a data model object.
- What is the role of the NSManagedObjectContext class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: c) It is used to perform database operations such as insert, update, and delete.
- What is the purpose of the NSPredicate class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: c) It is used to perform database operations such as insert, update, and delete.
- What is the role of the NSFetchRequest class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: c) It is used to perform database operations such as insert, update, and delete.
- What is the purpose of the NSManagedObjectModel class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: b) It is used to manage the lifecycle of a data model object.
- What is the role of the NSMetadataQuery class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: c) It is used to perform database operations such as insert, update, and delete.
- What is the purpose of the NSBatchUpdateRequest class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: c) It is used to perform database operations such as insert, update, and delete.
- What is the role of the NSPersistentStoreCoordinator class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: c) It is used to perform database operations such as insert, update, and delete.
- What is the purpose of the NSPersistentStore class in Core Data?
a) It is used to represent a single record in a database.
b) It is used to manage the lifecycle of a data model object.
c) It is used to perform database operations such as insert, update, and delete.
d) It is used to convert between data model objects and JSON data.
Answer: c) It is used to perform database operations such as insert, update, and delete.
I hope these questions and answers help you learn about Swift Core Data.