Boss fight

Section Exercises

Practice Dart Basics & Data Types concepts

Test your understanding of Dart fundamentals including variables, data types, collections, and type conversion.

0 / 19 cleared

Cleared0%
1

Variables & Constants

Practice variable declaration and immutability

1

Challenge 1

Easy

Declare a variable called "name" and initialize it with your name. Then declare an uninitialized variable "age" of type int.

starter.dart
1// Your code here
2

Challenge 2

Medium

What is the difference between "var" and "dynamic" in Dart?

Your answer
3

Challenge 3

Easy

Create a final variable "pi" with value 3.14159 and a const variable "appName" with value "MyApp".

starter.dart
1// Your code here
4

Challenge 4

Medium

When should you use "late" keyword?

Your answer
5

Challenge 5

Easy

Declare a nullable String variable "middleName" and assign it null.

starter.dart
1// Your code here
6

Challenge 6

Easy

What happens if you try to change a final variable?

Your answer
2

Numbers & Strings

Work with numeric and string data types

1

Challenge 1

Easy

Create two variables: an integer "count" with value 42 and a double "price" with value 19.99.

starter.dart
1// Your code here
2

Challenge 2

Medium

Create a string "greeting" that says "Hello, World!" using string interpolation with two variables: greeting word and target.

starter.dart
1String greetingWord = "Hello";
2String target = "World";
3// Your code here
3

Challenge 3

Easy

How do you create a multi-line string in Dart?

Your answer
4

Challenge 4

Medium

Convert the string "123" to an integer and store it in a variable called "number".

starter.dart
1String text = "123";
2// Your code here
5

Challenge 5

Easy

What is the result of: "5" + "3" in Dart?

Your answer
6

Challenge 6

Medium

Round the number 3.7 to the nearest integer using the appropriate method.

starter.dart
1double value = 3.7;
2// Your code here
3

Collections

Master Lists, Sets, and Maps

1

Challenge 1

Easy

Create a list of strings containing three fruit names: "Apple", "Banana", "Orange".

starter.dart
1// Your code here
2

Challenge 2

Easy

How do you access the first element of a list in Dart?

Your answer
3

Challenge 3

Medium

Add "Mango" to the fruits list and remove "Banana" from it.

starter.dart
1List<String> fruits = ["Apple", "Banana", "Orange"];
2// Your code here
4

Challenge 4

Medium

Create a Set of integers containing: 1, 2, 3, 2, 1. What will be in the set?

starter.dart
1// Your code here
5

Challenge 5

Medium

What is the main difference between List and Set?

Your answer
6

Challenge 6

Medium

Create a Map with String keys and int values representing ages: "Alice" -> 25, "Bob" -> 30.

starter.dart
1// Your code here
7

Challenge 7

Easy

How do you get a value from a Map in Dart?

Your answer

Loot collected

Key takeaways
  • Understanding variable declaration and initialization is fundamental
  • Choosing the right data type improves code clarity and performance
  • Collections (Lists, Sets, Maps) are essential for managing data