Top Essential iOS Interview Questions and Answers Part- 2

Shantaram Kokate
4 min readJan 27, 2020

--

  1. Difference between project architecture and design pattern

2. What is retain count in objective c and How it works?

Retain Count represents the number of owners for a particular object. An increase in one ownership claim will cause retain count to increase by 1and decrease will cause it to decrement by 1.

3. What is the difference between Structs and classes?

4. What is the difference between perform(_:) and performAndWait(_:)

5. What is the difference between design patterns and design principles?

6. Why we need the design pattern?

A design pattern provides a general reusable solution for the common problems occurs in software.

7. Using .p8 key file to send a push notification?

  • Problem with .p12 file:
  1. It’s painful to generate the .p12 file for development and distribution environment, also if the notification provider wants .pem file then we need to combine the certificate.pem and key.pem file.
  2. push certificates typically expire in 1 year and you have to renew it in Apple developer center and reupload the new certificate to your push provider every year

Apple introduced a new authentication format for sending a push notification. The new format is a .p8 key file, it works for all your apps (ie. 1 key file can send push notification to all of your apps), works in both development and production environment (no need to switch between certificates), and best of all, it doesn’t expire!

  • Problem with .p8 file:
  1. You can only download it once, We can’t redownload it. If its loss then it affects the entire messaging system.

8. What is the Difference between Array VS NSArray VS [AnyObject]

9. What is SSL pinning in ios?

SSL stands for Secure Socket Layer, which is a protocol for creating an encrypted connection between client and server. It ensures that all data passed in a network will be private and integral. Using SSL, the client will allow the connection only from trusted sources that have a valid certificate.

  • Working process:

SSL pinning can be the solution to prevent a Man-In-The-Middle (MITM) attack. SSL pinning will ensure that the client connects with the designated server. The main key of SSL pinning that server certificate will be saved an in-app bundle. Then, when a client receives a certificate from the server, it then compares 2 certificates to make sure that they are the same before establishing the connection.

10. Git Workflow

I have listed down all the steps that I performed. From now, I will ll write everything in the present tense.

  • Actions:

1. Clone the repository
2. git fetch and git rebase
3. Create a new branch
4. Add commits
5. git fetch and git rebase (on the master branch)
6. Push the commits
7. Create a Pull Request
8. Discuss, review and merge a pull request

The following diagram shows the complete git workflow

11. What is the difference between protocol and inheritance?

11. What is the difference between Closure and Function?

12. What are the control transfer statements used in swift?

It used to change the normal execution of code based on a condition that you specify. In swift we have break, continue, fallthrough, return, throw control transfer statement.

13. Why is Software Architecture so important?

Here are the main reasons:

  • A basis for communication: software architecture is a sort of plan of the system and is for the understanding, the negotiation and the communication between all the components (user side, customer, management, etc.).
  • The earliest decisions: the first decisions taken are at this stage. Those early decisions have a huge importance on the rest of the project and become very difficult to change the more we advance in the process
  • Transferability of the model: software architecture defines the model of the software and how it will function. Having it makes it possible to reuse this model for other software; code can be reused as well as the requirements. All the experience we get while doing that architecture is also transferred. This means that we know and can reuse the consequences of the early decisions we took in the first place.
  • Easy to maintain when we find bugs
  • It should be flexible and extendible, usable in the long term
  • Make it possible to adapt to requirements
  • Scalability, scalability & scalability: high capacity
  • To avoid repetition in the code
  • Refactoring should be easy
  • Should respond positively to change, when adding features, performance should not decrease

In other words, the architecture will define the problems you might encounter when it comes to implementation. It also shows the organizational structure and makes it much easier to make decisions and manage all sorts of change. It also permits us to get a better estimate of the time & costs of a project.

--

--