0
0
Android Kotlinmobile~20 mins

Clean Architecture layers in Android Kotlin - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Clean Architecture Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Identify the correct Clean Architecture layer for UI logic
In Clean Architecture for Android, which layer should handle user interface logic such as displaying data and capturing user input?
AFramework layer
BData layer
CDomain layer
DPresentation layer
Attempts:
2 left
💡 Hint
Think about where the app interacts directly with the user.
ui_behavior
intermediate
2:00remaining
Effect of violating Dependency Rule in Clean Architecture
What happens if the Data layer directly depends on the Presentation layer in a Clean Architecture Android app?
AThe app will crash at runtime due to circular dependencies
BIt improves performance by reducing abstraction layers
CIt breaks the Dependency Rule, causing tight coupling and harder testing
DIt is recommended for faster UI updates
Attempts:
2 left
💡 Hint
Consider the direction of dependencies in Clean Architecture.
lifecycle
advanced
2:00remaining
Correct lifecycle owner for ViewModel in Clean Architecture
In an Android app using Clean Architecture, which lifecycle owner should be used to scope a ViewModel in the Presentation layer?
AActivity or Fragment lifecycle
BApplication lifecycle
CDomain layer lifecycle
DData layer lifecycle
Attempts:
2 left
💡 Hint
ViewModels are tied to UI components' lifecycles.
navigation
advanced
2:00remaining
Where to handle navigation logic in Clean Architecture
In Clean Architecture, where should navigation logic (e.g., moving between screens) be implemented in an Android app?
AData layer, to fetch navigation data
BPresentation layer, to handle UI navigation events
CDomain layer, because navigation is a business rule
DFramework layer, to access Android navigation components
Attempts:
2 left
💡 Hint
Think about which layer controls user interactions and screen changes.
🔧 Debug
expert
2:00remaining
Diagnose the cause of a runtime crash due to layer violation
An Android app using Clean Architecture crashes at runtime with a ClassCastException when the Data layer tries to cast a Presentation layer class. What is the most likely cause?
AThe Data layer depends on Presentation layer classes, violating the Dependency Rule
BThe Presentation layer is incorrectly referencing Domain entities
CThe Domain layer is missing interface implementations
DThe Framework layer is not initialized before use
Attempts:
2 left
💡 Hint
ClassCastException often happens when layers depend on each other incorrectly.