Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

8668 bites

Page 213

What is a CoroutineDispatcher and when do you use each type?
Android & Kotlin2 min read

What is a CoroutineDispatcher and when do you use each type?

Tests your grasp of coroutine threading. A dispatcher manages which threads a coroutine runs on. Explain Main for UI, Default for CPU-intensive work, and IO for blocking operations. A red flag is mixing up IO and Default or using Unconfined.

Hot vs. Cold Streams: `StateFlow` vs. `Flow`
Android & Kotlin2 min read

Hot vs. Cold Streams: `StateFlow` vs. `Flow`

Tests your grasp of stream lifecycles. A great answer defines cold Flow (lazy, per-collector) vs. hot StateFlow (shared, active), then uses a ViewModel UI state scenario to show why StateFlow is correct for surviving configuration changes.

Structured Concurrency in Kotlin Coroutines
Android & Kotlin2 min read

Structured Concurrency in Kotlin Coroutines

Tests your understanding of coroutine lifecycles and error handling. A good answer defines the parent-child relationship, then explains how cancellation and exceptions propagate through the scope. A red flag is simply calling it a way to 'group' coroutines.

Explain Kotlin's scope functions: let, run, with, apply, also
Android & Kotlin2 min read

Explain Kotlin's scope functions: let, run, with, apply, also

This tests your grasp of idiomatic Kotlin and the two key differentiators: context object (this/it) and return value (object/lambda result). A great answer defines these axes, categorizes each function, and provides a clear example.

What is a `suspend` function in Kotlin?
Android & Kotlin2 min read

What is a `suspend` function in Kotlin?

Tests your grasp of Kotlin's core concurrency primitive. A suspend function can pause and resume. It must be called from another suspend function or a coroutine builder.

Difference between launch and async in Kotlin Coroutines
Android & Kotlin2 min read

Difference between launch and async in Kotlin Coroutines

This tests your grasp of coroutine result handling and exception propagation. Explain that launch is fire-and-forget (returns Job), while async is for results (returns Deferred). Mention async defers exceptions until await().

Explain `inline` and `reified` in Kotlin
Android & Kotlin2 min read

Explain `inline` and `reified` in Kotlin

Tests your grasp of JVM performance costs and type erasure. A great answer explains how inline avoids object allocation for lambdas, and how this enables reified to bypass type erasure for runtime checks. A red flag is just saying 'it's for performance'.

Compare and contrast Kotlin's `apply` and `let` scope functions
Android & Kotlin2 min read

Compare and contrast Kotlin's `apply` and `let` scope functions

This tests your grasp of idiomatic Kotlin scope functions. apply uses this and returns the object, ideal for configuration. let uses it and returns the lambda result, useful for null-safe chaining.

When would you use a sealed class instead of an enum?
Android & Kotlin2 min read

When would you use a sealed class instead of an enum?

This tests your understanding of state representation. Explain that sealed classes define a hierarchy of types that can hold different data, while enums are a set of singleton constants.

Explain and implement a higher-order function in Kotlin
Android & Kotlin2 min read

Explain and implement a higher-order function in Kotlin

Tests your grasp of functions as first-class citizens. Define a higher-order function, explain it takes/returns functions, then implement filterAndTransform using the specified lambdas.

lateinit var vs. val by lazy in Android
Android & Kotlin2 min read

lateinit var vs. val by lazy in Android

Tests your grasp of Kotlin's non-nullable property initialization. Define lateinit (mutable, framework-init) vs. lazy (immutable, deferred-init). Use lateinit for Views in onCreate and lazy for expensive objects. Red flag: confusing their mutability.

What are the advantages of a Kotlin data class?
Android & Kotlin2 min read

What are the advantages of a Kotlin data class?

Tests knowledge of Kotlin's boilerplate reduction for data holders. A good answer defines the advantage (conciseness), names generated functions like equals, hashCode, and copy, and explains copy for immutable state updates.

What is a Kotlin extension function? Write one for String.
Android & Kotlin2 min read

What is a Kotlin extension function? Write one for String.

Tests your grasp of adding functionality to existing classes without inheritance. A great answer defines it as syntactic sugar over static methods, explains its use for third-party code, then implements the requested String.hasWhitespace function.

Purpose of Kotlin's safe call (`?.`) and Elvis (`?:`) operators?
Android & Kotlin2 min read

Purpose of Kotlin's safe call (`?.`) and Elvis (`?:`) operators?

This tests your grasp of Kotlin's null safety philosophy. A good answer defines the safe call (?.) for conditional access and the Elvis operator (?:) for default values, then combines them. A red flag is using verbose if/else checks for simple cases.

Explain val vs. var and null safety in Kotlin
Android & Kotlin2 min read

Explain val vs. var and null safety in Kotlin

Tests your grasp of Kotlin's core principles: immutability and compile-time null safety. Define val (read-only) vs. var (mutable), declare nullables with ?, and identify the risk as runtime NullPointerExceptions.

Coroutine Exception Handling: launch vs. async
Android & Kotlin2 min read

Coroutine Exception Handling: launch vs. async

Coroutine builders handle exceptions differently. launch propagates them immediately, crashing if unhandled. async silently catches them, waiting for you to call await. Use a CoroutineExceptionHandler on root scopes for global logging.

Analytics & Metrics2 min read

Define and calculate Weekly Active Users (WAU) for Slack

Tests translating a business metric to a technical spec. Define 'active' by key actions (sending messages, not just opening), then COUNT(DISTINCT user_id) on an events table, filtering out bots and background syncs. A red flag is a generic definition.

When is an A/B test not feasible, and what is DiD?
Analytics & Metrics2 min read

When is an A/B test not feasible, and what is DiD?

This tests your grasp of causal inference when randomization isn't possible. Explain a scenario like a state-level launch, introduce Difference-in-Differences (DiD), and state its core parallel trends assumption.

Analytics & Metrics2 min read

Determine Sample Size for a 2% Lift A/B Test

This tests your grasp of statistical power and the business trade-offs in experimentation. A great answer defines baseline conversion rate, minimum detectable effect (MDE), and statistical power. A red flag is ignoring the business context of MDE.

Analytics & Metrics2 min read

Design a Schema Validation System for Analytics Events

Tests your grasp of data quality engineering, client/server trade-offs, and failure design. A good answer defines a Tracking Plan, enforces it on both client and server, and handles failures by blocking or forwarding with violation flags.