Quiz: Flutter
Flutter questions from real interviews as a quiz, with an explanation for every option.
Try it: 5 questions
Loading…
Sample questions
What is the Semantics Tree used for in Flutter?
- To store and restore widget state when the UI rebuilds
- To expose the structure and meaning of UI elements to assistive technologies
- To determine the order in which widgets are painted on top of one another
- To associate widgets with the app's navigation routes
Here, R means a function’s return value. How does it differ from an exception in Dart?
- R and exceptions both stop the function, but they are handled using different variable types.
- R is used only for successful results, while exceptions are used only for compile-time errors.
- R automatically transfers control to
catch, while an exception is returned to the caller as a normal value. - R is returned as a normal result, while an exception interrupts the normal flow and transfers control to a handler.
Which three Flutter tools or features directly help profile and observe an app’s performance?
- Flutter DevTools, including Performance View and CPU Profiler
- Widget Inspector for measuring function execution time
- Performance Overlay, which displays frame-rendering metrics
- Custom events added with the
TimelineAPI - Debug mode as the primary mode for benchmarking
Which statements about the
Containerwidget and its properties are correct? Select all that apply.transformaffects only the child widget, not the container.alignmentpositions theContaineritself relative to its parent.Containercan add styling and spacing around a child widget.decorationsupports richer styling, butcolorcannot be set separately alongside it.paddingsets inner spacing, whilemarginsets outer spacing.
When is it appropriate to use
constin Dart/Flutter?- When the variable should receive its value only on first access
- When the value is known at compile time and does not need to change
- When the object needs to be modified after it is created
- When the value is computed each time the app runs
Which statements correctly describe generations in Dart garbage collection?
- Dart has an explicit Permanent Generation for metadata.
- The young generation holds recently created objects and is usually collected frequently.
- The old generation is collected more often than the young generation because it contains more objects.
- Objects that survive several young-generation collections may be promoted to the old generation.
- All objects start in the old generation and may later move to the young generation.
How are REST requests typically handled in Flutter?
- Receive ready-made Dart objects because Flutter sends the request and converts JSON automatically.
- Use
dart:convertto send the HTTP request and treat any received response as successful. - Add
httpordio, make the request asynchronously, check the response, and handle JSON and errors. - Make the request synchronously on the main isolate and parse the response manually.
Why would you override
dispose()in a FlutterStateclass?- To preserve the widget's state across recreations and restore it later.
- To manually remove the widget from the tree and trigger its rebuild.
- To run background cleanup after every widget rebuild.
- To release resources not managed by the garbage collector, such as controllers and subscriptions.
Which description of a service locator in Flutter is the most accurate?
- A factory that must create a new service instance on every request.
- A state store that rebuilds widgets when its data changes.
- A mechanism that automatically passes dependencies into an object through its constructor.
- A central registry where services are registered and then retrieved on request, for example by type.
Which statement best describes an Isolate in Dart/Flutter?
- An asynchronous waiting mechanism that runs tasks in the same UI Isolate.
- An independent unit of execution with its own memory that communicates through ports.
- A thread that directly accesses memory shared with other threads.
- A Flutter component responsible for building and displaying widgets.