Search Header Logo

fLUTTER_LAB2

Authored by Mahnoor Mahnoor

Information Technology (IT)

University

Used 1+ times

fLUTTER_LAB2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

14 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary difference between a stateful and a stateless widget in Flutter?

Stateful widgets never change; stateless widgets can change
Stateful widgets can change due to user interaction; stateless widgets cannot
Stateful widgets are only used for layout; stateless widgets handle logic
Stateful widgets use a single class; stateless widgets use two classes

Answer explanation

A stateful widget is dynamic and can change its appearance in response to user interactions or data changes

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which Flutter widget is an example of a stateless widget?

TextField
Checkbox
Icon
Slider

Answer explanation

Icon is a stateless widget because it does not change its appearance once built

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the setState() method do in a stateful widget?

Builds the widget
Notifies the framework to redraw the widget
Initializes the widget's state
Creates a new State object

Answer explanation

Calling setState() notifies the Flutter framework that the widget's state has changed

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a required class when implementing a custom stateful widget?

StatelessWidget
StatefulWidget
State
Widget

Answer explanation

A custom stateful widget requires a subclass of StatefulWidget to define the widget and a subclass of State to manage its state.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the build() method in the State class?

To initialize the widget's state
To define the widget's user interface
To handle user interactions
To store mutable data

Answer explanation

The build() method in the State class defines the widget's user interface by returning a widget tree.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which property of ElevatedButton is used to handle a tap event?

onChanged
onPressed
onTap
onClick

Answer explanation

The onPressed property of ElevatedButton defines the callback function that handles tap events.

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which widget is used to control a TextField in the stateful widget example with a text field?

TextController
TextEditingController
InputController
FieldController

Answer explanation

TextEditingController is used to control the TextField

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?