True/False Questions
1. Dart is a prerequisite for writing Flutter applications.
2. The void keyword in Dart indicates that a function does not return any value.
3. In Dart, every statement must end with a semicolon.
4. Dart supports multiple inheritance.
5. The main function in Dart is optional and only used for larger programs.
6. All Dart programs must have a main function.
7. print is a function in Dart that prints text to the console.
8. A List in Dart can only contain elements of the same type.
9. Dart’s type system helps catch errors at compile time.
10. In Dart, even numbers are objects and not primitives.
11. You can use the var keyword to define a variable without specifying its type.
12. Dart supports both single and multiple inheritance.
13. Using dynamic in Dart allows a variable to change its type.
14. The dart:core library is automatically imported in Dart programs.
15. The Dart SDK includes a library called dart:html.
16. The helloDart function in the example prints "Hello, World!" by default.
17. You can use the final keyword in Dart to declare a variable that cannot be reassigned.
18. The dart:io library is used for input and output operations in Dart.
19. Documentation comments in Dart start with ///.
20. Dart programs must import all necessary libraries at the beginning of the file.
Multiple Choice Questions
21. What is the correct syntax for defining a function in Dart? a. def myFunction() b.
function myFunction() c. void myFunction() d. func myFunction()
22. Which of the following is true about the main function in Dart? a. It is not required in
Dart programs. b. It is the entry point of all Dart programs. c. It can return any type of
value. d. It must always have parameters.
23. What does the print function do in Dart? a. Saves data to a file b. Sends data to a server
c. Prints text to the console d. Reads input from the user
24. What is the purpose of the dart:io library? a. To handle HTML elements b. To perform
input and output operations c. To manage asynchronous programming d. To work with
mathematical functions
25. Which keyword is used to define a variable that cannot be reassigned? a. const b. var c.
dynamic d. final
26. What does the following code do: void main() { print('Hello, Dart!'); }? a. It
defines a class. b. It prints "Hello, Dart!" to the console. c. It defines a variable. d. It
performs a loop operation.
27. How do you define a List of strings in Dart? a. List strings = ["a", "b", "c"]; b.
List<String> strings = ["a", "b", "c"]; c. List var strings = ["a", "b",
"c"]; d. String[] strings = ["a", "b", "c"];
28. What is the return type of the main function in Dart? a. int b. String c. void d. dynamic
29. How do you import the dart:io library in Dart? a. import 'dart:io'; b. include
'dart:io'; c. use 'dart:io'; d. require 'dart:io';
30. What type of comments are used to document classes in Dart? a. Inline comments b.
Block comments c. Documentation comments d. End-of-line comments
Fill in the Blank Questions
31. In Dart, the entry point of a program is the __________ function.
32. The __________ keyword in Dart is used to declare a variable that can change type
dynamically.
33. To print text to the console in Dart, you use the __________ function.
34. Dart supports __________ inheritance.
35. The __________ library is automatically imported in every Dart program.
36. In Dart, every object is an instance of a __________.
37. You use __________ to define a variable that cannot be reassigned.
38. The __________ keyword indicates that a function returns no value.
39. A __________ in Dart is an array-like data structure that manages its own size.
40. To import a library in Dart, you use the __________ statement.
Short Answer Questions
41. What is the significance of the main function in Dart programs?
42. How does Dart ensure type safety in its programs?
43. Describe the purpose of the dart:io library.
44. How do you define a function in Dart that takes a string as an argument and prints it?
45. What is the difference between var and dynamic in Dart?
Explanation Questions
46. Explain how the type system in Dart helps prevent bugs at runtime.
47. Describe the process of writing and running a "Hello, World!" program in Dart.
48. What is the role of the dart:core library in Dart programs?
49. How can you use loops in Dart to iterate over a list of names and print a greeting for
each?
50. Discuss the benefits of using the final keyword when declaring variables in Dart.