Google Flutter Basics 2 — Questions and Answers
Question 1: Which programming language is used to write Flutter applications?
- Dart (Correct answer)
- Kotlin
- Swift
- JavaScript
Correct answer: Dart
Flutter apps are written in Dart, a language developed by Google.
Question 2: What is the basic building block of a Flutter UI?
- Widget (Correct answer)
- Activity
- Fragment
- Component
Correct answer: Widget
Everything in Flutter's UI is a widget, from layout to styling.
Question 3: Which command creates a new Flutter project?
- flutter create my_app (Correct answer)
- flutter new my_app
- flutter init my_app
- dart create my_app
Correct answer: flutter create my_app
The 'flutter create' command scaffolds a new Flutter project.
Question 4: Which file declares a Flutter project's dependencies?
- pubspec.yaml (Correct answer)
- package.json
- build.gradle
- Podfile
Correct answer: pubspec.yaml
Dependencies and assets are declared in pubspec.yaml.
Question 5: What does the Flutter 'hot reload' feature do?
- Injects updated code into the running app while preserving state (Correct answer)
- Restarts the device
- Recompiles and reinstalls the app from scratch
- Clears the app cache
Correct answer: Injects updated code into the running app while preserving state
Hot reload injects code changes into the running Dart VM while keeping app state.
Question 6: Which function is the entry point of a Flutter application?
- main() (Correct answer)
- runApp()
- build()
- start()
Correct answer: main()
Every Dart program, including Flutter apps, begins execution at main().
Question 7: Which method inside runApp() launches the widget tree?
- runApp(Widget app) (Correct answer)
- render(Widget app)
- launch(Widget app)
- mount(Widget app)
Correct answer: runApp(Widget app)
runApp() takes the root widget and attaches it to the screen.
Which programming language is used to write Flutter applications?