Bird
Raised Fist0
Android Kotlinmobile~20 mins

Modularization in Android Kotlin - Practice Problems & Coding Challenges

Choose your learning style10 modes available
Challenge - 5 Problems
🎖️
Modularization Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
Why use modularization in Android apps?
Which of the following is the main benefit of modularizing an Android app into multiple modules?
AIt improves build times and allows independent development of features.
BIt automatically increases the app's runtime speed without code changes.
CIt forces all code to be in one file for easier debugging.
DIt disables the use of external libraries to reduce app size.
Attempts:
2 left
💡 Hint
Think about how dividing code helps teams and build processes.
❓ ui_behavior
intermediate
1:30remaining
Module dependency effect on UI
If a feature module depends on a core module that provides UI components, what happens if the core module is removed from the project?
AThe app will run normally without any UI changes.
BThe feature module will automatically recreate the core UI components.
CThe feature module will convert to a library module automatically.
DThe feature module's UI components will fail to compile or run.
Attempts:
2 left
💡 Hint
Consider what happens when a required module is missing.
❓ lifecycle
advanced
2:00remaining
Impact of modularization on app lifecycle
How does modularization affect the Android app lifecycle when modules are loaded dynamically at runtime?
AModules can be loaded or unloaded without restarting the entire app, affecting lifecycle callbacks.
BAll modules must be loaded at app start, so lifecycle is unchanged.
CModules replace the main activity lifecycle with their own independent lifecycles.
DModularization disables lifecycle callbacks in feature modules.
Attempts:
2 left
💡 Hint
Think about dynamic feature modules and their loading behavior.
❓ navigation
advanced
2:00remaining
Navigation between modules
In a modularized Android app, what is the recommended way to navigate from a screen in one module to a screen in another module?
ACopy the target screen's code into the current module.
BDirectly import the target module's classes and call them.
CUse a shared navigation interface or deep links to decouple modules.
DUse static variables to share navigation state between modules.
Attempts:
2 left
💡 Hint
Consider how to keep modules independent while allowing navigation.
🔧 Debug
expert
2:30remaining
Debugging module dependency errors
You get a runtime error: "ClassNotFoundException" for a class in a feature module. What is the most likely cause in a modularized Android app?
AThe class name is misspelled in the feature module source code.
BThe feature module was not included or loaded properly at runtime.
CThe app's main module has too many dependencies declared.
DThe AndroidManifest.xml is missing the INTERNET permission.
Attempts:
2 left
💡 Hint
Think about how modules are packaged and loaded in the app.

Practice

(1/5)
1. What is the main purpose of modularization in Android Kotlin projects?
easy
A. To avoid using dependencies
B. To write all code in a single file
C. To split the app into smaller, manageable parts
D. To increase app size unnecessarily

Solution

  1. Step 1: Understand modularization concept

    Modularization means dividing the app into smaller parts called modules.
  2. Step 2: Identify the purpose

    This helps manage code better and makes development easier.
  3. Final Answer:

    To split the app into smaller, manageable parts -> Option C
  4. Quick Check:

    Modularization = split app into parts [OK]
Hint: Modularization means breaking app into smaller parts [OK]
Common Mistakes:
  • Thinking modularization means writing all code in one file
  • Believing modularization avoids dependencies
  • Assuming modularization increases app size
2. Which of the following is the correct way to add a module dependency in a Kotlin Android project build file?
easy
A. import module ":mylibrary"
B. add dependency ":mylibrary"
C. include module ":mylibrary"
D. implementation project(":mylibrary")

Solution

  1. Step 1: Recall Gradle syntax for module dependencies

    In build.gradle.kts, dependencies use implementation(project(":moduleName")) syntax.
  2. Step 2: Match correct syntax

    implementation project(":mylibrary") matches this syntax exactly.
  3. Final Answer:

    implementation project(":mylibrary") -> Option D
  4. Quick Check:

    Module dependency syntax = implementation project(":module") [OK]
Hint: Use implementation project(":moduleName") to add module dependency [OK]
Common Mistakes:
  • Using import or include keywords incorrectly
  • Forgetting to wrap module name in project()
  • Using add dependency which is not Gradle syntax
3. Given two modules: app and utils. If app depends on utils, what happens when you call a function defined in utils from app?
medium
A. The function runs correctly if dependency is set
B. The app crashes at runtime
C. The function is ignored during build
D. The app fails to compile

Solution

  1. Step 1: Understand module dependency effect

    If app depends on utils, app can use utils code.
  2. Step 2: Predict behavior when calling function

    Calling a function from utils works if dependency is correctly set, so function runs fine.
  3. Final Answer:

    The function runs correctly if dependency is set -> Option A
  4. Quick Check:

    Dependency set = function runs [OK]
Hint: Module dependency allows code sharing and function calls [OK]
Common Mistakes:
  • Assuming app crashes without error
  • Thinking function is ignored during build
  • Believing app fails to compile without error
4. You added a module dependency in app on library, but the app fails to compile with "Unresolved reference" errors for library classes. What is the most likely cause?
medium
A. The project was not synced after adding dependency
B. The library module has no Kotlin files
C. The app module is missing AndroidManifest.xml
D. The dependency was added in the wrong build.gradle file

Solution

  1. Step 1: Identify cause of unresolved references

    Unresolved references after adding dependency usually mean changes haven't taken effect in the IDE.
  2. Step 2: Check sync status

    The project must be synced after modifying build.gradle for dependencies to resolve.
  3. Final Answer:

    The project was not synced after adding dependency -> Option A
  4. Quick Check:

    No sync = unresolved references [OK]
Hint: Sync project after adding dependencies [OK]
Common Mistakes:
  • Adding dependency in wrong build.gradle file
  • Library module has no Kotlin files
  • App module missing AndroidManifest.xml
5. You want to create a modularized Android app with three modules: app, network, and database. The app module should use both network and database, but network should not depend on database. How should you set dependencies?
hard
A. network depends on database; app depends on network
B. app depends on network and database; network has no dependencies
C. database depends on network; app depends on database
D. app depends only on network; network depends on database

Solution

  1. Step 1: Analyze dependency requirements

    App needs both network and database modules. Network must not depend on database.
  2. Step 2: Set dependencies accordingly

    App depends on both network and database. Network has no dependencies to database.
  3. Final Answer:

    app depends on network and database; network has no dependencies -> Option B
  4. Quick Check:

    App uses both; network independent [OK]
Hint: Only app depends on both; network stays independent [OK]
Common Mistakes:
  • Making network depend on database incorrectly
  • Setting app to depend only on network
  • Confusing dependency directions
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard