Apple app developer news Android app developer news

Top 20 iOS interview questions

Top iOS developer interview questions are answered by an iOS teacher from Udemy.

iOS 22,201 VIEWS
11/17/2017 7:46:01 AM
Top 20 iOS interview questions
https://appdevelopermagazine.com/images/news_images/Udemy-iOS11-Teacher-Answers-Top-20-iOS-Interview-Questions-App-Developer-Magazine_zwo2vpz6.jpg
Posted Friday, November 17, 2017 by Richard Harris, Executive Editor


Top 20 iOS interview questions
Since iOS11’s public rollout, developers and prospective developers entering the job market will need to demonstrate a keen understanding of both new and foundational tools that Apple has included in their latest OS.

To help junior devs prepare for their next big interview, Mark Price, a mobile app developer and iOS instructor for Udemy, developed the below Q&A outlining the top 20 iOS interview questions for developers:

Q: Explain what Lazy stored properties are and when they are useful.


Price: Lazy stored properties are used for a property whose initial values are not set until the first time it is used . You can declare a lazy stored stored property by writing the lazy modifier before its declaration. Lazy properties are useful when the initial value of a property is reliant on outside factors whose values are unknown.

Q: List out what the different control statements used used in Swift.


Price: Continue, Break, Fallthrough and Return. However, while it’s important to know these control statements, what would really impress an interviewer is being able to have a dialogue around how each of you uses these controls, which you use most often, etc.

Q: What is optional chaining?


Price: Optional chaining is a process of querying and calling properties. Multiple queries can be chained together, and if any link in the chain is nil, then the entire chain fails.

Q: What collection types are available in Swift?


Price: Array, Dictionary, and Set - remember these are different from Swift data types!

Q: What are floating point numbers and what are the types of floating numbers in Swift?


Price: Floating numbers are numbers with a fractional component, like 3.25169 and -238.21. Floating point types can represent a wider range of values than integer types. There are two signed floating point numbers. Double represents a 64 bit floating number - it is used when floating point values must be very large. And Float represents a 32 bit floating number - it is used when a floating point value doesn’t exceed 64 bit precision.

Q: What is DispatchGroup?


Price: Allows for aggregate synchronization of work. We can use them to submit multiple different work items and track when they all complete, even though they might run on different queues. This behavior can be helpful when progress can’t be made until all of the specified tasks are complete.

Q: Where do we use dependency injection?


Price: We use a storyboard or xib in our iOS app, then we created IBOutlets. IBOutlet is a property related to a view. These are injected into the view controller when it is instantiated, which is essentially a form of Dependency Injection. There are forms of dependency injection: constructor, property and method.

Q: Explain the different types of notifications.

Price:

- Locally: app still running in background - does not need server.

- Push: upload your certification, “gives the app a digital handshake” and allows the server to send notifications through the app

Q: What is the difference between Any and AnyObject?


Price: ANY can represent an instance of any type at all, including function types and optional types. AnyObject can represent an instance of any class type.

Q: What is Continuous Integration?


Price: Continuous integration allows us to get early feedback when something is going wrong during application development. There are a lot of continuous integration tools available.

Q: What is encapsulation?


Price: Encapsulation is an object-oriented design principle and hides the internal states and functionality of objects. That means the objects keep their state information private.

Q: What is dependency management?


Price: If we want to integrate open source project, add a framework from a third party project, or even reuse code across our own products, dependency management helps us manage these relationships. Cocoa Pods and carthage are good examples of this.

Q: What is the difference between bounds and frame?

Price:

- Frame: frame of view is the rectangle, represented as a location (X,Y) and size (width/height) corresponding to the superview it is contained within.

- Bounds: the bounds of a view of a rectangle, represented as a location (X,Y) and size (width/height) corresponding to its own coordinate system (0.0)

Q: What is the ? in Swift?


Price: The question mark is used during the declaration of property, as it tells the compiler that this property is optional. The property may hold a value or not, in the latter case it's possible to avoid runtime errors when accessing that property by using ?. This is useful in option changing and a variant of of this example is in conditional clues.

Q: What is the use of double question marks (“??”) ?


Price: To provide default value for a variable.

Mark Price, iOS Instructor, Unity

Q: What is the difference between let and var in Swift?


Price: The let keyword is used to declare constants while var is used for declaring variables.

Q: What is a memory leak?


Price: A memory leak is a type of resource leak that occurs when a computer program incorrectly manages allocations in such a way that memory which is no longer needed is not released. In object-oriented programing, a memory leak may happen when an object is stored in memory but can’t be accessed by running code.

Q: What is auto-layout?


Price: Auto layout dynamically calculates the size and position of all the views in your view hierarchy based on constraints placed on those views.

Q: What does app thinning mean?


Price: The store and operating system optimize the installation of iOS, tvOS and watchOS apps by tailoring app delivery to the capabilities of the user’s particular device, with minimal footprint.This optimization called app thinning, lets you create apps that use the most device features, occupy minimum disk space, and accommodate future updates that can be applied by Apple.

Q: What is the difference between viewDidLoad and viewDidAppear? Which should you use to load data from a remote server to display in the view?


Price: viewDidLoad is called when the view is loaded, whether from a Xib file, storyboard or programmatically created in loafView. viewDidAppear is called every time the view is presented on the device. Which to use depends on the use case for your data. If the data is fairly static and not likely to change then it can be loaded in viewDidLoad and cached. However, if the data changes regularly then using viewDidAppear to load it is better. In both situations, the data should be loaded synchronously on a background threat to avoid blocking the UI.

Q: Bonus question: Why should we hire you?


Price: Focus on code in the interview. You want to present your skills, but ultimately the company is interested in how savvy you are with code and the amount of time you spend on researching and learning more about it.

Though questions and answers may be technical, it’s also important to remember to show your prospective employer that you’re a human. Add some color to technicality, throw in your favorite developer pun, and know your stuff - it’s a winning combination sure to land you the iOS gig of your dreams.

About Mark Price


Mark is a Udemy instructor, veteran developer, and mobile app developer, having built over 57 mobile apps for iOS and Android. He’s taught development to over 100,000 students worldwide.





Subscribe to App Developer Daily

Latest headlines delivered to you daily.