Coding Challenges

  • Coding Challenges

Coding Challenges

Basic: The basic Challenges might have already been done while learning theory of different topics.

  1. Hello World: Write a program that prints “Hello, World!” to the console.
  2. Variables and Data Types: Declare variables of different data types (int, double, String, bool) and print their values.
  3. Arithmetic Operations: Write a function that takes two numbers and returns their sum, difference, product, and quotient.
  4. Control Flow - If/Else: Write a program that checks if a number is even or odd.
  5. Loops- For Loop: Write a program that prints the first 10 natural numbers using a for loop.
  6. Loops - While Loop: Write a program that prints the numbers from 10 to 1 using a while loop.
  7. Functions: Write a function that calculates the factorial of a number.
  8. Lists: Create a list of integers and find the maximum and minimum values.
  9. Maps: Create a map with keys as country names and values as their capital cities. Print all the keys and values.
  10. 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.

  1. Classes and Objects: Create a class Person with properties name and age. Create an object of the class and print the details.
  2. Inheritance: Create a base class Animal with a method makeSound(). Create derived classes Dog and Cat that override the makeSound() method.
  3. Abstract Classes: Create an abstract class Shape with an abstract method area(). Create classes Circle and Rectangle that implement the area() method.
  4. Exception Handling: Write a function that divides two numbers and handles any division by zero errors.
  5. File I/O: Write a program that reads a text file and prints its content to the console.
  6. Asynchronous Programming: Write a function that fetches data from a URL asynchronously and prints the response.
  7. 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.

  1. Functional Programming: Write a function that takes a list of integers and returns a new list with each integer squared using the map() function.
  2. Isolates: Write a program that uses isolates to perform parallel computations.
  3. Unit Testing: Write unit tests for a Dart class using the test package.

** Happy learning**