iOS Interview Questions — Part1

Some of the areas to refresh before an iOS Technical Interview.

  • Simplest way to remove duplicates from Array ?
  • Database — difference between relational and non relational db
  • Why use Core Data over SQLite3
  • How to migrate users in Core Data
  • Classes vs Structs
  • Escaping vs Non Escaping Closures
  • Complexity — N(0) square of performing enumeration over for loop (From Qn. 1)
  • Inheritance vs Categories
  • Singleton? What happens when multiple objects access same Singleton?
  • Fast enumeration?
  • Function overloading / method overloading
  • Table view vs collection view — when to use which
  • KVO and KVC


  1. Removing duplicates ?
  • Duplicate Int in Array , Dictionary or Set in SWIFT. Reading up on Sets and Arrays I find that a Set cannot, or is not able to store duplicate values ( Ints, Strings, etc ).
  • let unique = Array(Set(originals))


2 . DifferenceCoreData & SQLite

  • Coredata is a framework to manage database, CoreData is not a database. Core Data can use SQLite as its persistent store
  • SQLite — is a relational database


3 . How to migrate users in CoreData ?

Migrations happen in three steps:

  • First, Core Data copies over all the objects from one data store to the next.
  • Next, Core Data connects and relates all the objects according to the relationship mapping.
  • Finally, enforce any data validations in the destination model. Core Data disables destination model validations during the data copy.

Ref :

4 . Class vs Structs ?

  • Structs — Structs are value types
  • Classes — Classes are reference type


5 . Escaping vs Non Escaping Closures ?

  • @nonescaping When passing a closure as the function argument, the closure gets execute with the function’s body and returns the compiler back. As the execution ends, the passed closure goes out of scope and have no more existence in memory.
  • @escaping — When passing a closure as the function argument, the closure is being preserve to be execute later and function’s body gets executed, returns the compiler back. As the execution ends, the scope of the passed closure exist and have existence in memory, till the closure gets executed.


6 . MVVM vs VIPER ?

MVVM has only a view component in UI layer, VIPER separates UI responsibilities into 3 components, which are View, Presenter and Router. It’s also obvious that business layer looks pretty much the same.


7 . Complexity of for loop?

  • O(nc): Time complexity of nested loops is equal to the number of times the innermost statement is executed. For example the following sample loops have O(n2) time complexity


iOS Enthusiast 📱 • LinkedIn: • GitHub: • StackOverflow: