HCL Interview Questions for IOS Developer

1) What is SwiftUI?

SwiftUI is a framework to build User Interfaces (UI) for iOS apps entirely with Swift code, using a novel declarative approach.

2) What are high order functions in swift?

The high order functions in swift are as follows

  • Map
  • Filter
  • Sorted
  • Reduce
  • Chaining
  • Contains
  • AllSatisfy
  • RemoveAll
  • CompactMap
  • FirstIndex and LastIndex

3) What is a self in Objective c?

In Objective-C, the self is a special variable, in an instance method that refers to the receiver (object) of the message as well as invoking the method, while in a class method the self will indicate which class to call. This is the actual object that is used in runtime to execute the current method as an invisible argument.

4) What is use of delegates in IOS?

Delegates are used in iOS to establish communication within modules that are partially related to each other. For instance, passing data forward is very easy with the use of segue. However, sending data backward is a little tricky, so we use the delegate to send the data backward.

5) What are the App states in IOS?

The app states in IOS are as follows:

  • Non-running - It indicates that the app is not running.
  • Inactive - It indicates that the app is running in the foreground, but not receiving events.
  • Active - It indicates that the app is running in the foreground, and receiving events.
  • Background - It indicates that the app is running in the background, and executing code.
  • Suspended - It indicates that the app is in the background, but no code is being executed.

6) What is NSNotification?

NSNotification is an object containing information generally considered as a class. It is broadcast to registered observers that bridge to Notification. It is used when you need reference semantics or other Foundation-specific behavior.

Declaration of NSNotification: class NSNotification: NSObject.

7) What is use of question mark ? in Swift?

Question marks ? in Swift, is a way that lets you indicate the possibility that a value might be absent for any type at all, without the need for special constants.

8) What is optional chaining?

Optional chaining is the process of querying, calling properties, subscripts, and methods that may be 'nil'. Since multiple queries to methods, properties, and subscripts are grouped together that failure to one chain will affect the entire chain and results in a 'nil' value. Optional chaining is used to set and retrieve a subscript value that validates whether a call, to that subscript, returns a value.

9) What are Tuples in Swift?

In swift, tuples are used to group multiple values into a single by using parentheses and separated by commas. It enables you to create, store, and pass around groups of values that can be of different types by using a single variable. It is needed to define those values with named variables or unnamed variables.

For instance, a simple example of defining named tuples in the swift programming language is as follows:

let user_info = (name: "Suresh Dasari", id: 200)
var user_info:(name:String, id:Int) = ("Suresh Dasari", 200)

A simple example of defining unnamed tuples in the swift programming language is as follows:

let userInfo = ("Suresh Dasari", 200)
var userinfo:(String, Int) = ("Suresh Dasari", 200)

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.