Question:- Why is the design pattern very important?
Answer:- Design patterns are important in software design because design patterns are reusable solutions to many common problems. They’re models for writing code that’s simple to comprehend and reuse. The most popular design trends in Cocoa are as follows: • Creational: Singleton. • Structural: Decorator, Adapter, Facade. • Behavioral: Observer, and, Memento
Question:- What is Concurrency?
Answer:- Concurrency is a fancy term for “running several tasks at the same time.” On iOS devices, concurrency is commonly used to allow you to run tasks such as downloading or processing data in the background while keeping your user interface sensitive.
Question:- Mention various ways to achieve concurrency in iOS?
Answer:- Mainly, there are 3 ways to achieve concurrency in iOS. There are: • Grand Central Dispatch • OperationQueue • Threads
Question:- What is meant by deadlock?
Answer:- A deadlock is a situation that occurs when at least two threads are locked on a different resource, and both are waiting for the other resource to finish its job. And no one is able to unlock the resource it is guarding.
Question:- Explain the lazy property in Swift?
Answer:- A lazy stored property is one that does not determine its initial value until it is used for the first time. The lazy modifier is written before the declaration of a lazy stored property.
Question:- What is the abbreviation of ARC?
Answer:- ARC stands for Automatic Reference Counting.
Question:- What is the difference between strong, weak, read-only, and copy?
Answer:- • Strong: Through the life of the object, the reference count will be increased and the reference will be maintained • Weak: It can be said as a non-strong reference that means it refers to the fact that we are referring to an object but not adding to its reference count. It’s often used to establish a parent-child relationship. The parent has a strong connection with the infant, but the child has only a small connection with the parent. • Read-only: Initially, The property will be set and it cant be changed. • Copy: It means that when an object is created, were copying its value. Also prevents its value from changing.
Question:- Explain QOS?
Answer:- QoS stands for the quality of service. It is a class that organizes the work that NSOperation, NSOperationQueue, NSThread artifacts, dispatch queues, and threads do (POSIX threads). By assigning a QoS, you’re telling the system how important it is, and the system prioritizes and schedules it accordingly.
Question:- What is the use of deinit in swift?
Answer:- Deinitialization in Swift is the method of deallocating or cleaning up unused class instance objects in order to free up memory space used by machine resources for better memory management. Until a class instance is deallocated, the deinitialization process is usually named.
Question:- What is the difference between atomic- and non-atomic properties? Which is the default for synthesized properties? When would you use one over the other?
Answer:- Properties specified as atomic are guaranteed to always return a fully initialized object. This also happens to be the default state for synthesized properties. While it is a good practice to specify atomic properties to remove the potential for confusion, if we leave it off, the properties will still be atomic. This guarantee of atomic properties comes at the cost of performance. However, if we have a property for which we know that retrieving an uninitialized value is not a risk (e.g., if all access to the property is already synchronized via other means), then set it to non-atomic can boost the performance.
Question:- Does Objective-C contain private methods?
Answer:- No, there is nothing called a private method in Object-C programming. If a method is defined in .m only, then it becomes protected; if it is defined in .h, it is public. If we really want a private method, then we need to add a local category/unnamed category/class extension in the class and add the method in the category and define it in class.m.
Question:- What is a plist?
Answer:- Property list or plist refers to a list that organizes data into named values and lists of values using several object types. These types provide us the means to produce data that is meaningfully structured, transportable, storable, and accessible, but still as efficient as possible. Property lists are frequently used by applications running on both Mac OS X and iOS. The property-list programming interfaces for Cocoa and Core Foundation allow us to convert hierarchically structured combinations of these basic types of objects to and from standard XML. We can save the XML data to the disk and later use it to reconstruct the original objects. The user defaults system, which we programmatically access through the NSUserDefaults class, uses property lists to store objects representing user preferences. This limitation would seem to exclude many kinds of objects, such as NSColor and NSFont objects, from the user defaults system. However, if objects conform to the NSCoding protocol, they can be archived to NSData objects, which are property-list-compatible objects.
Question:- Explain MVC?
Answer:- MVC is the acronym for “Model-View-Controller.” MVC is a design pattern for web applications that consists of three interconnected components. Model – A model is where the data is stored. View – The classes in view are reusable as they don’t have any domain-specific logic. Controller – with delegation patterns, the controller act as a communication between the model and view. The MVC model, also known as the “pattern,” is widely used in the development of modern user interfaces.
Question:- What is the purpose of reuseIdentifier? What is the benefit of setting it into a non-nil value?
Answer:- The reuseIdentifier is used to group together the similar rows in a UITableView, i.e., the rows that differ only in their content, otherwise having similar layouts. A UITableView will normally allocate just enough UITableViewCell objects to display the content visible in the table. If reuseIdentifier is set to a non-nil value, then the UITableView will first attempt to reuse an already allocated UITableViewCell with the same reuseIdentifier when the table view is scrolled. If reuseIdentifier has not been set, then the UITableView will be forced to allocate new UITableViewCell objects for each new item that scrolls into view, potentially leading to laggy animations.
