w3resource

Daily Coding Challenges & Projects


Wednesday


Frontend Mini Project Challenge

Vue.js Component

Task :

Create a Reusable Alert Box Component in Vue.js

Requirements:

  • Accepts type prop (success, error, warning) and shows appropriate styling.
  • Slot for dynamic message content.
  • Close button to hide alert (with v-if or v-show).

Bonus : Use transition for fade-in/out effect.

Try Online : Use Vue SFC Playground

Backend Challenge

Python / PHP

Python Challenge :

Write a Python script to read and count word frequencies in a large text file without loading it entirely into memory.

Hint : Use with open() and readline() or chunked reading.

PHP Challenge :

Create a simple REST API in PHP using plain PHP (no framework)

Hint : Use with open() and readline() or chunked reading.

  • GET /api/greet?name=John → Response: {"message": "Hello, Sara!"}

Bonus: Return HTTP 400 if name is missing.

Database Query Challenge

Problems on SQL - HR Database :

  1. Find employees hired in the last 3 months.
  2. List departments where the average salary is above 8000.
Structure of HR database :

HR database



Data Structures & Algorithms Challenge

  • Easy:
    • Problem: Write a function to check if two strings are anagrams.
    • Hint: Sort both and compare or use frequency counters.
  • Medium:
    • Problem: Find the maximum subarray sum (Kadane's Algorithm).
    • Hint: Use dynamic programming – track current and global max.
  • Hard:
    • Problem: Serialize and deserialize a binary tree.
    • Hint: Use preorder traversal with null markers for serialization.

Bug of the Day

Python / PHP

Python Bug :

    Buggy Code:

    
    def divide(a, b):
        try:
            return a / b
        except:
            print("Error occurred")
        finally:
            return "Done"
    print(divide(10, 0))
    
    

Challenge :

Find and fix the issue. Why does it not print the error? Why doesn't it return correctly?


PHP Bug :

    Buggy Code:

    
    <?php
    $name = $_GET['name'];
    if ($name = "admin") {
        echo "Welcome, admin!";
    }
    ?>
    

Challenge :

What's wrong with the condition?

📋 Daily Micro-Project

Database Optimization

Challenge :

Optimize this slow SQL query

Original Query:


SELECT * FROM employees WHERE department_id IN (SELECT department_id FROM departments WHERE location_id = 1700);

Task :

  • Rewrite using JOIN
  • Add indexing suggestions

Bonus : Explain why JOIN is more efficient here.

Trivia: 5 Fun Facts

  1. Python was named after Monty Python, not the snake.
  2. The original PHP stood for Personal Home Page.
  3. SQL was originally called SEQUEL.
  4. Vue.js was created by a former Google engineer, Evan You.
  5. PostgreSQL was first released in 1996, evolved from Ingres (1970s).

Tool & Resource of the Day

Tool : Hugging Face Transformers

Use Case :

Build and deploy state-of-the-art machine learning models for NLP, vision, and more with just a few lines of code. Easily fine-tune and use pre-trained AI models like BERT, GPT, T5, and CLIP.

Key Features :

  • Access 100,000+ pre-trained models.
  • Easy integration with PyTorch and TensorFlow.
  • Seamless pipeline APIs for tasks like text generation, classification, summarization.

https://huggingface.co/transformers

Interview Question of the Day

Daily Interview Questions

    Frontend ( Vue, JS ) :
    1. What are Vue directives? Give examples
    2. How does two-way binding work in Vue?
    3. What’s the difference between computed and watched properties?
    4. What’s the difference between v-if, v-show, and v-for?
    Backend ( Python, PHP ) :
    1. Explain Python’s garbage collection mechanism.
    2. How does asyncio work in Python?
    3. What are superglobals in PHP?
    4. Explain the difference between require, include, and require_once in PHP.
    Database :
    1. What is a clustered vs non-clustered index?
    2. Explain the purpose of foreign keys in relational databases.
    3. What is normalization and why is it important?
    Others :
    1. What’s the difference between Docker and a VM?
    2. What is latency vs throughput in system design?

Daily Quiz Challenge

    Frontend ( Vue.js / JS ) :

    1. What lifecycle hook is called after the component is mounted in Vue?
    2. In Vue, what does :class bind to?
    3. What is the result of typeof null in JavaScript?

    Backend ( Python / PHP ) :

    1. What’s the output of: print('5' + '3') in Python?
    2. Which PHP superglobal contains GET data?
    3. What’s the purpose of yield in Python?

    Database :

    1. Which SQL clause is used to filter aggregated results?

    Others :

    1. What does pip stand for in Python?

    Mixed Quiz :

    1. What does v-model do in Vue.js?
    2. What is the time complexity of accessing a Python dictionary key?
    3. Which SQL command is used to add a new column to a table?

Weekly Cross-Domain Activities ( May 09 to May 15, 2025 )

API of the Day:

NASA Astronomy Picture of the Day (APOD) — Use NASA's APOD API to fetch the image or video of the day along with its description, and display it in a simple UI.

Challenge :

Build a gallery-style viewer where users can:

  • See today’s image
  • Browse previous days using a calendar or buttons
  • Read accompanying explanations

Resource:

Linux/DevOps Tip :

Monitor disk I/O and performance using iotop, sar, and glances

Commands to Explore :

  • iotop – Monitor real-time I/O usage by processes
  • sar – Collect, report, or save system activity information
  • glances – A cross-platform monitoring tool with an elegant web UI

Real-World Project of the Week ( May 09 to May 15, 2025 )

Project of the Week:

    Build a Budget Tracker Web App — Develop a web-based expense tracker where users can:

    • Add, categorize, and delete transactions
    • View monthly summaries and pie charts
    • Store data locally or connect to a backend for persistence

Tech Stack : HTML, CSS, JavaScript (with Chart.js for graphs)

Collaborative Project:

    Join the First Contributions GitHub Project — Learn how to make your first open-source pull request and contribute to beginner-friendly repositories with guided instructions.

Case Study:

    Explore Trello's Task Management UI — Analyze how Trello manages drag-and-drop task organization with React and libraries like react-beautiful-dnd.

Challenge :

Try building a minimal Kanban board with drag-and-drop cards and persistent state.


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



Follow us on Facebook and Twitter for latest update.