iOS Interview Coding Challenges

Dipika Kansara
2 min readJan 25, 2022

In this tutorial you will learn basic iOS coding challenges , According to my personal Experience I have shared the list of iOS Interview Coding Challenges for beginners.

Problem1 : Find the total numbers of character in given sentence.“I love Swift Language.”

Answer:

let sentence = "I love Swift Language"
print(sentence.count)

Problem 2 : Check the number Even or odd

Answer:

func checkEvenOdd()
{
var num = 54 guard num % 2 == 0 else
{
print("Odd") return
}
print("Even")}checkEvenOdd()

Problem 3: Find the factorial of a Number

Answer:

func factorial(num : Int ) -> Int
{
if num == 0
{
return 1
}
else
{
return num * factorial(num: num - 1)
}
}

Problem 4: Calculate Area and Volume

Answer:

class Hall {var length = 0.0var height  = 0.0var breadth = 0.0func calculateArea()
{
let result1 = length * breadth print( result1)}func calculateVolume()
{
let result2 = length * breadth * height print(result2) }
}
var hall1 = Hall()hall1.length = 3hall1.breadth = 5hall1.height = 4hall1.calculateArea()hall1.calculateVolume()

Problem 5: Find Largest Number among three Numbers

Answer:

var a = 0
var b = 3
var c = 7
if a > b
{
if a > c { print("A is big")
}
}else if b > c { print( "B is big")}else {print("C is big")}

Problem 6: Merge given two sentence, “I love Programming.” and “I code in Swift language”

Answer:

Method — 1 : Using Append parameter:

var firstLine : String = "I love Programming"
var secondLine : String = "I code in Swift language"
firstLine.append(secondLine)
print(firstLine)

Method 2 : Using Operator

var firstLine : String = "I love Programming"
var secondLine : String = "I code in Swift language"
let result = firstLine + secondLine
print(result)

Problem 7: Add Two numbers Using Parameters and Return type

Answer:

func addTwoNumbers(no1 : Int, no2 : Int) -> Int
{
var total = no1 + no2return total}

I hope these iOS challenges are useful and will help you to get the best job.

Happy Coding 😁

--

--