Intermediate interview questions in Mobile Dev, page 10

Explain Hilt scoping: @Singleton vs @ActivityRetainedScoped
Tests Hilt component lifecycles. Answer: @Singleton lives for the app process; @ActivityRetainedScoped survives config changes via ActivityRetainedComponent but dies when the activity finishes.
useMemo and useCallback for stable references
UseMemo caches a computed value, useCallback caches a function identity across renders; both prevent recompute and unnecessary re-renders of memoized children.
In a CustomPainter, what is the purpose of the shouldRepaint method?
This tests Flutter repaint optimization. Answer: shouldRepaint compares old and new delegates, returning true only when visual properties differ so the framework skips paint calls. A red flag is returning true unconditionally, forcing useless repaints.

How do you inject two different OkHttpClient instances with Hilt?
Tests Hilt qualifiers for same-type bindings. Answer: define a custom @Qualifier (or @Named), annotate two @Provides methods and the injection site. Red flag: manual client creation or subclassing OkHttpClient instead of qualifying the binding.
What is Hermes and its advantages over JSC?
Hermes is an open-source engine optimized for RN, with faster startup via precompiled bytecode and lower memory use.
Unit test a ViewModel with a mocked NetworkService
Inject the protocol, supply a mock returning canned data, assert published state transitions.

Functional difference between @Binds and @Provides in Hilt
Tests if you understand Hilt code generation tradeoffs. @Binds wires an existing injectable implementation to an interface with less overhead; @Provides constructs instances manually.
How would you draw a line graph using Canvas and Path?
Use moveTo for the first point, lineTo for the rest, then Canvas.drawPath with a stroke Paint.
Which two Flipper plugins diagnose an unresponsive UI?
Use the React DevTools profiler to find expensive renders and the Performance/Hermes plugin to spot a blocked JS thread or low FPS.
Testing async code and completion handlers in XCTest
Create an expectation, fulfill it inside the completion handler, call wait with a timeout, or use async test methods.

How would you access a Hilt dependency in a non-injectable ContentProvider?
Tests Hilt's escape hatch for framework classes. Strong answer: define an EntryPoint in SingletonComponent, expose the dependency, and retrieve it with EntryPointAccessors.fromApplication. Red flag: field injection or manual static singletons.
What is bridge traffic and what causes dropped frames?
The bridge passes batched, serialized JSON messages between JS and native asynchronously; high-frequency events flood it.
Locating XCUITest elements without accessibility identifiers
Query by type, label, predicate, or index; chain queries to narrow scope.
Code coverage and its pitfalls
It measures executed lines, surfaces untested paths, and guides where to add tests.
MethodChannel data flow and type marshalling
Dart invokeMethod sends a StandardMessageCodec-serialized payload to native, which returns a primitive or map; complex objects must be reduced to supported types.
What data types cross the bridge, and their limits?
Only JSON-serializable types cross — strings, numbers, booleans, null, arrays, maps; functions and native object handles cannot. Handle complex data via ids, base64, or JSI host objects.
When to choose EventChannel over MethodChannel and native setup
It tests streaming versus one-shot platform communication. Pick EventChannel for ongoing native events like sensor data; register a StreamHandler on Android or iOS that feeds an event sink, then consume in Dart via receiveBroadcastStream.

Explain Structured Concurrency in Kotlin Coroutines
Structured concurrency binds coroutines to a scope; parent cancellation propagates to all children, preventing leaks.
Modularizing a monolithic iOS app
Extract low-dependency, high-reuse leaf code first behind clear interfaces, enforce boundaries, iterate inward.
What is a Platform View and why is it crucial?
Tests embedding native UI when Flutter widgets fall short. Strong answers define Platform Views as native embeddings, cite maps or WebView, and contrast Hybrid Composition's native hierarchy with Virtual Display's texture rasterization.
We are hiring for this. Every open role lists the topics its interview covers, so you can prepare for the real thing rather than guessing.
See open roles