300+ TOP iOS Interview Questions and Answers

iOS Interview Questions for freshers experienced :-

1.What is latest iOS version?
The latest version of iOS is 13.

2. What is the output of the following Program? let numbers = [1, 2, 3, 4]
let numberSum = numbers.reduce(0, { $0 + $1})

10

3. Conversion of Error to optional Value is used as a method to handle Errors in Swift (True/False)
True

4. Structures can be inherited(True/False)
Flase

5. What is the Output of Following Program var randomly Array: [AnyObject] = [1,1.2,”Hello”] print (randomArray)
Compilation Error (1 is an Int not object)

6. What is the Output Of Following Program
class FirstClass {

func doFunction() {

print(“I am superclass”)

}}

class SecondClass: Firstclass {

override func doFunction() {

print(“I am subclass”)

}}

let object = SecondClass()

object.doFunction()

I am subclass

7. What is ARC?
Automatic Reference Counting

8. What is ARWorld Map?
An ARWorldMap object contains a snapshot of all the spatial mapping information that ARKit uses to locate the user’s device in real-world space.

9. How shared AR Experience is Created?
Once the AR world map created from once device is transferred to the other device using P2P connectivity or some other reliable source, the other devices can also have the same AR experience similar to the first device.

To create an ongoing shared AR experience, like placing an AR object, When one user taps in the scene, the app creates an anchor and adds it to the local ARSession, instead of sending the whole map we can serializes that ARAnchor using Data and sends it to other devices in the multipeer session.

10. What are the main UITableViewDataSource methods that are needed to display data in table view?
numberOfSection, numberOfRowsInSection, cellForRowAtIndexPath

iOS Interview Questions
iOS Interview Questions

11. What are the two basic things that are needed to create an NSFetchRequest in CoreData?
EntityName, SortDescriptor/NSPredicate

12. What are Tuples in Swift?
Tuples are Temporary container for Multiple Values. It is a comma-separated list of types, enclosed in parentheses. In other words, a tuple groups multiple values into a single compound value.

13. What are the Control Transfer Statements in swift?
break, continue, fallthrough, return, throw

14. What are closures and write an example program for closure?
Closures are self-contained blocks of functionality that can be passed around and used in code.

var addClosure = { (a: Int, b: Int) in

return a + b

}

let result = addClosure(1,2)

print(result)

15. Briefly explain reference types and value types with examples?
Classes are reference types and Structures are value types. When a class is assigned to variable and copied only the reference to the original value are passed and so any consecutive changes to the assigned values will also affect the original value.

But in struct when it is assigned to another variable a copy is generated which will not have any effect on the original value when changed.

16. What are the features of Swift ?
Variables are always initialized before use.

  • Memory is managed automatically.
  • Arrays and integers are checked for overflow.
  • Switch function can be used instead of using “if” statement.
  • It eliminates the classes that are in unsafe mode.

17. What is the significance of “?” in Swift?
The question mark (?) is used during the declaration of a property can make a property optional.

18. What Is Initialization ?
This process involves setting an initial value for each stored property on that instance and performing any other setup or it is required before the new instance is ready for use.

e.g.: keyword:

init() {

// code initialization here.

}

19. What is NSURL Session?
NSURL Session is a replacement for NSURL Connection, and similarly it is both a distinct class and also a group of related APIs.

20. What are the Session Configuration?
NSURL Session Configuration provides a few factory methods to create your session configuration.

The methods are:

Default Configuration – provides anccess to the global singleton storage and settings.
Ephemeral Session Configuration – a private, in-memory only storage
Background Session Configuration – out-of-process configuration that is keyed to the identifier string.

21. How to define kSomeConstant ?
e.g.:let kSomeConstant: Int = 80

It is Implicitly defined as an integer. If you want to be more specific you can specify it like above e.g..

22. Define hash value vs raw value ?
HashValue:- If you had the enum as we had declared earlier without the type, there is no rawValue available but instead you get a member called hashValue.

RawValue:- The rawValue on the other hand is a type value that you can assign to the enum members.

23. Define Static Binding and Dynamic Binding?
Static Binding: It is resolved at “Compile time” Method overloading is an example of static binding.

Dynamic Binding: It is virtual binding resolved at a “Run Time”. Method overriding is an example of Dynamic Binding.

24. What is Method Overloading?
It defines a method with the same name many times with different arguments. These kind of feature is known as Method Overloading.

25. What is Method Overriding?
If we define a method in a class, and we know that a subclass might need to provide a different version of the method. When a subclass provides a different implementation of the method defined in a superclass, with the same name, arguments and return type, that is called Overriding. The implementation in the subclass overwrites the code provided in the superclass.

26. What is QOS?
QOS – Quality of Service

QOS can applied all over iOS as well. One can Prioritize queues, thread objects, dispatch queues and POSIX threads.By assigning the correct priority for the work, iOS apps remain quick, snappy and responsive.

27. What is User Interactive?
It works happened on the main thread, Immediately in order to provide a nice user experience. e.g run at while in Drawing and Ui animations.

28. What is User Initiated?
It works when the user kicks off and should yield immediate results. It Performs asynchronously that are initiated from the UI This will get the mapped in to the high Priority Global Queue. This work must be complete for the user to continue.

29. What is DeadLock?
A deadlock is a situation where two different programs or processed depend on one another for completion, either because both are using. It is the situation where a set of processes are blocked because each process is holding a resource and waiting for another resource acquired by some other process.

30. Define Run Loop?
Run loop mode is a collection of input sources and times to be monitored and the collection of run loop observes to be notified.

Become an iOS Expert with Certification in 25hours

31. What is iOS?
iOS (intelligent Operating System) is a mobile operating system created and developed by Apple Inc. exclusively for its hardware with the help their own creating language called Objective C and Swift

32. What is the difference between the cocoa and cocoa Touch?
Cocoa includes Foundation and AppKit frameworks for developing applications that run on Mac OS X.

Cocoa Touch includes Foundation and UI framework for developing applications that run on iPhone ,iPod Touch and iPad.

33. What are the different property types?
strong, weak, assign,copy,retain,atomic and non atomic.

34. Explain frame and bound of a View in ios?
Bound is the rectangle that relative to its own coordinate system (0,0.

Frame is the rectangle that relative to the superview .

35. What are the design patterns in ios?

  • Singleton
  • Delegate
  • Model View Controller
  • Observer
  • Facade
  • Command
  • Template Method

36. Types of Dispatch Queues
Serial :execute one task at a time in the sequential order

Concurrent: execute one or more tasks concurrently.

Main dispatch queue: executes tasks on the application’s main thread.

37. key value coding(KVC) and key value observing (KVO)
Key-Value-Coding (KVC) : accessing a property or value using a string.

Key-Value-Observing (KVO) : observe changes to a property or value.

38. Application life cycle
application:willFinishLaunchingWithOptions
application:didFinishLaunchingWithOptions
applicationDidBecomeActive
applicationWillResignActive
applicationDidEnterBackground
applicationWillEnterForeground
applicationWillTerminate

39. Different states of application

  • Not running
  • Inactive
  • Active
  • Background
  • Suspended

40. View life cycle

  • loadView
  • loadViewIfNeeded
  • viewDidLoad
  • viewWillAppear
  • viewWillLayoutSubviews
  • viewDidLayoutSubviews
  • viewDidAppear
  • viewWillDisappear
  • viewDidDisappear

41. whats is delegate and notification
Delegate: Creates the relationship between the objects. It is one to one communication.

Notification: These are used if an object wants to notify other objects of an event. It is one to multiple communication.

42. What is the significance of “?” in Swift?
The question mark (?) is used during the declaration of a property can make a property optional. If the property does not hold a value.

43.What are the Levels of Priority in QOS?
User Interactive
User Initiated
Utility
Background

44. How to write optional value in swift ?
An optional that can hold either a value or no value. Optionals are written by appending a ‘?’

45. How to unwrap the optional value in swift ?
The simplest way to unwrap an optional value is to add a ‘!’ after the optional name. This is called “force unwrapping”.

46. Use of if -let statement in swift
By using if- let ,we can unwrap an optional in safe way, otherwise nil it may crash the app sometimes.

47. What is id in Objective C?
id is a type of any data type. It specifies a reference to any Objective-C object .

48. What is Categories in Objective C?
Categories provide the ability to add functionality to an object without changing the actual object.

49. What is Extension in swift?
Extension add new functionality to an existing class, structure, enumeration, or protocol type. Extensions are similar to categories in Objective-C.

50. Define Class methods and instance methods .
An instance method accessed an instance of the class

A class method accessed to the class itself.

51. How to add swift file to the existing Objective C project?
If you add a new swift file to the existing project xcode will ask you to add Objective-C bridging header.

52. What is auto layout and why it uses?
Auto Layout is a constraint-based layout system.By using this auto layout developers to create an adaptive interface that responds appropriately to changes in screen size and device orientation.

53.How many ways constraints can create programmatically?
Three ways to creating constraints programmatically :

layout anchors
NSLayoutConstraint class
Visual Format Language.

54. Is it possible to create multiple storyboards in single project. If yes how to switch from one storyboard to another?
Yes, By using segue and Storyboard Reference we can switch from one storyboard to another storyboard.

55. What is let and var in swift?
Let is immutable variable or a constant that means it cannot changed where as var is mutable variable meaning that it can be changed.

56. What is IBOutlet and IBAction in ios ?
Interface Builder outlet(IBOutlet) is a variable which is a reference to a UI component.

Interface Builder action(IBAction) is a function which is called when a specific user interaction occurs.

57. What is bundle in ios?
A bundle is a directory in the file system that contains the all executable code and related resources such as images and sounds together in one place.

58. when will use deinit in swift?
deinit can be used if you need to do some action or cleanup before deallocating the object.

59. what is the responsibility of URLSession?
URLSession is responsible for sending and receiving HTTP requests.

60. what are the types of URLSessionTask?
URLSessionDataTask
URLSessionUploadTask
URLSessionDownloadTask

61. Main difference between NSURLSession and NSURLConnection
NSURLConnection:

when our App goes to background mode or not running mode using NSURLConnection, everything we have received or sent were lost.

NSURLSession:

NSURLSession gives your app the ability to perform background downloads when your app is not running or app is suspended.

62. what is JSON?
JSON ( JavaScript Object Notation) is a text-based, lightweight and easy way for storing and exchanging data.

63. what is JSONSerialization ?
The built in way of parsing JSON is called JSONSerialization and it can convert a JSON string into a collection of dictionaries, arrays, strings and numbers .

64. Difference between core data and sqlite?
Core Data is a framework that can be used for managing an object graph. Core Data is not a database.Core Data can use a SQLite database as its persistent store, but it also has support for other persistent store types, including a binary store and an in-memory store. SQLite is a lightweight relational database.

65. Difference between Keychain and NSUserDefaults?
In Keychain: If user removed the app from device the saved UserName and Password still is there.

In NSUserDefaults: If user removed the app from device the saved UserName and Password also removed.

66. what is app thinning. How to reduce app size?
App thinning is concept of reducing the app size while downloading.Using the below methods we can reduce the app size

  • App Slicing
  • Bitcode
  • On-Demand Resource

67. what is Bundle ID?
The Bundle ID is the unique string that identifies your application to the system.

68. What are the types of certificates required for developing and distributing apps?
Development and distributing certificates.

Development certificate: used for development

Distribution certificates: used for submitting apps to app store or in house

69. what are binaries required to install the app to device?
.ipa,

.app

70. what are the advantages of swift over Objective C?

  • Readability
  • Maintenance
  • Safer Platform
  • Less Code & Less Legacy
  • Speed

71. What is latest xcode version and its features?
Xcode latest version is 10.1

  1. The Dark Mode
  2. instantly Swift Source Code Editor
  3. Debugging the Tools
  4. Playground for Machine Learning
  5. Source Control

72. What are new features in ios 12 for developers ?

  • ARKit 2
  • Siri Shortcuts
  • CarPlay for Navigation Apps
  • Health Records
  • Natural Language

73. How to pass data between view controllers
Segue, in prepareForSegue method (Forward)
Delegate (Backward)
Setting variable directly (Forward)

74. What is the Output of the Following Program?
class Cricket

{

var score = 100

}

var player1 = Cricket() var player2 = player1 player2.score = 200 print((player1.score),(player2.score))

200,200

iOS Questions and Answers Pdf Download

Leave a Reply

Your email address will not be published. Required fields are marked *