📘 Android, Kotlin & Flutter Interview
Preparation Guide
🧠 Kotlin Core Concepts
1. Master Functions, Lambdas, and Higher-Order Functions
- Lambda Expressions are short functions without names. Example:
val sum = { a: Int, b: Int -> a + b }
- Higher-Order Functions take or return functions. Example:
fun calculate(x: Int, y: Int, operation: (Int, Int) -> Int): Int = operation(x, y)
2. Object-Oriented Programming (OOP) in Kotlin
- Kotlin supports classes, inheritance, and interfaces.
- Example:
open class Animal(val name: String) {
open fun sound() = "Some sound"
}
class Dog(name: String) : Animal(name) {
override fun sound() = "Bark"
}
3. Null Safety
- Kotlin prevents null pointer exceptions using nullable types.
- Safe Call: val nameLength = name?.length
- Elvis Operator: val length = name?.length ?: 0
📱 Android Components
1. Android OS Architecture (Simple Terms)
- Linux Kernel: Base layer communicating with hardware
- HAL: Middleware for hardware communication
- ART: Converts app code to native
- Libraries: Common functions used by apps
- App Layer: Where user apps run
2. Activity & Lifecycle
- An Activity is a single screen in Android.
- Lifecycle: onCreate → onStart → onResume → onPause → onStop → onDestroy → onRestart
- Example: Moving from Activity A → B → back to A:
A: onPause → B: onCreate, onStart, onResume → A: onStop
Back: B: onPause → A: onRestart, onStart, onResume → B: onStop, onDestroy
3. Intents
- Explicit Intent: Calls a specific activity. Example: Intent(this, SecondActivity::class.java)
- Implicit Intent: Performs general actions like opening a URL.
4. Fragments
- Reusable UI part inside an activity. Lifecycle includes onAttach, onCreate, onCreateView,
etc.
5. Layout Types
- LinearLayout: Vertical or horizontal list
- RelativeLayout: Position views relative to others
- ConstraintLayout: Flat and flexible design
- FrameLayout: Displays one view at a time
🎯 Flutter Overview
1. How Flutter Code Runs on Android, iOS, and Web
- Dart code is compiled into native ARM (Android/iOS) or JavaScript (Web)
- Skia engine draws everything directly on screen
2. Skia in Flutter
- A powerful graphics engine that renders UI pixels directly, allowing consistency across
platforms
3. Single Codebase Magic
- Write once in Dart, Flutter compiles it for Android, iOS, and Web using its own widgets and
Skia.
❓ Common Interview Questions
Kotlin Interview Questions:
- What is the difference between val and var?
- What is a higher-order function?
- How does null safety work in Kotlin?
- What are extension functions?
Android Interview Questions:
- What is the Android activity lifecycle?
- What are the different types of intents?
- What is a fragment and how is it different from an activity?
- What is the role of AndroidManifest.xml?
Flutter Interview Questions:
- How does Flutter achieve cross-platform compatibility?
- What is the difference between Stateful and Stateless widgets?
- How does hot reload work in Flutter?
- What is a widget in Flutter?