Interview Process — Part 2— iOS Questions

Vikash Anand
Oct 9, 2018 · 6 min read

Hello and welcome to part 2 of this series. Please checkout the part 1 if you haven’t already.

So for this article I have select 10 random (easy) questions from my list and following are their answers.

1. Introduce yourself

There is not much to explain here. You just have to speak about your professional experience, educational and family background.

So following are the points that you should cover in an introduction

· Educational background– Fresher should include this in your introduction, as you don’t have much experience to talk about but someone with good years of experience can avoid this as they can directly talk about the work they have done.

· Family background– This according to me is an optional thing that you can omit from your introduction unless and until there is something very interesting that you think interviewer should know.

· Professional experience– Experience professional should include following points

· Years of experience.

· Current / last company.

· Current / last project.

I have included few of the important things that according to me should be included in an introduction. This is just a guideline and not a list of rules that you have to follow. If you already have a well prepared and well rehearsed introduction that you want to stick to then no issues in using that.

2. Most challenging task done.

This one is tricky and you should always have an answer prepared for this question because if will try to thing about this in the interview then most of the time you will come up with answers that are either too simple to tell or too complex to explain. So it’s better to have a well-prepared answer for this question.

3. Name few iOS frameworks that you have worked on

This one is again something that you should prepare before hand. I have been in a situation where this question was asked to me and all I can recall was UIKit 🤦🏽‍♂️. I am not saying that this will happen with everyone but nothing wrong in preparing in advance.

4. New things introduced in the latest version of swift

With every new version of swift new changes is introduced which you are expected to know. You can read or watch videos to keep you updated. You can also refer whatsnewinswift website for the same. Here you can track all the changes introduced in swift according to the swift version in which they were introduced.

5. What are closures and are they reference type or value type?

I am sure that many of you have used closure but if someone asks you to define or explain it then it becomes a bit difficult task. It’s one thing to know something and it’s other to explain it correctly using the correct words, right?

Anyways as per the swift documentation

“Closures are self-contained blocks of functionality that can be passed around and used in your code. Closures in Swift are similar to blocks in C and Objective-C and to lambdas in other programming languages.”

So you can use the above definition to explain closures in an interview.

And for the second part of the question, Closures are reference types.

Please read following topics also (Detail in the swift documentation hyperlink mentioned above).

· Types of closures i.e. escaping and non-escaping

· Trailing closure

· Autocomplete closure

6. How URLSession is better than NSURLConnection / why URLSession was required when we already had NSURLConnection?

So for this I have done the following comparison b/w the two classes


· You must set configuration options on each connection independently

· It handles single request and any follow on request

· Each connection has a separate delegate

· It cannot perform background downloads when application is not running (i.e. app is suspended/app exits/app crashes).

· Connection can be started or cancelled but can’t be paused and resumed.


· We provide reusable configuration object that encapsulates many common configuration options.

· It handles multiple tasks, each of which represents a single URL requested and any follow on request.

· Delegate is shared across all the tasks within a session.

· It performs background downloads when app is not running (i.e. app is suspended/app exits/app crashes).

For more details, please read this articleby Raywenderlich.

7. Why we need optionals (swift)?

Optionals are something, which is used to handle the absence of a value i.e. optional type can have a value or they can be nil.

In objective-c also a variable can have a value or it can have a nil value so why swift optionals are required?

For optionals types compiler provide a compile time check. Suppose you are using an optional variable and you are trying to access it’s value, then compiler will complain that you need to unwrap the optional type first before you can access its value. Due to this many run time nil crash scenario is avoided as we always check for the value first before accessing it. Also with optionals we can use optional chaining and optional binding which is not possible in objective-c. So that’s why optionals are mark improvement in terms of language features as compared to objective-c.

8. How to design different layout for iPad portrait and iPad landscape?

The problem here is that iPad has Regular-Regular size class for both the orientations i.e. landscape and portrait. So, how to identify the orientation if someone wants to have different layout for the UI elements. Solution for this is as follows:

· Design two different UI layouts. One for compact-regular and one for regular-regular size.

· Then override the following function and return different size class type for different orientation.

9. What is a defer block?

Defer waits to executes a block of code until current scope i.e. loop or method exists. Defer executes the block whether scope is exiting

· Cleanly.

· From a guard statement.

· An error is thrown.

Also, if there are multiple defer statements in a scope then their execution order is the reverse of the order in which they are defined.

Use case for Defer — To make sure that certain resources are cleaned up before exiting the current scope. For details please read Defer.

10.What is Generics?

Again this is something that we all must have used but when it comes to define what generics is then it becomes a difficult task for us.

As per the swift documentation, “Generic code enables you to write flexible, reusable functions and types that can work with any type, subject to requirements that you define.”

Here is a sample code for searching a specific data type from an array of that type. In the first function we are searching a string from an array of string. This works as long as we have to search a string but if we have to search an integer or float from an array of integer or float then we have to create different methods for integer and float search, which leads to code duplication. Hence, to remove this code duplication we can use generics. Second function uses generics where the search functionality works for all the types as long as it conforms to ‘Equatable’ protocol.

Let me know what you think about these questions / answers and if you feel that some of the answers are not up to the mark or need correction then please let me know in the comments below.

Also, there are still a lot more questions left with me and I plan to share them in the next part but still if someone doesn’t want to wait and wants to have a look at the complete set of questions then please mention your email id in the comment section below and will share the list with you.

Last but not the least, i would like to thank couple of people here. First Omkar khedekar — For reviewing all the answers.Second Rajvi Gandhi — For making this article readable.

That’s it. Thanks for reading.😀😀😀

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade