Status: Working as SSE in a Multinational Product Based company.
YOE: 8.5 years In IOS 2.5 years
Round 1: IOS - 90 Minutes
DispatchQueue.main.async {
print("A")
DispatchQueue.main.sync {
print("B")
}
print("C")
}
Answer:
Output is: A because to print C it will wait main.sync should come out it will create deadlock in real time it will crash but it will give output in playofround as ALet name: String = nil // Answer: This will not compile
Let name: String? = nil // Answer: This will compile
Let name: String! = nil // Answer: This will compile
Struct Person {
let name: String
let father: Person
}
class Person {
let name: String
let father: Person
init(name: String, person: Person) {
self.name = name
self.person = person
}
}
Answer:
Struct will not complie and Class will complie you can create object of Class because of Referance type.Let’s say on a VC there are many UI elements?
Task is to design a function which will return all the UILabels on that VC?
Main View
-V
- V
-V
-L
-I
-V
-L
-T
Answer:
extension UIView {
func findLabel(inout output: [ULabel]){
for innerView in self.subviews {
If innerView as UIView {
output.append(contentsOf: innerView.findLabel())
} else if innerView as UILabel {
output.append(innerView)
}
}
return output
}
}
view.findLabel(&[])