w3resource

Daily Coding Challenges & Projects


Thursday


Frontend Mini Project Challenge

React Hooks & State Management:

Challenge:

  • Build a simple Counter App using React that supports the following:
  • A count state that increases/decreases on button clicks
  • A "Reset" button
  • A button that doubles the current count

Bonus: Store the count in localStorage using the useEffect hook.

Try it online: CodeSandbox Starter

Backend Challenge

Node.js & Go

Node.js Challenge:

Problem:

    Create a REST API endpoint in Node.js (Express) that:

  • Accepts a POST request with firstName and lastName
  • Returns a JSON with fullName (concatenated)

Bonus: Add validation using express-validator.

Go Challenge:

Problem:

    Write a Go program that:

  • Reads a CSV file containing employee names
  • Returns the total number of unique last names in the file

Bonus: Use maps for counting and the encoding/csv package.

Database Query Challenge

Problems on SQL - HR Database :

  1. Write a query to display all employees who joined in the current year.
  2. List departments where the average salary is above $10,000.
Structure of HR database :

HR database



Data Structures & Algorithms Challenge

  • Easy:
    • Problem: Write a function to check if a string is a palindrome (ignore spaces and case).
    • Hint: Clean the string, then compare it to its reverse.
  • Medium:
    • Problem: Given an array of integers, return indices of the two numbers such that they add up to a specific target.
    • Hint: Use a hashmap to store value → index.
  • Hard:
    • Problem: Implement a Least Recently Used (LRU) Cache class with get() and put() methods.
    • Hint: Use a hashmap + doubly linked list for O(1) operations.

Bug of the Day

Node.js (JavaScript)

    Buggy Code:

    
    const fs = require('fs');
    fs.readFile('data.txt', 'utf-8', (err, data) => {
      if (err) throw err;
      console.log("Data read:", data.toString());
    });
    

    Challenge: Why might data.toString() throw an error? Fix it.

Hint: data is already a string when you pass 'utf-8'.

📋 Daily Micro-Project

Frontend

Challenge: Build a Theme Toggle Button in React.

  • Uses useState to toggle between Light/Dark themes.
  • Changes body background color accordingly.

Bonus: Store theme preference in localStorage.

Trivia: 5 Fun Facts

  1. React was developed by Jordan Walke, a Facebook engineer.
  2. Go (Golang) was created at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson.
  3. console.log() was first introduced in Netscape Navigator 4.
  4. npm (Node Package Manager) was created in 2010.
  5. The first ever website is still online: http://info.cern.ch

Tool of the Day

Tool : React Developer Tools

  • Inspect React components directly in Chrome/Firefox DevTools.
    • Resource Roundup:

        React Cheat Sheet & Hooks Guide

      • React Cheat Sheet (freecodecamp)
      • useHooks.dev — A modern hook explorer

    Extension: React DevTools

    Interview Question of the Day

    Daily Interview Questions

      Frontend : React-focused
      1. What is the difference between useEffect() and useLayoutEffect()?
      2. How does the useCallback() hook improve performance?
      3. What is the purpose of key in React lists?
      4. Can you explain the concept of controlled vs uncontrolled components?
      Backend : Node.js & Go
      1. How does Node.js handle concurrency with a single-threaded model?
      2. What is the difference between process.nextTick() and setImmediate()?
      3. What are goroutines in Go?
      4. How does garbage collection work in Go?
      Database :
      1. What is a foreign key? How does it ensure data integrity?
      2. When would you use a subquery instead of a JOIN?
      3. How can you detect and avoid SQL injection?
      Others :
      1. What is the difference between a virtual machine and a container?
      2. What is CI/CD? Why is it important in software deployment?

    Daily Quiz Challenge

    Frontend : React & JS

    1. What does useEffect(() => {}, []) do?
      • Runs on every render
      • Runs once on mount
      • Runs before unmount
      • Never runs
    2. Which method is used to update state in React?
      • updateState
      • modifyState
      • setState
      • changeState
    3. What will this return: typeof null
      • "null"
      • "object"
      • "undefined"
      • "function"

    Backend : Node.js & Go

    1. In Node.js, which module is used to work with file system?
      • os
      • fs
      • file
      • stream
    2. What does defer do in Go?
      • Skips execution
      • Runs immediately
      • Delays execution until function returns
      • Runs only on error
    3. What is the output of console.log(typeof NaN)?
    4. >
      • "number"
      • "NaN"
      • "undefined"
      • "object"

    Others : Database

    1. What SQL keyword is used to filter grouped data?
      • WHERE
      • HAVING
      • GROUP
      • FILTER

    Mixed :

    1. Which is true about React state?
      • It mutates directly
      • It’s global
      • It should be treated as immutable
      • It is only available via Redux

    Weekly Cross-Domain Activities ( April 18 to 24, 2025 )

    API of the Day:

    Build a currency converter using the ExchangeRate API

    • Fetch live exchange rates
    • User selects currency pair and amount
    • Displays converted amount instantly

    Linux/DevOps Tip:

    10 Commands to Monitor Server Health:

  • top, htop, free -m, df -h, uptime, vmstat, iostat, netstat, dstat, sar.
  • Real-World Project of the Week ( April 18 to 24, 2025 )

    Project of the Week:

      Build a Task Manager App with login, add/edit/delete tasks, and due date reminders

    • Tech Stack Options:
      • React + Node.js + PostgreSQL

    Collaborative Project:

      Open-source GitHub Project: Habit Tracker App** ← let users add habits, track streaks, share progress. Invite community collaboration!

    Case Study:

      How Trello Works Under the Hood

    • Real-time updates using WebSockets
    • Kanban board layout
    • Offline support via IndexedDB
  • Encourage users to clone Trello features in a simplified clone!

  • 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

    

    Follow us on Facebook and Twitter for latest update.