Coding Challenges
Coding Challenges
Basic: The basic Challenges might have already been done while learning theory of different topics.
- Hello World: Write a program that prints “Hello, World!” to the console.
- Variables and Data Types: Declare variables of different data types (int, double, String, bool) and print their values.
- Arithmetic Operations: Write a function that takes two numbers and returns their sum, difference, product, and quotient.
- Control Flow - If/Else: Write a program that checks if a number is even or odd.
- Loops- For Loop: Write a program that prints the first 10 natural numbers using a for loop.
- Loops - While Loop: Write a program that prints the numbers from 10 to 1 using a while loop.
- Functions: Write a function that calculates the factorial of a number.
- Lists: Create a list of integers and find the maximum and minimum values.
- Maps: Create a map with keys as country names and values as their capital cities. Print all the keys and values.
- Strings: Write a function that reverses a given string.
Intermediate: This coding Challenges is liitle harder than the basic one but all can be done if you have good theory knowledge of the dart.
- Classes and Objects: Create a class Person with properties name and age. Create an object of the class and print the details.
- Inheritance: Create a base class Animal with a method makeSound(). Create derived classes Dog and Cat that override the makeSound() method.
- Abstract Classes: Create an abstract class Shape with an abstract method area(). Create classes Circle and Rectangle that implement the area() method.
- Exception Handling: Write a function that divides two numbers and handles any division by zero errors.
- File I/O: Write a program that reads a text file and prints its content to the console.
- Asynchronous Programming: Write a function that fetches data from a URL asynchronously and prints the response.
- Streams: Write a program that creates a stream of numbers and prints each number as it is emitted.
Advanced: If you can solve the Intermediate problems than you can start practicing for advanced.
- Functional Programming: Write a function that takes a list of integers and returns a new list with each integer squared using the map() function.
- Isolates: Write a program that uses isolates to perform parallel computations.
- Unit Testing: Write unit tests for a Dart class using the test package.
** Happy learning**