Curated iOS Interview Questions Series — Part 3

Rahul Goel
3 min readOct 6, 2021

Series aiming to cover as many Q&A’s as possible from iOS interview perspective.

Do check out Part-1, Part-2 before proceeding further.

Q 35. Is there any difference between nil and .none

Q35

Output : are same

Q36. What is the output in Playground?

Q36

Output : Welcome to Mars

The capture list creates a copy of thing when you declare the closure and does not change afterwards.

Q37. What is the output in Playground?

Q37

Output : Welcome to Earth

As the compiler would use reference, thus would use the last updated value from thing.

Q38. Recursive enumeration in Swift?

If any case in the enum contains one or more associated value as another instance of the same enum itself then it is recursive enumeration.

Q38

use indirect keyword for the same.

Q39. Can enum have stored properties and methods?

Q39

Stored Property — No

Q39

method — Yes

Q40. opaque return type in Swift?

A function or method with an opaque return type hides its return value’s type information. Instead of providing a concrete type as the function’s return type, the return value is described in terms of the protocols it supports.

Q41. What is output ?

Answer : 5, Optional(25)

Q42. What is Output?

Output : Compilation Error, Can not assign a property: ‘name’ is get only property

Follow me

for further updates.

--

--

Rahul Goel

Computer Science Enthusiast | 11+ Year of Software Evolution | @Sharechat, Groupon, Paytm, Myntra https://www.linkedin.com/in/therahulgoel/