Search Header Logo

Flutter Prague #5

Authored by Honza Bittner

Computers

Professional Development

Used 2+ times

Flutter Prague #5
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

6 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

What does the following code do in Flutter?

Creates a container with a width of 100, a height of 200 and a blue color

Causes a compilation error

Creates an empty widget without any effect

Throws a runtime exception

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

What is the difference between final x = ...; and late final x = ...; in Dart?

final requires immediate initialization, while late final allows initialization only on first use if the value is not assigned immediately

late final cannot be initialized on declaration

late final must be initialized explicitly by a function

late final allows you to change the value once, while final does not

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What happens when you call setState() within StatelessWidget?

Causes a runtime or compilation error because StatelessWidget does not have a setState method

Revives the widget because all widgets can have a state

It does nothing because StatelessWidget has no state

Forces Flutter to rebuild the widget tree

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

Consider the following code:

The code fails to compile

The code runs successfully

The code compiles, but it throws a runtime exception

Answer explanation

Media Image

Feature: Statically checked declaration-site variance
https://github.com/dart-lang/language/issues/524

covariance: safe for reading (current Dart)

contravariance: safe for writing

invariance: safe for both reading and writing

5.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

Consider the following code, after calling foo() :

It prints "Caught an error: Exception: oopsie"

Throws a runtime exception

The code does not compile

6.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Media Image

Consider the following code, after calling foo() :

It prints "Caught an error: Exception: oopsie"

Throws a runtime exception

The code does not compile

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?