NEW
Font size
Worksheets1st session
Total questions: 15
Worksheet time: 8mins
What is Dart primarily used for?
Backend development
Mobile app development
Desktop applications
Game development
Which of the following is NOT a valid data type in Dart?
int
float
bool
string
How do you create a nullable variable in Dart?
int value;
int value!;
int? value;
nullable int value;
What is the purpose of the ! operator in Dart?
To declare a nullable variable
To check if a value is null
To negate a boolean value
To force a nullable value to be treated as non-null
What does the following code output?
void main() {
var a = 5, b = 3;
print(a ~/ b);
}
1.6666
1
2
Error
What is the output of the following code?
void main() {
var x = 10;
print(x is String);
}
true
false
error
null
Which method is used to add an item to a list in Dart?
addItem()
append()
add()
push()
What is the purpose of the late keyword in Dart?
Declares a variable that must be initialized later
Declares a constant variable
Declares a nullable variable
Declares a variable with no type
What is the output of the following code?
void main() {
String? name;
print(name ?? 'No Name');
}
null
No Name
Error
Empty string
What is the difference between const and final in Dart?
final is used for runtime constants, and const is used for compile-time constants.
Both are identical in Dart.
const allows reassignment, while final does not.
final variables are immutable, while const variables are not.
What does the dynamic keyword in Dart allow you to do?
Declare variables that cannot change type.
Declare variables with no fixed type that can change dynamically.
Declare variables that hold only strings.
Declare immutable variables.
What is encapsulation in OOP?
Hiding the implementation details and exposing only what is necessary.
Creating multiple methods with the same name.
Converting an object to another type.
Inheriting from another class.
What will the following code output?
class Animal {
void speak() => print('Animal speaks');
}
class Dog extends Animal {
@override
void speak() => print('Dog barks');
}
void main() {
Animal myPet = Dog();
myPet.speak();
}
Animal speaks
Dog barks
Error
null
What will the following code output?
void main() {
final List<int> numbers = [1, 2, 3];
numbers[0] = 4;
print(numbers);
}
[4, 2, 3]
Error: Cannot modify a final list
[1, 2, 3]
Error: Cannot assign to an unmodifiable list
What feature of Flutter allows you to see changes in your app instantly without restarting?
Cold start
Warm Start
Quick Refresh
Hot Restart
