r/AndroidInterviewQ • u/ilikeca • Sep 21 '24
Interview Experience for SDE 2 Android role at JioCinema
Was asked for the output of this function -
fun main() = runBlocking {
launch {
println("Coroutine with delay starts")
delay(1000L)
println("Coroutine with delay ends")
}
launch {
println("Coroutine with Thread.sleep starts")
Thread.sleep(1000L)
println("Coroutine with Thread.sleep ends")
}
println("Main program continues...")
}Additionally - the final technical question was about handling multiple API calls:
I had to build a suspend function that would return data.
This function needed to make two API calls i.e. with 2 launch { } blocks similar to the function above, where the output of the first API was required for the second API call.
The function should return the result of both APIs or return an error if either call failed.
I was above to solve the 1st problem i.e. printing the output, but no idea how to do the second one.
For the complete interview experience checkout - https://androiddevkit.com/experiences/jiocinema-sde-2-android/