Skip to content

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

Question 1

What is the purpose of the URLSession data task in fetching images using Swift?

❌ To represent image files using the UIImage class.
❌ To store image data in memory.
❌ To convert JSON data into Swift objects.
To download and retrieve image data from a server.

Explanation:
URLSessionDataTask ka kaam server se data download karna hota hai — jaise images, JSON, ya text.


Question 2

What is the purpose of JSON in iOS development?

To exchange data between servers and devices in a structured format.
❌ To create user interfaces for mobile apps.
❌ To perform server-side scripting for web applications.
❌ To optimize the performance of mobile apps.

Explanation:
JSON lightweight aur readable format hai jo client–server data exchange ke liye use hota hai.


Question 3

Which of the following best describes the main use case of JSON format?

❌ Storing and retrieving data from an object-oriented database.
Structuring and transmitting data between a server and an application.
❌ Creating graphical user interfaces for mobile applications.

Explanation:
JSON ka main use data transmission hai, na ki UI ya database storage.


Question 4

Which class in Swift is used to manage network data transfer tasks?

❌ URLTask
❌ NetworkSession
URLSession

Explanation:
URLSession networking ke liye central class hai jo data, download, upload tasks manage karti hai.


Question 5

Which of the following statements best describes the functionality of URLSessionTask in Swift?

❌ It is a data structure used for storing URL request information.
❌ It is a class used for parsing JSON data received from a server.
It provides methods for transferring data between a client and a server using a URL session.

Explanation:
URLSessionTask ek abstract task hai jo actual data transfer handle karta hai.


Question 6

Which of the following URLSession methods creates a URLSessionDataTask?

❌ createDataTask
dataTask
❌ newDataTask

Explanation:
URLSession.dataTask(with:) method se hi URLSessionDataTask create hota hai.


Question 7

Which of the following statements about retaining URLSessionTask instances is true?

❌ You must always retain a reference to a URLSessionTask instance.
❌ Retaining a reference can cause memory leaks and should be avoided.
URLSession retains all URLSessionTask instances until they finish by default, so you do not have to retain them yourself.

Explanation:
Task resume() hone ke baad URLSession khud hi task ko retain karta hai jab tak wo complete na ho.


Question 8

What will the output of the following code be?

❌ Task completed
❌ Code will not run due to an error.
Nothing will output to the console.

Explanation:
example.com request ke response ka result background thread me aata hai aur playground / execution context me output guaranteed nahi hota.


Question 9

Can the following JSON String be decoded into the given Swift object as is?

❌ Yes, the full_name key will be automatically available in the Swift object.
No
❌ Yes, but the data will be missing.
❌ Yes

Explanation:
JSON key full_name aur Swift property name match nahi karte. CodingKeys ki zarurat hogi.


Question 10

What is the purpose of the JSONDecoder in Swift?

❌ To send HTTP requests to a server.
❌ To encode Swift objects into JSON format.
To decode JSON data into Swift objects.

Explanation:
JSONDecoder ka use JSON → Swift model conversion ke liye hota hai.


🧾 Summary Table

Question Correct Answer
Q1 Download image data from server
Q2 Structured data exchange
Q3 Server–app data transmission
Q4 URLSession
Q5 Transfers data via URL session
Q6 dataTask
Q7 URLSession retains tasks
Q8 Nothing prints
Q9 No
Q10 Decode JSON to Swift objects