Flutter Quiz
Flutter is Google’s toolkit for building mobile, web and desktop apps from a single Dart codebase. The questions cover widgets, stateless and stateful widgets, layouts, navigation and the basics of Dart.
What this quiz covers
- Widgets and the widget tree
- Stateless vs stateful widgets
- Layouts and navigation
- Dart basics
Study tip: Remember that almost everything in Flutter is a widget; thinking in widget trees makes layout questions easy.
Questions, answers and explanations
1. What is Flutter?
- A Programming Language
- A UI Toolkit
- A Database
- A Web Browser
Answer: A UI Toolkit
Flutter is Google's open-source UI toolkit for building cross-platform applications.
2. Who developed Flutter?
- Microsoft
- Oracle
Answer: Google
Flutter is developed and maintained by Google.
3. Which programming language is used by Flutter?
- Java
- Dart
- Kotlin
- Swift
Answer: Dart
Flutter applications are written using the Dart programming language.
4. Which widget is the root widget of most Flutter apps?
- MaterialApp
- Scaffold
- Container
- Column
Answer: MaterialApp
MaterialApp is commonly used as the root widget in Flutter applications.
5. Which command creates a new Flutter project?
- flutter create
- flutter new
- flutter init
- create flutter
Answer: flutter create
The 'flutter create' command creates a new Flutter project.
6. Which widget is used to arrange children vertically?
- Column
- Row
- Stack
- Container
Answer: Column
The Column widget arranges its children vertically.
7. Which widget is used to arrange children horizontally?
- Row
- Column
- Stack
- Expanded
Answer: Row
The Row widget arranges its children horizontally.
8. Which widget provides the basic Material Design visual layout structure?
- Scaffold
- Container
- Card
- AppBar
Answer: Scaffold
Scaffold provides the basic visual layout structure for Material apps.
9. Which command runs a Flutter application?
- flutter run
- flutter start
- flutter launch
- flutter execute
Answer: flutter run
The 'flutter run' command builds and runs a Flutter application.
10. Flutter is mainly used for developing?
- Cross-platform Apps
- Operating Systems
- Databases
- Games Only
Answer: Cross-platform Apps
Flutter allows developers to build Android, iOS, Web, Windows, macOS, and Linux apps from one codebase.
11. Which widget is used to display text in Flutter?
- Text
- Label
- Paragraph
- Typography
Answer: Text
The Text widget is used to display text on the screen.
12. Which widget is used to display an image?
- Image
- Picture
- Photo
- Icon
Answer: Image
The Image widget displays images from assets, files, or the network.
13. Which widget is used to create a clickable button?
- ElevatedButton
- ButtonView
- ClickButton
- PressButton
Answer: ElevatedButton
ElevatedButton is the standard Material button in Flutter.
14. Which widget allows scrolling when content exceeds the screen size?
- ListView
- Column
- Container
- Expanded
Answer: ListView
ListView provides a scrollable list of widgets.
15. Which method is called when a StatefulWidget is first created?
- initState()
- build()
- dispose()
- start()
Answer: initState()
initState() is called once when the State object is created.
16. Which method rebuilds the UI after state changes?
- setState()
- updateState()
- refresh()
- rebuild()
Answer: setState()
Calling setState() tells Flutter to rebuild the widget.
17. Which widget is used to add padding around another widget?
- Padding
- Margin
- Space
- Container
Answer: Padding
The Padding widget adds empty space around its child.
18. Which widget stacks children on top of each other?
- Stack
- Column
- Row
- ListView
Answer: Stack
The Stack widget overlays its children.
19. Which file contains the dependencies of a Flutter project?
- pubspec.yaml
- flutter.json
- package.json
- config.yaml
Answer: pubspec.yaml
The pubspec.yaml file manages packages and project settings.
20. What is one major advantage of Flutter?
- Single Codebase for Multiple Platforms
- Fast UI Rendering
- Hot Reload
- All of the above
Answer: All of the above
Flutter provides Hot Reload, fast rendering, and one codebase for Android, iOS, Web, Windows, macOS, and Linux.