iOS interview questions for beginners and experienced developers- Part 2

Codecat15
The Startup
Published in
4 min readDec 21, 2020

--

Photo by Andrea Piacquadio from Pexels

This is part 2 of the interview question, if you have not seen part 1 of the interview questions, I request you to please check that out as well.

When we give interviews, we are either asked theory questions and sometimes there’s practical or called a machine test, in this post I will cover some of those questions

I have divided the questions into three parts for the different skill set of developers, but I would recommend going through all of them for better chances of cracking the theory and machine test

Note: Some questions are marked with Task which means they are machine tests that the company usually asks to do

Wishing you all the best for your next interview round

Level: Easy

  1. Explain the difference between formal and informal protocol?
  2. Task: The interviewer might give you an API and will ask it to parse the data without using any third-party library.
    Suggestion you should use decodable, encodable, and URLSession for this.
  3. Task: Sort an array without using any in-built features.
    Suggestion: Try going for the simplest form of sorting which is bubble sort, but it's always a good idea to learn about merge sort, quick sort, insertion sort.
  4. What’s the difference between Sync and Async tasks in iOS?
  5. When to use the @objc keyword in Swift programming?
  6. What are delegates? and how are they different from data source?
  7. What is lazy loading? The interviewer may give a task to load the images from the server in the table view as well
    I made a video on my Youtube channel for this, it’s in Hindi but has English subtitles do check this out if the concept is new to you.
    Link: https://youtu.be/Bytv3PJjNi4
  8. Explain the difference between abstraction and encapsulation and where do we use them in the code?
    I wrote an article on medium about the 4 pillars of OOPS do check that out to know the difference.
    Link: https://link.medium.com/pD87YffVjcb
  9. Explain the difference between stack vs heap?
  10. What is the dynamic keyword used for?
  11. What is the use of “resueIdentifier” in a UITableView?

Level: Medium

  1. Explain the responder chain?
  2. Explain the difference between delegate and KVO?
  3. Task: I want to upload 10 images to the server, but the API just accepts one image at a time, all the images are high resolution, write an optimized solution for this without using any third party in your code.
  4. Task: Without using any conditional statements, write a function named appendStrings to append two strings if they have value, if they don’t have value then just return the string “none”, appendStrings function should have only one single line of code.
    Example:
    appendStrings() // → “none”
    appendStrings(str1: “Hello”) // → “Hello”
    appendStrings(str1: “Hello”, str2: “world”) // → “Helloworld”
  5. Task: Write a function to find a word and its index from a string, if the word is not present then return “nil” else return the integer index position, you are not allowed to contains function for this.
    Example:
    find(from:“these tasks are horrible” word:“horrible”) // → “16”
  6. What are trailing closures?
  7. Explain the difference between map and flat map?
  8. Task: Create an abstract class in Swift
    Suggestion: There’s no concept of abstract class in swift, but this does not mean you cannot mimic its functionality, you should use the protocol without any property just declare a function to it and you can then implement that protocol in a class.

Level: Pro

  1. Explain composition over inheritance?
  2. What is a Factory pattern and why would you use it?
  3. Task: I want to capture the signature of the user, without using any third party, create a solution for the same which is easy to integrate into a UIKit and SwiftUI project.
  4. Explain cyclomatic complexity?
  5. Why @property and @synthesize do not exist for a property in Swift?
  6. Explain ThreadSanitizer and Static Analysis?
    Suggestion: Here’s a wwdc video from 2016 for the same
  7. Explain with technical reasons when will you use the Facade design pattern?
  8. You are given a codebase where there’s a lot of tight coupling, and spaghetti (structure-less)code with no documentation and test cases implemented, how will you approach such a project?|
    Suggestion: Ask the interviewer if they want to re-write the entire app or just want to change portions of the app to implement a new feature? Usually, with such a monstrous codebase, the best approach is to make changes as you go unless the company tells you to re-do everything in the app.
    Your approach should be based on a deep analysis of the existing project as what it does and then create an architecture diagram that shows how different components in the project will communicate with each other, remove any tight coupling in the project by following decomposition and separation of concern. The new approach should be flexible and open to change without impacting the existing functionality.
  9. Explain dependency injection and its type with technical use cases as where and when it's a good idea to use dependency injection?
  10. Explain the coordinator pattern? when should you use it in your project?
  11. What is ABI stability?

I hope all these questions help you out in cracking your next interview round, and if you know any friend who’s preparing for their next interview do help them out by sharing this link and help them succeed.

Have a nice day :)

--

--