Flutter Certified Application Developer (AFD-200) — Questions and Answers
Question 1: Which widget adds empty space around its child using padding?
- Align
- Padding (Correct answer)
- Expanded
- Center
Correct answer: Padding
The Padding widget insets its child by the given EdgeInsets.
Question 2: Which Navigator method removes the current route and replaces it with a new one?
- Navigator.push()
- Navigator.pop()
- Navigator.pushReplacement() (Correct answer)
- Navigator.swap()
Correct answer: Navigator.pushReplacement()
Navigator.pushReplacement() replaces the current route with a new one, preventing the user from going back.
Question 3: In the Provider package, which class should you extend to create a simple state object that notifies listeners?
- StateNotifier
- StreamController
- ValueNotifier
- ChangeNotifier (Correct answer)
Correct answer: ChangeNotifier
ChangeNotifier provides the notifyListeners() method that triggers UI rebuilds when state changes.
Question 4: Which widget should you use to avoid rebuilding expensive subtrees when parent state changes?
- RepaintBoundary
- const constructor widgets (Correct answer)
- StatelessWidget
- AnimatedBuilder
Correct answer: const constructor widgets
Marking widgets as const tells the Dart compiler they are immutable, so Flutter can skip rebuilding them when the parent rebuilds.
Question 5: While compiling the application, the Flutter tooling provides _____ modes.
- 2
- 1
- 4
- 3 (Correct answer)
Correct answer: 3
Flutter tooling provides three main compilation modes: `debug`, `profile`, and `release`. The `debug` mode is optimized for fast development with features like hot reload, `profile` mode is used for performance analysis, and `release` mode is fully optimized for deployment, with no debugging information and minimal overhead.
Question 6: Which type of Flutter test runs entirely in the Dart VM without a device and tests a single class or function?
- Integration test
- Unit test (Correct answer)
- Golden test
- Widget test
Correct answer: Unit test
Unit tests run in the Dart VM, testing individual functions or classes in isolation without any Flutter framework involvement.
Question 7: Which method triggers a rebuild after changing state in a StatefulWidget?
- update()
- setState() (Correct answer)
- rebuild()
- notify()
Correct answer: setState()
Calling setState() marks the widget dirty and schedules a rebuild.
Question 8: Which widget should wrap the app to enable Material Design and routing?
- MaterialApp (Correct answer)
- Center
- Scaffold
- Column
Correct answer: MaterialApp
MaterialApp sets up theming, navigation, and Material widgets for the app.
Question 9: What does the Flutter 'hot reload' feature do?
- Recompiles and reinstalls the app from scratch
- Clears the app cache
- Injects updated code into the running app while preserving state (Correct answer)
- Restarts the device
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 10: Flutter is an example of ______.
- None of the above
- Programming Language
- Both
- SDK (Correct answer)
Correct answer: SDK
Flutter is a Software Development Kit (SDK) because it provides a complete set of tools, libraries, and documentation for building cross-platform applications. It includes a rendering engine, pre-built widgets, testing tools, and command-line tools, enabling developers to create mobile, web, and desktop apps from a single codebase.
Question 11: What are Flutter's benefits?
- UI Focused
- All of the above (Correct answer)
- Faster Development
- Cross-platform Development
Correct answer: All of the above
Flutter offers several significant benefits, including a strong focus on UI development with rich, customizable widgets, faster development cycles due to features like hot reload, and robust cross-platform capabilities allowing a single codebase for iOS, Android, web, and desktop applications. All these aspects contribute to its popularity and efficiency.
Question 12: Which widget from the flutter_bloc package rebuilds its subtree when the bloc emits a new state?
- BlocProvider
- BlocListener
- BlocBuilder (Correct answer)
- BlocConsumer
Correct answer: BlocBuilder
BlocBuilder rebuilds its widget tree in response to new states emitted by a Bloc or Cubit.
Question 13: What is tree shaking in the context of a Flutter release build?
- Removing unused widget subtrees at runtime
- Cleaning up the widget tree before hot reload
- Garbage collecting old widget instances
- Eliminating unused Dart code and assets from the compiled binary to reduce app size (Correct answer)
Correct answer: Eliminating unused Dart code and assets from the compiled binary to reduce app size
Tree shaking analyzes the dependency graph at compile time and strips out code that is never referenced, shrinking the final APK/IPA.
Question 14: What is the purpose of the WillPopScope widget?
- To push a route conditionally
- To add a pop animation to a widget
- To intercept and control the back button press before popping the route (Correct answer)
- To style the navigation bar
Correct answer: To intercept and control the back button press before popping the route
WillPopScope intercepts the back navigation gesture or button, allowing you to confirm or prevent the pop.
Question 15: What method must you call inside a StatefulWidget to trigger a UI rebuild when state changes?
- rebuild()
- notifyListeners()
- refresh()
- setState() (Correct answer)
Correct answer: setState()
setState() marks the widget as dirty, causing Flutter to schedule a rebuild on the next frame.
Question 16: Which package is the standard choice for mocking dependencies in Flutter unit and widget tests?
- mocktail
- test_double
- fake_async
- mockito (Correct answer)
Correct answer: mockito
mockito is the widely used Dart mocking library that generates mock classes via code generation with @GenerateMocks.
Question 17: Which matcher verifies that exactly one matching widget exists in the widget tree?
- matchesWidget
- findsOneWidget (Correct answer)
- findsAny
- findsWidgets
Correct answer: findsOneWidget
findsOneWidget asserts that exactly one widget matching the finder exists in the widget tree.
Question 18: What is the key difference between StatelessWidget and StatefulWidget?
- StatefulWidget can rebuild when its mutable state changes (Correct answer)
- StatelessWidget cannot have children
- StatelessWidget renders faster always
- StatefulWidget cannot use build()
Correct answer: StatefulWidget can rebuild when its mutable state changes
StatefulWidget holds mutable state and rebuilds via setState, while StatelessWidget is immutable.
Question 19: What does Navigator.pop() do?
- Closes the app
- Removes the current route and returns to the previous screen (Correct answer)
- Pushes a new screen
- Refreshes the current screen
Correct answer: Removes the current route and returns to the previous screen
pop() removes the top route, revealing the screen beneath it.
Question 20: What is the integration_test package used for in Flutter?
- Writing end-to-end tests that run on a real device and integrate with Firebase Test Lab (Correct answer)
- Running unit tests in parallel
- Testing animations frame by frame
- Mocking platform channels
Correct answer: Writing end-to-end tests that run on a real device and integrate with Firebase Test Lab
integration_test enables full-app end-to-end testing on real devices or emulators and integrates with cloud test services like Firebase Test Lab.
Question 21: Which Flutter rendering concept describes the lightweight description of the widget hierarchy used to diff changes?
- Widget tree (Correct answer)
- Element tree
- Layer tree
- Render tree
Correct answer: Widget tree
The widget tree is Flutter's immutable, lightweight description of the UI; Flutter diffs it against the element tree to efficiently update only changed parts.
Question 22: Which method on AnimationController plays the animation in reverse from its current value to lowerBound?
- controller.reverse() (Correct answer)
- controller.reset()
- controller.forward()
- controller.stop()
Correct answer: controller.reverse()
controller.reverse() drives the animation value from its current position back toward lowerBound (typically 0.0), playing the animation backwards.
Question 23: Why are StatelessWidgets considered immutable?
- They have no build method
- They cannot be drawn on screen
- They cannot accept parameters
- Their fields are final and cannot change after construction (Correct answer)
Correct answer: Their fields are final and cannot change after construction
StatelessWidget properties are final, so the widget itself never changes.
Question 24: Which widget overlaps children, positioning them relative to its box edges?
- Flex
- Row
- Stack (Correct answer)
- Column
Correct answer: Stack
Stack overlays children and uses Positioned for precise placement.
Question 25: Which package provides a Redux-like state management solution for Flutter with strict unidirectional data flow?
- provider
- redux (Correct answer)
- mobx
- get
Correct answer: redux
The redux package implements the Redux pattern with a single store, reducers, and actions.
Question 26: How can you pass data to the next screen when using Navigator.push()?
- Via the route's constructor arguments in MaterialPageRoute's builder (Correct answer)
- Via a static class method
- Via SharedPreferences
- Via a global variable
Correct answer: Via the route's constructor arguments in MaterialPageRoute's builder
Pass data by constructing the destination widget with parameters inside the builder callback of MaterialPageRoute.
Question 27: Which widget creates a scrollable list of widgets that are all constructed at once?
- GridView
- ListView.builder
- SingleChildScrollView
- ListView (Correct answer)
Correct answer: ListView
ListView (without a builder) constructs all its children eagerly and wraps them in a scrollable container.
Question 28: Which widget provides a basic visual layout structure with app bar, body, and floating button?
- Column
- MaterialApp
- SafeArea
- Scaffold (Correct answer)
Correct answer: Scaffold
Scaffold implements the basic Material visual layout structure.
Question 29: Which Flutter test type runs the full app on a real device or emulator to test end-to-end flows?
- Unit test
- Integration test (Correct answer)
- Widget test
- Golden test
Correct answer: Integration test
Integration tests run the full app and use the flutter_test or integration_test package to simulate user interactions end-to-end.
Question 30: Which widget provides a bottom navigation bar for switching between top-level app destinations?
- Drawer
- TabBar
- BottomNavigationBar (Correct answer)
- NavigationRail
Correct answer: BottomNavigationBar
BottomNavigationBar displays icons and labels at the bottom of the screen for switching between top-level views.
Question 31: Which widget arranges its children horizontally?
- Column
- Center
- Row (Correct answer)
- ListView
Correct answer: Row
Row lays out its children along the horizontal axis.
Question 32: Which package is commonly used for declarative, URL-based routing in Flutter?
- go_router (Correct answer)
- provider
- dio
- http
Correct answer: go_router
go_router provides declarative, deep-link-friendly routing.
Question 33: What is the purpose of setUp() in Flutter tests?
- It runs code before each test case to initialize shared state (Correct answer)
- It registers a teardown hook
- It defines the widget under test
- It mounts the widget tree
Correct answer: It runs code before each test case to initialize shared state
setUp() runs its callback before every individual test case, making it suitable for initializing mocks or resetting state.
Question 34: Why are most Flutter widgets immutable?
- To avoid using state
- To save memory only
- So the framework can efficiently rebuild and diff the tree (Correct answer)
- Because Dart forbids mutation
Correct answer: So the framework can efficiently rebuild and diff the tree
Immutable widgets let Flutter cheaply rebuild and reconcile the widget tree.
Question 35: How does Flutter's Hero animation work between two routes?
- It shares a tagged widget and flies it between the source and destination screens (Correct answer)
- It copies the widget and fades between copies
- It relies on AnimationController.repeat()
- It uses a PageRouteBuilder with a custom transition
Correct answer: It shares a tagged widget and flies it between the source and destination screens
Hero matches widgets with the same tag across routes and animates the shared element from its position on the source page to its position on the destination page.
Question 36: Which method do you use to find a widget by its type in a Flutter widget test?
- find.byType() (Correct answer)
- find.byKey()
- find.text()
- find.byWidget()
Correct answer: find.byType()
find.byType() locates widgets of a specified type in the widget tree during a test.
Question 37: Which widget allows you to position children at arbitrary locations within a parent?
- Column
- Wrap
- Row
- Stack (Correct answer)
Correct answer: Stack
Stack layers its children on top of each other, and Positioned can be used to place them at specific coordinates.
Question 38: In Provider, what does MultiProvider do?
- Merges multiple ChangeNotifiers into one
- Allows nesting several providers without deeply nesting the widget tree (Correct answer)
- Provides a single provider to multiple widgets
- Listens to multiple streams simultaneously
Correct answer: Allows nesting several providers without deeply nesting the widget tree
MultiProvider accepts a list of providers and composes them, avoiding deeply nested widget code.
Question 39: What does the expect() function do in a Flutter test?
- It registers a test case
- It navigates to the next screen in a test
- It pumps the widget tree
- It asserts that the actual value matches the matcher (Correct answer)
Correct answer: It asserts that the actual value matches the matcher
expect() compares an actual value against a matcher (like equals(), isTrue, findsOneWidget) and fails the test if they don't match.
Question 40: What does Navigator.pushAndRemoveUntil() do?
- Pushes a route and schedules a pop after a delay
- Pushes a route and removes all routes from the stack up to a predicate condition (Correct answer)
- Replaces the entire route stack with a single route
- Pushes a route and removes only the current route
Correct answer: Pushes a route and removes all routes from the stack up to a predicate condition
pushAndRemoveUntil pushes a new route and removes all routes below it until the predicate returns true.
Question 41: What does the hot reload feature do?
- Injects updated code into the running Dart VM, preserving state (Correct answer)
- Rebuilds and reinstalls the entire app
- Compiles the app to native ahead of time
- Clears all app state and restarts
Correct answer: Injects updated code into the running Dart VM, preserving state
Hot reload injects updated source into the running VM while keeping app state.
Question 42: How do you simulate a user tapping a widget in a Flutter widget test?
- tester.click()
- tester.touch()
- tester.press()
- tester.tap() (Correct answer)
Correct answer: tester.tap()
WidgetTester.tap() simulates a touch at the center of the widget found by a Finder.
Question 43: Which package repository hosts Dart and Flutter packages?
- npm
- Maven Central
- pub.dev (Correct answer)
- CocoaPods
Correct answer: pub.dev
pub.dev is the official package repository for Dart and Flutter.
Question 44: How does Navigator 2.0 differ from Navigator 1.0 in Flutter?
- Navigator 2.0 only works on web
- Navigator 2.0 is declarative and uses a pages list, enabling URL-driven navigation (Correct answer)
- Navigator 2.0 removes named routes
- Navigator 2.0 uses a Stack widget instead of Navigator
Correct answer: Navigator 2.0 is declarative and uses a pages list, enabling URL-driven navigation
Navigator 2.0 uses a declarative pages list driven by app state, making back-stack management and deep linking explicit.
Question 45: Google developed the _____ Flutter framework for building mobile apps.
- Both
- Open-source (Correct answer)
- Shareware
- None of the above
Correct answer: Open-source
Flutter is an open-source UI software development kit created by Google. Being open-source means its source code is publicly available, allowing anyone to inspect, modify, and contribute to its development, fostering a large and active community around the framework.
Flutter Certified Application Developer (AFD-200)
The AFD-200 certifies developers on building cross-platform mobile applications using Google's Flutter framework and Dart programming language, covering widgets, navigation, state management, Firebase integration, and app publishing.
Exam Rules
- You can skip questions and return to them later
- Flag questions for review before submitting
- No feedback shown until you submit the entire exam
- Unanswered questions count as wrong — answer everything
- 10 pretest questions are mixed in and don't affect your score
- Timer auto-submits when time runs out
- Your progress is auto-saved every 30 seconds