Challenge - 5 Problems
Network Data Fetch Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate1:30remaining
Why do network calls fetch remote data?
Which statement best explains why mobile apps use network calls to fetch remote data?
Attempts:
2 left
💡 Hint
Think about where the latest data lives and how apps get it.
✗ Incorrect
Mobile apps use network calls to connect to remote servers to get the latest data that is not stored locally. This keeps the app's information fresh and up to date.
❓ ui_behavior
intermediate1:30remaining
What happens when a network call fetches data?
When a mobile app makes a network call to fetch remote data, what is the expected behavior in the app's UI?
Attempts:
2 left
💡 Hint
Think about how apps keep users informed during data loading.
✗ Incorrect
Apps usually show a loading spinner or message while waiting for data, then update the UI once the data is received.
❓ lifecycle
advanced2:00remaining
When should network calls be made in an Android app lifecycle?
In Android development with Kotlin, at which lifecycle event is it best to start a network call to fetch remote data for a screen?
Attempts:
2 left
💡 Hint
Consider when the UI is ready to show new data.
✗ Incorrect
onCreate() is called when the screen is created, so starting network calls here ensures data loads early for display.
advanced
2:00remaining
How does fetching remote data affect navigation flow?
If a screen depends on remote data fetched via network call, what is a good practice for navigation?
Attempts:
2 left
💡 Hint
Think about user experience when data is not yet loaded.
✗ Incorrect
Showing a loading screen or placeholder prevents showing empty or broken UI and improves user experience.
🔧 Debug
expert2:30remaining
What error occurs if network call is made on main thread?
In Android Kotlin, what error or behavior happens if you make a network call directly on the main UI thread?
Android Kotlin
val url = URL("https://example.com/data.json") val connection = url.openConnection() as HttpURLConnection val data = connection.inputStream.bufferedReader().readText()
Attempts:
2 left
💡 Hint
Android prevents long tasks on the main thread to keep UI responsive.
✗ Incorrect
Android throws NetworkOnMainThreadException to prevent freezing the UI by blocking network calls on the main thread.