So, it’s time to publish another batch of interview questions and answers for job aspirants. A list of iOS developer interview questions given below is sure to assist both beginners and experienced developers.
WHAT IS POLYMORPHISM?
Answer: Polymorphism is the basic principle of OOP. The bottom line is that the same method of different heirs has its own implementation.
In short, polymorphism is the ability of an object to use methods of a derived class. Such methods don’t exist at the time of the creation of the base class. This probably sounds difficult to those not well-versed in the PLO. Therefore, consider the application of polymorphism with an example.
Bjarne Stroustrup popularized a definition of polymorphism as “one interface – many implementations”. This refers to ad hoc polymorphism, which is not a true polymorphism in actual.
Polymorphism is the ability to work with several types as if it were the same type. At the same time, the behaviour of each type will be unique, depending on its implementation.
Polymorphism can be:
A classic example of a polymorphic type is a list of elements of an arbitrary type.
WHAT IS ENCAPSULATION? WHAT VIOLATES ENCAPSULATION?
Answer: Encapsulation is a fundamental object-oriented concept that allows you to pack data and behaviour into a single component. Moreover, it divides it into separate parts – the interface and implementation.
Another version of the definition refers to encapsulation as:
A mechanism of language that allows you to restrict access to some program components to others.
A language construct that allows you to associate data with methods designed to process this data.
Simply put, we hide the implementation from the user, providing it with an interface. As a class or method is implemented in fact – the user need not to know.
HOW DOES THE ABSTRACT CLASS DIFFER FROM THE INTERFACE?
Answer: An abstract class is a class that lacks implementation of one or more methods. However, some languages require special keywords to mark such methods.
The interface is an abstract class that doesn’t implement all methods, all public and there are no class variables.
Usually, the need of the interface arises only during the description of the interface. For example, one class wants to give another the opportunity to access some of its methods without disclosing itself. Therefore, it implements the interface.
The need of an abstract class arises when you need a family of classes that have much in common. Of course, you can apply the interface, but then you will need to write a lot of identical code.
In some languages (C ++) there is no special keyword for interfaces. We can assume that an interface is an abstract class, but not vice versa.
TELL US ABOUT THE MVC PATTERN. WHAT IS THE DIFFERENCE BETWEEN A PASSIVE MODEL AND AN ACTIVE ONE?
Answer: Model-view-controller (MVC) uses several design patterns to divide application model, user interface, and user interaction into three separate components. With this, any modification of one of the components causes a minimal effect on the rest. On theory to implementation migration in a particular subject area, it uses the design pattern to construct an architectural framework.
The original concept describes the idea and role of each of the elements, model, representation, and controller. But, it contains no specification for the description of connections between them. In addition, it contains two main modifications:
Passive model – The model has no means of influencing the view or controller and only serves as a data source for display. The controller monitors all changes to the model, and it redraws the view if necessary. More often, structural programming uses such a model. Since in this case, the model is a data structure without methods of processing them.
Active model – The model notifies about changes in it those representations to the subscribers of such notifications. This allows the model to remain independent of controllers and views.
Do you think iOS developer interview questions were useful for you? Provide your comments and concerns in the below comment section.