Significant IOS Interview Questions

Q1: What are the different types of IOS Application States?

Ans: IOS application states are written below:

  • Not running state: In this state, the app was not opened or was running, but the system terminates.
  • Inactive state: When the app is running in the foreground but it doesn’t get any events. An app remains in this state for some time. Then, it shifts into another state. If the user locks the screen or The only time it stays inactive is when the user locks the screen or the system evokes the user to react to an event like a phone call or message.
  • Active state: In the foreground, when the app is ongoing and it is receiving events. For foreground apps, this serves as the usual mode.
  • Background state: In the background, when the app is running and executing code. Before the apps are going to get suspended, most apps go to this state shortly.
  • Suspended state: A suspended app is able to stay in memory but is unable to execute any code.

Q2: Name the JSON framework that is supported by iOS?

Ans: JSON is a basic file format that saves information in a manner that is easy to use and is organized properly. It’s an abbreviation for JavaScript Object Notation. With the help of it, you can get a logically accessible readable. iOs supports the SBJson framework only. It is a JSON parser that creates Objective-C.

For those who don’t know, Objective-C is the chief programming language that is useful for writing software for iOS and OS X. Also, it has all the features of the C programming language and gives object-oriented abilities along with a dynamic runtime. SBJson gives extra control for making the handling of JSON simple and flexible APIs.

Q3: Define unnamed category?

Ans: An unnamed category is no longer supported and the @protocol is extended in order to support the @optional methods. To help the user declare an additional private API that is a system programming interface (SPI) for the implementation of the class innards, a Class Extensions @interface Foo() is made.

In general, at the top of the .m file, it is displayed. In the@implementation, the methods or properties that are declared in the class extension should be implemented. This is similar to the methods or properties present in the public @interface. For the re-declaration of a publicly read-only, you can use the class extensions.

Q4: Differentiate between strong, weak, read-only, and copy?

Ans: To specify the property attributes, strong, weak, defines the way in which the memory for a certain property is going to be managed.

  • Strong: is the reference count that is increased and throughout the lifespan of the object, the reference is maintained.
  • Weak: you can also consider it a non-strong reference. Here, we are indicating an object. However, the reference count doesn’t increase. Commonly, it is used when we are making a parent-child association. In this relationship, the parent will have a strong reference to the child. In contrast to it, the child will have a weak reference to the parent.
  • Read-only: in the beginning, you can set the property that becomes unchangeable later on.
  • Copy: here, when the object is generated, you can copy the value. This value remains unchanged.

Q5: What do you mean by Dynamic Dispatch?

Ans: The method by which we choose the implementation of a polymorphic operation is called Dynamic Dispatch. This can be called a function or an operation that is used for calling at run time. This means we want to call for the methods just like the object method.

Nonetheless, Swift is not able to default to the dynamic dispatch. At the expense of a constant amount of runtime overhead for every indirect usage, Dynamic dispatch increases language expressivity. This kind of overhead is not preferable in performance-sensitive code. As compared to a direct call, this method is time-consuming.