Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

which architecture supports two - way data binding? ○ a. mvc ● b. mvvm …

Question

which architecture supports two - way data binding?
○ a. mvc
● b. mvvm
○ c. viper
○ d. singleton
clear my choice

which class handles api calls in swift?
● a. urlsession
○ b. jsondecoder
○ c. alamofire
○ d. both a and c
clear my choice

which data storage is simplest for small data?
○ a. core data
● b. userdefaults
○ c. realm
○ d. sqlite
clear my choice

Explanation:

Brief Explanations
  • For the first question: MVVM (Model - View - ViewModel) architecture supports two - way data binding. In MVVM, the ViewModel acts as an intermediary between the View and the Model. When the View changes (e.g., user input in a text field), the ViewModel can update the Model, and when the Model changes (e.g., data retrieved from a server), the ViewModel can update the View. MVC (Model - View - Controller) has a more one - way data flow (Controller updates View based on Model changes, but View to Model updates are less straightforward in a pure MVC implementation). VIPER (View - Interactor - Presenter - Entity - Router) is more about separation of concerns for complex applications and doesn't inherently focus on two - way data binding. Singleton is a design pattern for creating a single instance of a class, not an architecture for data binding.
  • For the second question: In Swift, URLSession is a native class for handling API calls. It can be used to create data tasks, upload tasks, and download tasks to interact with web services. Alamofire is a popular third - party library (which is built on top of URLSession in many cases) that also simplifies making API calls. JSONDecoder is used for decoding JSON data that is received from an API (e.g., after an API call has retrieved the data). So both URLSession (native) and Alamofire (library) can handle API calls.
  • For the third question: UserDefaults is a simple key - value store in iOS (and macOS etc.). It is very easy to use for storing small amounts of data like user preferences (e.g., a boolean indicating if a user has seen a tutorial, a string for a username). Core Data is a more complex framework for object graph management and data persistence, suitable for larger and more complex data models. Realm is a mobile database with its own set of features for data storage and synchronization, which is more than what is needed for simple small data. SQLite is a relational database, and while it can be used for small data, it requires more setup (e.g., writing SQL queries) compared to the simplicity of UserDefaults.

Answer:

  1. B. MVVM
  2. D. Both A and C
  3. B. UserDefaults