


























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The PrepIQ AFD 200 Flutter Certified Application Developer Ultimate Exam is a comprehensive preparation resource for developers seeking certification in Flutter app development. This ultimate exam covers Dart programming, UI design, widget architecture, state management, API integration, testing, and deployment. Learners gain the skills needed to build cross-platform mobile applications efficiently. Ideal for aspiring and experienced developers, this resource supports certification and practical coding expertise.
Typology: Exams
1 / 66
This page cannot be seen from the preview
Don't miss anything!



























































Question 1. Which keyword is used to declare a compile-time constant that cannot be reassigned, but whose value is determined at runtime? A) final B) const C) static D) immutable Answer: A Explanation: final creates a runtime constant; the value is set once and cannot be changed after it is assigned. const requires the value to be known at compile time. Question 2. In Dart, what does the late keyword indicate? A) The variable is nullable. B) The variable will be initialized lazily. C) The variable is a compile-time constant. D) The variable is static. Answer: B Explanation: late defers initialization of a non-nullable variable until it is first read, allowing for lazy initialization while still guaranteeing non-nullability. Question 3. Which of the following collection types does not allow duplicate elements? A) List B) Set C) Map D) Queue Answer: B Explanation: A Set enforces uniqueness of its elements; attempting to add a duplicate has no effect. Question 4. How do you create an immutable map literal in Dart? A) Map myMap = {}; B) final myMap = const {}; C) var myMap = {}; D) Map myMap = const {}; Answer: D Explanation: Adding const before the map literal makes the map and its contents immutable at compile time. Question 5. Which constructor type is used when you want to return an existing instance instead of creating a new one? A) Default constructor B) Named constructor C) Factory constructor D) Redirecting constructor Answer: C
Explanation: A factory constructor can return a cached instance or any other object, not necessarily a new instance of the class. Question 6. In Dart, which keyword is used to indicate that a class cannot be subclassed? A) abstract B) sealed C) final D) static Answer: C Explanation: Declaring a class as final prevents other classes from extending it. Question 7. What is the purpose of a mixin in Dart? A) To enforce a contract like an interface B) To provide multiple inheritance of implementation C) To create a singleton D) To generate code at build time Answer: B Explanation: Mixins allow a class to reuse code from multiple sources without forming a traditional inheritance hierarchy. Question 8. Which null-aware operator returns the left operand if it is non-null, otherwise evaluates and returns the right operand? A) ?? B) ?. C) ! D) ??= Answer: A Explanation: The ?? operator provides a fallback value when the left side is null. Question 9. Which of the following is a higher-order function in Dart? A) int add(int a, int b) => a + b; B) list.map((e) => e * 2); C) String toUpper(String s) => s.toUpperCase(); D) void printHello() => print('Hello'); Answer: B Explanation: map takes a function as an argument and returns a new iterable, making it a higher-order function. Question 10. How can you add a method to an existing class without modifying its source code? A) Using a static method B) Using an extension method C) Using inheritance D) Using a mixin
Question 15. When is didUpdateWidget invoked? A) After initState B) When the widget’s configuration changes but the state object remains the same C) When the widget is removed from the tree D) Before build is called for the first time Answer: B Explanation: didUpdateWidget is called when the parent rebuilds and provides a new widget instance to the existing state. Question 16. Which layout widget allows children to be positioned relative to each other using a stack of layers? A) Row B) Column C) Stack D) ListView Answer: C Explanation: Stack places its children on top of each other, allowing absolute positioning via Positioned. Question 17. How does Expanded differ from Flexible? A) Expanded forces the child to fill the remaining space, while Flexible can shrink if needed B) Flexible forces the child to fill the remaining space, while Expanded can shrink C) Both behave identically D) Expanded only works in Row, Flexible only in Column Answer: A Explanation: Expanded is a Flexible with fit: FlexFit.tight, making the child occupy all remaining space; Flexible defaults to FlexFit.loose. Question 18. Which constraint rule best describes Flutter’s layout protocol? A) Parent provides size, child decides position B) Parent provides constraints, child decides its own size within them, then parent positions the child C) Child provides constraints, parent decides size D) Constraints are ignored during layout Answer: B Explanation: Constraints flow down, sizes flow up, and the parent finally positions the child.
Question 19. Which widget is best suited for creating a scrollable list of homogeneous items that are lazily built? A) ListView with children B) ListView.builder C) Column inside a SingleChildScrollView D) GridView.count Answer: B Explanation: ListView.builder creates items on demand, improving performance for long lists. Question 20. What is the purpose of SliverAppBar in a CustomScrollView? A) To provide a fixed-height app bar B) To create a collapsible, scroll-aware app bar C) To replace the Scaffold widget D) To handle navigation between routes Answer: B Explanation: SliverAppBar integrates with slivers to expand, collapse, or float based on scroll offset. Question 21. Which widget provides the current screen dimensions and orientation? A) LayoutBuilder B) MediaQuery C) InheritedWidget D) Builder Answer: B Explanation: MediaQuery.of(context) gives access to size, orientation, pixel density, and other device metrics. Question 22. Which widget is used to create platform-specific UI that mimics iOS design? A) MaterialApp B) CupertinoApp C) Scaffold D) Theme Answer: B Explanation: CupertinoApp and its widget library provide iOS-style components. Question 23. How do you retrieve the current text value from a TextField without using a Form? A) controller.text B) onChanged callback only C) value property D) TextField.value Answer: A
Question 28. In the Provider package, which class should you extend to expose mutable state that notifies listeners? A) InheritedWidget B) ChangeNotifier C) ValueNotifier D) StreamProvider Answer: B Explanation: ChangeNotifier provides notifyListeners() which Provider listens to and rebuilds dependent widgets. Question 29. Which BLoC component is responsible for receiving events from the UI? A) Sink B) Stream C) BlocProvider D) BlocBuilder Answer: A Explanation: In BLoC, UI adds events to a Sink; the BLoC processes them and emits new states via a Stream. Question 30. What is the primary advantage of using Riverpod over Provider? A) It eliminates the need for a BuildContext to read providers B) It is built into the Flutter SDK C) It uses XML for configuration D) It only works with Redux Answer: A Explanation: Riverpod decouples provider access from BuildContext, allowing more flexible usage (e.g., in non-widget code). Question 31. Which of the following is a ValueNotifier-based widget that rebuilds when the value changes? A) AnimatedBuilder B) ValueListenableBuilder C) StreamBuilder D) FutureBuilder Answer: B Explanation: ValueListenableBuilder listens to a ValueListenable (such as ValueNotifier) and rebuilds when its value updates. Question 32. How do you declare a named route in MaterialApp? A) routes: {'/home': (context) => HomeScreen()}, B) namedRoutes: {'home': HomeScreen()}, C) routeTable: {'/home': HomeScreen()}, D) navigatorRoutes: {'/home': HomeScreen()},
Answer: A Explanation: The routes map in MaterialApp defines string keys mapped to builder functions for named navigation. Question 33. Which Navigator API is designed for declarative, URL-driven navigation? A) Navigator.push B) Navigator.pop C) Navigator 2.0 (Router) D) Navigator.pushNamed Answer: C Explanation: Navigator 2.0 introduces a Router widget and a declarative API suitable for deep linking and web URLs. Question 34. To pass data to a route using Navigator 1.0, which method is commonly used? A) Navigator.push(context, MaterialPageRoute(builder: (_) => Details(item: item))) B) Navigator.pushNamed(context, '/details') without arguments C) Navigator.of(context).pushAndRemoveUntil D) Navigator.pop(context, item) Answer: A Explanation: By supplying a custom MaterialPageRoute, you can pass arguments directly through the constructor. Question 35. Which pubspec.yaml field specifies the minimum Dart SDK version required? A) environment: B) dependencies: C) flutter: D) dev_dependencies: Answer: A Explanation: Under environment, you set sdk: ">=2.19.0 <3.0.0" to enforce the Dart SDK range. Question 36. How do you include a custom font in a Flutter app? A) Add the font file to assets/ and list it under fonts: in pubspec.yaml B) Place the font in lib/ and import it C) Use FontLoader at runtime only D) No special configuration required Answer: A Explanation: The font file must be referenced in the fonts section of pubspec.yaml so that Flutter bundles it.
Explanation: Isolates run in separate memory spaces on their own threads, preventing UI jank. Question 42. Which widget animates its child’s opacity over a given duration? A) AnimatedContainer B) AnimatedOpacity C) FadeTransition D) Opacity Answer: B Explanation: AnimatedOpacity smoothly transitions the opacity value when it changes. Question 43. What is the role of an AnimationController? A) It defines the start and end values of an animation B) It drives the animation’s ticker and provides status callbacks C) It builds UI based on animation values D) It replaces the need for Tween Answer: B Explanation: AnimationController manages the animation’s timeline, drives the ticker, and notifies listeners of status changes. Question 44. Which widget is used to create a shared-element transition between two routes? A) PageRouteBuilder B) Hero C) AnimatedSwitcher D) TransitionBuilder Answer: B Explanation: Hero tags matching widgets on source and destination routes, animating them seamlessly. Question 45. In widget testing, what does the pumpAndSettle method do? A) Renders the widget once B) Waits for all scheduled animations and frames to complete C) Immediately fails the test D) Clears the widget tree Answer: B Explanation: pumpAndSettle repeatedly pumps frames until there are no pending post-frame callbacks, ensuring animations finish.
Question 46. Which DevTools feature highlights which widgets repaint on each frame? A) Timeline B) Memory C) Paint Rainbow D) CPU Profiler Answer: C Explanation: The Paint Rainbow overlay colors widgets based on how frequently they repaint. Question 47. Which build mode provides the most accurate performance profile while still enabling some debugging features? A) Debug B) Profile C) Release D) Test Answer: B Explanation: Profile mode disables debugging aids like asserts but retains profiling instrumentation. Question 48. How can you reduce widget rebuilds by leveraging compile-time constants? A) Use final instead of const B) Mark immutable widgets with const constructors C) Avoid StatelessWidget D) Wrap widgets in FutureBuilder Answer: B Explanation: const widgets are canonicalized at compile time, preventing unnecessary rebuilds when the parent rebuilds. Question 49. Which channel type is used to send a continuous stream of data from platform to Flutter? A) MethodChannel B) EventChannel C) BasicMessageChannel D) PlatformChannel Answer: B Explanation: EventChannel is designed for asynchronous event streams (e.g., sensor data) from native code to Dart. Question 50. When building an Android AAB, which Gradle task should you run? A) flutter build apk B) flutter build appbundle C) flutter build ios D) flutter build web
A) FlexFit.tight B) FlexFit.loose C) FlexFit.none D) FlexFit.expand Answer: B Explanation: Flexible defaults to FlexFit.loose, allowing the child to occupy only the space it needs. Question 56. Which widget provides a scrollable area that lazily builds its children as they become visible, using a custom delegate? A) ListView.builder B) CustomScrollView with SliverList C) SingleChildScrollView D) GridView.count Answer: B Explanation: CustomScrollView combined with SliverList (or SliverGrid) uses a delegate to lazily create children. Question 57. Which gesture recognizer would you use to detect a double-tap? A) TapGestureRecognizer B) DoubleTapGestureRecognizer C) LongPressGestureRecognizer D) PanGestureRecognizer Answer: B Explanation: DoubleTapGestureRecognizer specifically listens for double-tap sequences. Question 58. In Provider, what does the listen: false parameter do when calling Provider.of(context, listen: false)? A) It disables the provider entirely B) It prevents the widget from rebuilding when the provider notifies listeners C) It forces an immediate rebuild D) It throws an exception Answer: B Explanation: Setting listen: false retrieves the value without establishing a dependency, so the widget won’t rebuild on changes. Question 59. Which of the following is a correct way to expose a Stream to the UI using BLoC? A) StreamBuilder(stream: bloc.stateStream, builder: ...) B) FutureBuilder(future: bloc.stateFuture, ...) C) ValueListenableBuilder(valueListenable: bloc.state, ...) D) AnimatedBuilder(animation: bloc.state, ...)
Answer: A Explanation: StreamBuilder listens to a Stream and rebuilds when new data arrives, fitting the BLoC pattern. Question 60. Which method of SharedPreferences is used to store a boolean value? A) setBool B) putBool C) writeBool D) saveBool Answer: A Explanation: SharedPreferences.setBool(String key, bool value) persists a boolean. Question 61. What does the await keyword do inside an async function? A) Blocks the thread until the Future completes B) Pauses the async function, allowing other code to run, and resumes when the Future completes C) Converts a Future into a Stream D) Starts a new isolate Answer: B Explanation: await yields execution back to the event loop, letting other async work proceed while waiting. Question 62. Which class is used to read and write files in the app’s documents directory? A) File from dart:io B) AssetBundle C) NetworkImage D) HttpClient Answer: A Explanation: File provides methods like readAsString and writeAsBytes; combined with path_provider you obtain the directory path. Question 63. Which widget animates the transition between two children when the child changes? A) AnimatedSwitcher B) AnimatedCrossFade C) AnimatedContainer D) AnimatedOpacity Answer: A Explanation: AnimatedSwitcher fades out the old child and fades in the new one, handling size changes gracefully.
Answer: B Explanation: debugPrint splits long strings into chunks to prevent truncation in the IDE console. Question 69. Which of the following is a correct way to declare a generic class in Dart? A) class Box { T value; } B) class Box { T value; } C) class Box { T value; } D) Both A and C Answer: D Explanation: Both syntaxes are valid; T can be constrained with extends if desired. Question 70. In a CustomPainter, which method must you override to define the painting logic? A) paint(Canvas canvas, Size size) B) draw(Canvas canvas) C) render(Canvas canvas, Size size) D) onDraw(Canvas canvas) Answer: A Explanation: CustomPainter.paint receives a Canvas and the size of the area to draw. Question 71. Which widget can be used to make part of a UI scrollable while keeping other parts fixed? A) SingleChildScrollView B) NestedScrollView C) ListView D) ScrollConfiguration Answer: B Explanation: NestedScrollView coordinates a scrolling header (e.g., SliverAppBar) with a body that scrolls independently. Question 72. Which method of Navigator removes all routes until a predicate returns true, then pushes a new route? A) pushAndRemoveUntil B) popUntil C) pushReplacement D) popAndPushNamed Answer: A Explanation: pushAndRemoveUntil pushes a new route and removes previous ones based on the provided predicate.
Question 73. When should you use const before a widget constructor inside a build method? A) Only for StatefulWidgets B) When the widget and all its descendants are immutable and have constant parameters C) Never; const is only allowed at the top level D) Only for MaterialApp Answer: B Explanation: Using const eliminates rebuild work for widgets that never change, improving performance. Question 74. Which of the following is the correct way to listen to a Stream without rebuilding the UI? A) StreamBuilder B) await for inside initState C) listen on the stream and call setState D) FutureBuilder Answer: B Explanation: Using await for (or stream.listen) inside initState processes events without triggering widget rebuilds; you can handle side-effects manually. Question 75. Which of the following is NOT a built-in Flutter animation widget? A) AnimatedContainer B) AnimatedPositioned C) AnimatedBuilder D) AnimatedFuture Answer: D Explanation: There is no AnimatedFuture widget in the Flutter SDK. Question 76. What does the TickerProviderStateMixin provide for a StatefulWidget? A) Access to device sensors B) A Ticker that drives animations tied to the widget’s lifecycle C) Automatic disposal of streams D) Network connectivity monitoring Answer: B Explanation: TickerProviderStateMixin supplies a Ticker object, which AnimationController uses to generate frame callbacks. Question 77. Which widget is used to display a material-styled dialog?
Explanation: FutureBuilder listens to the future and rebuilds when the future completes (with data or error). Question 82. How can you make a widget ignore pointer events (e.g., taps) while still being visible? A) Wrap it with IgnorePointer B) Set enabled: false C) Use Opacity(opacity: 0.5) D) Wrap with AbsorbPointer Answer: A Explanation: IgnorePointer prevents its subtree from receiving hit-testing events; AbsorbPointer also blocks events but still participates in hit testing. Question 83. Which of the following is a correct way to define a typedef for a callback that receives a String and returns void? A) typedef void StringCallback(String value); B) typedef StringCallback = void Function(String); C) typedef StringCallback(String) => void; D) typedef Callback(String) void; Answer: B Explanation: The modern syntax uses typedef Name = ReturnType Function(ParameterTypes);. Question 84. When using sqflite, which method starts a transaction? A) db.transaction((txn) async { ... }) B) db.beginTransaction() C) db.startTransaction() D) db.runInTransaction() Answer: A Explanation: transaction accepts a callback where you can execute multiple queries atomically. Question 85. Which of the following best describes the purpose of the pubspec.lock file? A) Lists all available packages B) Locks the exact versions of dependencies used during the last pub get C) Stores the app’s assets D) Configures build modes Answer: B Explanation: pubspec.lock records the concrete versions resolved for each dependency to ensure reproducible builds.
Question 86. Which widget would you use to overlay a loading spinner on top of existing content? A) Stack with a centered CircularProgressIndicator B) OverlayEntry C) ModalBarrier D) All of the above (any can achieve the effect) Answer: D Explanation: All listed approaches can display a spinner over existing UI; Stack is the simplest, while OverlayEntry provides a separate overlay layer. Question 87. What does the debugCheckIntrinsicSizes flag help you find? A) Memory leaks B) Widgets that use intrinsic sizing, which can be expensive C) Unhandled exceptions D) Layout overflow errors Answer: B Explanation: Enabling this flag prints warnings for widgets that rely on intrinsic dimensions, encouraging more performant layouts. Question 88. Which of the following is the correct way to register a platform view for Android (e.g., a native WebView)? A) PlatformViewsService.registerViewFactory B) MethodChannel.registerView C) AndroidView automatically registers D) No registration needed Answer: A Explanation: PlatformViewsService.registerViewFactory registers a view factory that creates the native view; AndroidView then uses it. Question 89. Which of the following is NOT a valid build mode for Flutter? A) Debug B) Profile C) Release D) Production Answer: D Explanation: The official modes are Debug, Profile, and Release; “Production” is not a distinct mode. Question 90. When using Navigator 2.0, which class represents a parsed route configuration? A) RouteSettings B) Page C) RouterDelegate D) RouteInformation