Logo
교실
quiz thumbnail
Ikut Turutan
Lain
Sains

Stateless vs Statefull Widgets

Rehman Ullah K

0

Kuiz dicipta dengan peta premium

10 soalan

Tunjuk jawapan

Allow incorrect answer

Tunjuk jawapan bila salah

public kuiz

Bahan pembelajaran

Fail
Paparan dibenarkan semasa kuiz
Stateless-vs-Stateful-Widgets-in-Flutter.pdf
# 1Pelbagai pilihan
What is a key characteristic of stateless widgets in Flutter?

Semua jawapan sedang disembunyikan.

They maintain their own state
They are immutable
They require a State class
They rebuild when state changes
# 2Pelbagai pilihan
In which scenario should you use a stateful widget?
When displaying static text
When data is managed by its parent
When the UI needs to change dynamically
When displaying a non-interactive image
# 3Pelbagai pilihan
What method do you override to create the UI in a StatelessWidget?
build()
setState()
createState()
initState()
# 4Pelbagai pilihan
Which method is used in a StatefulWidget to update the UI based on state changes?
build()
setState()
createState()
dispose()
# 5Pelbagai pilihan
What is a benefit of using stateless widgets?
Complex implementation
Better performance for static content
Requires managing state
Rebuilds frequently
# 6Pelbagai pilihan
What are the two classes involved in implementing a StatefulWidget?
Widget and State
StatelessWidget and StatefulWidget
State and ImmutableState
Widget and BuildContext
# 7Pelbagai pilihan
How does a StatelessWidget handle updates when data changes?
It updates only the changed state
It rebuilds completely
It uses setState()
It does not update
# 8Pelbagai pilihan
Which of the following is not a use case for a stateless widget?
Displaying a fixed icon
Showing a constant text
Handling a dynamic list
Displaying a non-interactive image
# 9Pelbagai pilihan
When should you choose a stateless widget over a stateful widget?
When the UI needs to change dynamically
When internal state management is needed
When performance optimization is important
When handling user interactions
# 10Pelbagai pilihan
What is the role of the State class in a StatefulWidget?
To render UI elements
To manage mutable state
To implement the build method
To dispose of the widget
Google Classroom Share

Kuiz ini dicipta guna peta premium. Akses disekat kerana pelan tamat tempoh.