w3resource

Daily Coding Challenges & Projects


Weekend


Frontend Mini Project Challenge

Theme : HTML, CSS, and JavaScript

Task :

Create a fully functional Dark Mode Toggle using HTML, CSS, and JavaScript

Requirements :

  • A button to toggle between light and dark mode.
  • CSS transitions for smooth color changes.
  • Remember user preference using localStorage.

Bonus : Add icons for Sun/Moon based on the mode.

Backend Challenge

Scala & R, Swift & TypeScript

Scala Task :

Write a Scala function to compute the factorial of a number using recursion.


R Task :

Write an R script to load a CSV file, compute the mean salary of employees, and display the result.


Swift Task :

Create a basic Vapor route that returns "Hello, Vapor!" as a JSON response.


TypeScript Task :

Build a simple TypeScript class Rectangle with properties width, height and a method getArea() to compute area.

Database Query Challenge

Problems on SQL - HR Database :

  1. Write a SQL query to list employees with salaries within the top 10% of all employees.
  2. Write a SQL query to find the department with the highest average salary.

HR database



Data Structures & Algorithms Challenge

  • Easy:
    • Problem : Reverse a string without using built-in reverse functions.
    • Hint : Loop through the string backwards and construct the result.
  • Medium:
    • Problem : Implement a function to check if a linked list contains a cycle.
    • Hint : Use the two-pointer (slow/fast) technique.
  • Hard:
    • Problem :Given a list of intervals, merge overlapping intervals.
    • Hint : Sort intervals by start time, then merge where overlaps occur.

Bug of the Day

Scala & R, Swift & TypeScript

Scala Bug

    Buggy Code:

    
    val numbers = List(1, 2, 3, 4)
    println(numbers(4))
    
    

Challenge :

Find and fix the issue.


R Bug

    Buggy Code:

    
    data <- c(1, 2, 3, 4)
    print(data[5])
    

Challenge :

Identify and correct the error.


Swift Bug

    Buggy Code:

    
    let numbers = [1, 2, 3]
    print(numbers[3])
    

Challenge :

What's wrong?


TypeScript Bug

    Buggy Code:

    
    const square = (n: number): number => {
        return n * n
    }
    console.log(square("5"))
    
    

Challenge :

Find and fix the error.

📋 Daily Micro-Project

Backend Focus :

Backend Task :

  • Create a Scala or R script that connects to a database and fetches data from an employee table.
  • Build a simple REST API in Swift using Vapor or in TypeScript using Express to return employee details.

Trivia: 5 Fun Facts

  1. Scala is both object-oriented and functional.
  2. R is widely used for statistical computing and data visualization.
  3. Swift was introduced by Apple in 2014 as a safer replacement for Objective-C.
  4. TypeScript adds static typing to JavaScript, developed by Microsoft.
  5. The SQL language has been around since the 1970s.

Tool & Resource of the Day

Tool : RStudio, Postman

RStudio

A popular IDE for R programming.

Resource : https://rstudio.com/resources/cheatsheets/


Postman

API testing made easy.

Resource : https://learning.postman.com/

Interview Question of the Day

Daily Interview Questions

    Frontend :
    1. What is component-based architecture in modern frontend frameworks?
    2. How does event bubbling work in JavaScript?
    3. Explain CSS specificity with an example.
    4. What are the differences between props and state in React?
    Backend :
    1. What is pattern matching in Scala?
    2. How does R handle vectorized operations?
    3. What is type safety in TypeScript?
    4. How does Swift handle optionals and why are they useful?
    Database ( SQL ) :
    1. What are foreign keys in SQL?
    2. Explain normalization in databases.
    3. What is a composite primary key?
    Others :
    1. What is continuous integration (CI) in DevOps?
    2. What is API rate limiting and why is it important?

Daily Quiz Challenge

    Frontend Quiz :

    1. Which tag defines a clickable link in HTML?
      • <button>
      • <a>
      • <link>
      • <div>
    2. CSS property to make text bold?
      • font-style
      • font-weight
      • text-decoration
      • font-family
    3. React's virtual DOM improves performance by:
      • Manipulating the real DOM directly
      • Using Web Workers
      • Minimizing direct DOM updates
      • Avoiding JavaScript execution

    Backend Quiz :

    1. Scala is built on top of:
      • JVM
      • CLR
      • Node.js
      • Go runtime
    2. R is primarily used for:
      • Web development
      • Data analysis and statistics
      • Mobile apps
      • Compiling Java code
    3. TypeScript files have what extension?
      • .js
      • .ts
      • .jsx
      • .tsx

    Database :

    1. The SQL keyword for combining results from two tables is:
      • JOIN
      • COMBINE
      • APPEND
      • MERGE

    Other :

    1. Git command to create a new branch:
      • git start <branch>
      • git new <branch>
      • git checkout -b <branch>
      • git init <branch>

Weekly Cross-Domain Activities ( July 04 to July 10, 2025 )

API of the Day:

Task : Build a currency converter using the ExchangeRate-API.

Details :

  • Fetch real-time currency conversion rates using https://www.exchangerate-api.com/.
  • Allow users to select base and target currencies.
  • Display the converted amount dynamically.

Bonus :

  • Add error handling for invalid inputs.
  • Style it with CSS for a clean look.

Linux/DevOps Tip :

5 commands to monitor system performance:

  • top, htop, free -m, df -h, uptime

Real-World Project of the Week ( July 04 to July 10, 2025 )

Project of the Week:

Build a responsive personal portfolio using HTML, CSS, JavaScript, and optionally React.

Collaborative Project:

Contribute to a GitHub open-source project — Suggest projects like https://github.com/firstcontributions/first-contributions

Case Study:

Explore how Netflix uses microservices and scalable cloud infrastructure.


Previous Daily Coding Challenges & Projects : 04-04-2025   07-04-2025  08-04-2025  09-04-2025  10-04-2025  11-04-2025  14-04-2025  15-04-2025  16-04-2025  17-04-2025  18-04-2025  21-04-2025  22-04-2025  23-04-2025  24-04-2025  25-04-2025  28-04-2025  29-04-2025  30-04-2025  01-05-2025  02-05-2025  05-05-2025  06-05-2025  07-05-2025  08-05-2025  09-05-2025  12-05-2025  13-05-2025  14-05-2025  15-05-2025  16-05-2025  19-05-2025  20-05-2025  21-05-2025  22-05-2025  23-05-2025  26-05-2025  27-05-2025  29-05-2025  30-05-2025  02-06-2025  03-06-2025  04-06-2025  05-06-2025  06-06-2025  09-06-2025  10-06-2025  11-06-2025  12-06-2025  13-06-2025  16-06-2025  17-06-2025  18-06-2025  19-06-2025  20-06-2025  23-06-2025  24-06-2025  25-06-2025  26-06-2025  27-06-2025  30-06-2025  01-07-2025  02-07-2025  03-07-2025



Follow us on Facebook and Twitter for latest update.