50 iOS Interview Questions And Answers Part 4

Hello, Part 4 is ready !

Check out Part 1, Part 2 and Part 3 if you haven’t already :). Let’s get started.

Update: May 29 2018.

1- What is Functional programming ?

There are three main concepts. These concepts are: separating functions and data, immutability, and first-class functions.

2- What are the limits of accessibility ?

We can not use Dynamic Text with accessibility features.

3- What is ARC and how is it different from AutoRelease?

Autorelease is still used ARC. ARC is used inside the scope, autorelease is used outside the scope of the function.

4- Explain differences between Foundation and CoreFoundation

The Foundation is a gathering of classes for running with numbers, strings, and collections. It also describes protocols, functions, data types, and constants. CoreFoundation is a C-based alternative to Foundation. Foundation essentially is a CoreFoundation. We have a free bridge with NS counterpart.

5- What’s accessibilityHint?

accessibilityHint describes the results of interacting with a user interface element. A hint should be supplied only if the result of an interaction is not obvious from the element’s label.

6- Explain place holder constraint

This tells Interface Builder to go ahead and remove the constraints when we build and run this code. It allows the layout engine to figure out a base layout, and then we can modify that base layout at run time.

7- Are you using CharlesProxy ? Why/why not ?

If I need a proxy server that includes both complete requests and responses and the HTTP headers then I am using CharlesProxy. With CharlesProxy, we can support binary protocols, rewriting and traffic throttling.

8- Explain unwind segue

An unwind segue moves backward through one or more segues to return the user to a scene managed by an existing view controller.

9- What is the relation between iVar and @property?

iVar is an instance variable. It cannot be accessed unless we create accessors, which are generated by @property. iVar and its counterpart @property can be of different names.

iVar is always can be accessed using KVC.

10- Explain UNNotification Content

UNNotification Content stores the notification content in a scheduled or delivered notification. It is read-only.

11- What’s the difference between Android and iOS designs?

  • Android uses icons, iOS mostly uses text as their action button. When we finish an action, on Android you will see a checkmark icon, whereas on iOS you’ll have a ‘Done’ or ‘Submit’ text at the top.
  • iOS uses subtle gradients, Android uses flat colors and use different tone/shades to create dimension. iOS uses bright, vivid colors — almost neon like. Android is colorful, but not as vivid.
  • iOS design is mostly flat, but Android’s design is more dimensional. Android adds depth to their design with floating buttons, cards and so on.
  • iOS menu is at the bottom, Android at the top. Also a side menu/hamburger menu is typically Android. iOS usually has a tab called ‘More’ with a hamburger icon, and that’s usually the menu & settings rolled into one.
  • Android ellipsis icon (…) to show more options is vertical, iOS is horizontal.
  • Android uses Roboto and iOS uses San Francisco font
  • Frosted glass effect used to be exclusive to iOS, but you’ll see a lot of them in Android too nowadays. As far as I know it’s still a hard effect to replicate in Android.
  • Android usually has navigation button in color, whereas iOS is usually either white or gray.

12- What is Webhooks ?

Webhooks allow external services to be notified when certain events happen within your repository. (push, pull-request, fork)

13- Explain difference dependency injection and inject dependencies

Using dependency injection for a view model or view controller is easy enough, but to inject dependencies into every view on-screen would be significant work and a lot more lines of code to manage.

14- Explain CAEmitterLayer and CAEmitterCell

UIKit provides two classes for creating particle effects: CAEmitterLayer and CAEmitterCell. The CAEmitterLayer is the layer that emits, animates and renders the particle system. The CAEmitterCell represents the source of particles and defines the direction and properties of the emitted particles.

15- Why do we need to specify self to refer to a stored property or a method When writing asynchronous code?

Since the code is dispatched to a background thread we need to capture a reference to the correct object.

16- Explain NSManagedObjectContext

Its primary responsibility is to manage a collection of managed objects.

17- Explain service extension

The service extension lets us the chance to change content in the notification before it is presented.

18- Explain content extension

The content extension gives us the tools, we have in an app to design the notification.

19- What is intrinsic content size?

Every view that contains content can calculate its intrinsic content size. The intrinsic content size is calculated by a method on every UIView instance. This method returns a CGSize instance.

20- What is Instruments?

Instrument is a powerful performance tuning tool to analyze that performance, memory footprint, smooth animation, energy usage, leaks and file/network activity.

21- What is Deep Linking?

Deep linking is a way to pass data to your application from any platform like, website or any other application. By tapping once on link, you can pass necessary data to your application.

22- What is Optional Binding ?

We are going to take optional value and we are going to bind it non optional constant. We used If let structure or Guard statement.

23- Explain super keyword in child class

We use the super keyword to call the parent class initializer after setting the child class stored property.

24- Explain Polymorphism

Polymorphism is the ability of a class instance to be substituted by a class instance of one of its subclasses.

25- Explain In-app Purchase products and subscriptions

  • Consumable products: can be purchased more than once and used items would have to re-purchase.
  • Non-consumable products: user would be able to restore this functionality in the future, should they need to reinstall the app for any reason. We can also add subscriptions to our app.
  • Non-Renewing Subscription: Used for a certain amount of time and certain content.
  • Auto-Renewing Subscription: Used for recurring monthly subscriptions.

26- What is HealthKit ?

HealthKit is a framework on iOS. It stores health and fitness data in a central location. It takes in data from multiple sources, which could be different devices. It allows users to control access to their data and maintains privacy of user data. Data is synced between your phone and your watch.

27- What is Protocol?

A protocol defines a blueprint of methods, properties and other requirements that suit a particular task or piece of functionality. The protocol can then be adopted by a class, structure, or enumeration to provide an actual implementation of those requirements.

The Swift Programming Language Guide by Apple

28- Explain Neural networks with Core ML

Neural networks and deep learning currently provide the best solutions to many problems in image recognition, speech recognition, and natural language processing.

Core ML is an iOS framework comes with iOS 11, helps to process models in your apps for face detection. For more information follow this guideline https://developer.apple.com/machine-learning/

29- Explain libssl_iOS and libcrypto_iOS

These files are going to help us with on device verification of our receipt verification files with In-App purchases.

30- Explain JSONEncoder and JSONDecoder in Swift4

Decodable protocol, which allows us to take data and create instances of our object, populated with the data passed down from the server.

Encodable protocol to take instances of our object and turn it into data. With that data, we can store it to the files, send it to the server, whatever you need to do with it.

31- What is CocoaTouch ?

CocoaTouch is a library used to build executable applications on iOS. CocoaTouch is an abstract layer on the iOS.

32- What is NotificationCenter ?

NotificationCenter is an observer pattern, The NSNotificationCenter singleton allows us to broadcast information using an object called NSNotification.

The biggest difference between KVO and NotificationCenter is that KVOtracks specific changes to an object, while NotificationCenter is used to track generic events.

33- Why is inheritance bad in swift?

  • We cannot use superclasses or inheritance with Swift value types.
  • Upfront modelling
  • Customization for inheritance is an imprecise

For more information check this out

34- Explain Sequence in Swift

Sequence is a basic type in Swift for defining an aggregation of elements that distribute sequentially in a row. All collection types inherit from Sequence such as Array, Set, Dictionary.

35- What is Receipt Validation ?

The receipt for an application or in-app purchase is a record of the sale of the application and of any in-app purchases made from within the application. You can add receipt validation code to your application to prevent unauthorized copies of your application from running.

36- Explain generic function zip(_:_:)

According to the swift documentation, zip creates a sequence of pairs built out of two underlying. That means, we can create a dictionary includes two arrays.

37- What kind of benefits does Xcode server have for developers?

Xcode server will automatically check out our project, build the app, run tests, and archive the app for distribution.

38- What is Xcode Bot?

Xcode Server uses bots to automatically build your projects. A bot represents a single remote repository, project, and scheme. We can also control the build configuration the bot uses and choose which devices and simulators the bot will use.

39- Explain .gitignore

.gitignore is a file extension that you tell Git server about document types, and folders that you do not want to add to the project or do not want to track changes made in Git server projects.

40- What is Strategy Pattern?

Strategy pattern allows you to change the behaviour of an algorithm at run time. Using interfaces, we are able to define a family of algorithms, encapsulate each one, and make them interchangeable, allowing us to select which algorithm to execute at run time. For more information check this out.

41- What is an “app ID” and a “bundle ID” ?

A bundle ID is the identifier of a single app. For example, if your organization’s domain is xxx.com and you create an app named Facebook, you could assign the string com.xxx.facebook as our app’s bundle ID.

An App ID is a two-part string used to identify one or more apps from a single development team. You need Apple Developer account for an App ID.

42- What is Factory method pattern?

Factory method pattern makes the codebase more flexible to add or remove new types. To add a new type, we just need a new class for the type and a new factory to produce it like the following code. For more information check this out.

43- What is CoreSpotlight?

CoreSpotlight allows us to index any content inside of our app. While NSUserActivity is useful for saving the user’s history, with this API, you can index any data you like. It provides access to the CoreSpotlight index on the user’s device.

44- What are layer objects?

Layer objects are data objects which represent visual content and are used by views to render their content. Custom layer objects can also be added to the interface to implement complex animations and other types of sophisticated visual effects.

45- Explain AVFoundation framework

We can create, play audio and visual media. AVFoundation allows us to work on a detailed level with time-based audio-visual data. With it, we can create, edit, analyze, and re-encode media files. AVFoundation has two sets of API, one that’s video, and one that is audio.

46- What’s the difference between accessibilityLabel and accessibilityIdentifier?

accessibilityLabel is the value that’s read by VoiceOver to the end-user. As such, this should be a localized string. The text should also be capitalized. Because this helps with VoiceOver’s pronunciation. accessibilityLabel is used for testing and Visual Impaired users.

accessibilityIdentifier identifies an element via accessibility, but unlike accessibilityLabel, accessibilityIdentifier's purpose is purely to be used as an identifier for UI Automation tests. We use a value for testing process.

47- How to find the distance between two points (1x, 1y and 2x, 2y)?

We need to calculate the distance between the points, we can omit the sqrt() which will make it a little faster. This question’s background is Pythagorean theorem. We can find the result with CGPoint.

p1
|\
| \
| \ H
| \
| \
|_ _ _\
p2

48- Explain Property Observer

A property observer observes and responds to changes in a property’s value. With property observer, we don’t need to reset the controls, every time attributes change.

49- What’s the difference between a xib and a storyboard?

Both are used in Xcode to layout screens (view controllers). A xib defines a single View or View Controller screen, while a storyboard shows many view controllers and also shows the relationship between them.

50- Explain how to add frameworks in Xcode project?

  • First, choose the project file from the project navigator on the left side of the project window
  • Then choose the target where you want to add frameworks in the project settings editor
  • Choose the “Build Phases” tab, and select “Link Binary With Libraries” to view all of the frameworks
  • To add frameworks click on “+” sign below the list select framework and click on add button.

That’s it. 😃😃😃 Thanks for reading. I hope all these questions will help you in your interviews. Part 5 is ready.

If you want to follow me in social media, here are some links: github, twitterlinkedin

You can check my previous articles here.