Sample questions
Fl Flutter Rendering Widget TreeDifficulty 1
In Flutter, what are the three trees the framework maintains to render UI?
- aWidget, Element, and RenderObject.✓
- bWidget, Layer, and Canvas trees.
- cView, ViewModel, and Model trees.
- dWidget, Fragment, and Activity trees.
Explanation:Flutter maintains three parallel trees: the immutable Widget tree (configuration), the Element tree (mutable, persists across rebuilds, manages lifecycle), and the RenderObject tree (layout and painting).
Fl Flutter Rendering Widget TreeDifficulty 1
What best describes a Widget in Flutter?
- aAn immutable configuration object describing part of the UI.✓
- bA mutable object that directly draws pixels to the screen.
- cA native platform view wrapped for Dart.
- dA persistent object that survives across the whole app lifetime by default.
Explanation:A Widget is an immutable, lightweight description of what a piece of UI should look like; it is cheap to create and discard on every build.
Fl Flutter Rendering Widget TreeDifficulty 1
What is the main role of an Element in Flutter's rendering model?
- aIt stores only visual styling like colors and fonts.
- bIt replaces the RenderObject for simple widgets.
- cIt is the mutable instance that manages a widget's lifecycle.✓
- dIt is generated only for StatelessWidget, never for StatefulWidget.
Explanation:An Element is the mutable, long-lived instance created from a Widget; it holds the State (for stateful widgets), manages lifecycle, and references the associated RenderObject.
Fl Flutter Rendering Widget TreeDifficulty 1
What is a RenderObject primarily responsible for?
- aPerforming layout and painting.✓
- bManaging the widget's State object.
- cHandling only user input events.
- dStoring the widget's constructor parameters.
Explanation:A RenderObject is the part of the tree that actually knows how to lay itself out (given constraints) and paint pixels; it is the layer closest to the actual rendering.
Fl Flutter Rendering Widget TreeDifficulty 1
Why are widgets in Flutter often described as "cheap"?
- aBecause they are compiled directly to native platform views.
- bBecause only one widget instance ever exists for the entire app.
- cBecause they are lightweight, immutable objects.✓
- dBecause they never need to be rebuilt once created.
Explanation:Widgets are just plain Dart objects describing configuration; creating a new tree of them on every build is intentionally inexpensive compared to touching the RenderObject or platform layer.
Fl Flutter Rendering Widget TreeDifficulty 2
What generally causes a widget's build() method to be called again?
- asetState(), a changed InheritedWidget dependency, or a parent rebuild.✓
- bThe operating system redrawing the screen at a fixed 60Hz regardless of app state.
- cEvery RenderObject repaint automatically re-invokes every ancestor's build().
- dOnly when the app is hot-reloaded during development.
Explanation:build() re-runs when the framework marks the corresponding Element dirty: typically setState() in a State, a changed value from a subscribed InheritedWidget, or the parent producing a new widget configuration for that slot.