DispatchQueue Interview Question | Swift Coding Problem | Most Confusing Problem

  Рет қаралды 3,841

iOS Interview Preparation

iOS Interview Preparation

Жыл бұрын

DispatchQueue Interview Question | Swift Coding Problem | Most Confusing Problem
#swiftprogramming #ios #interview #iosinstagram

Пікірлер: 7
@KanishkaC-ly4bo
@KanishkaC-ly4bo 6 күн бұрын
I was asked a question similar to this for Blinkit's interview
@MrFndo
@MrFndo Ай бұрын
this is classic race condition, you can't be sure that 9 is printed after 1, maybe global queue starts implementing first async block right away and prints 2 after 1
@srkeerthy
@srkeerthy 3 ай бұрын
Awesome.
@shanivishwakarma6514
@shanivishwakarma6514 8 ай бұрын
Nice
@EduPTE
@EduPTE Ай бұрын
Why did 8 come second last? Is 8 in the same thread(global) as 2 & 4. Can you please clarify?
@appgenie
@appgenie 10 күн бұрын
Yes, it's in the same global queue block.
@akashskumar6389
@akashskumar6389 3 ай бұрын
import Foundation func testDispatch() { print ("1") DispatchQueue.global().async{ print("2") DispatchQueue.main.async{ print("3") } print("4") DispatchQueue.main.sync{ print("5") } DispatchQueue.main.async{ print ("6") DispatchQueue.main.sync{ print ("7") } } print ("8") } print ("9") } testDispatch()
We Got Expelled From Scholl After This...
00:10
Jojo Sim
Рет қаралды 73 МЛН
async await with API example | Swift Hindi tutorial
22:03
Code Cat
Рет қаралды 15 М.
Pydantic Tutorial • Solving Python's Biggest Problem
11:07
pixegami
Рет қаралды 245 М.
OperationQueue - BlockOperation in Swift  || iOS interview Questions
12:20
We Got Expelled From Scholl After This...
00:10
Jojo Sim
Рет қаралды 73 МЛН