w3resource

Daily Coding Challenges & Projects


Wednesday


Frontend Mini Project Challenge

Vue.js Components

    Challenge:

    Build a reusable <AlertBanner> Vue component that:

  • Accepts props: type (success|error|info), message, and optional dismissible (boolean).
  • Automatically hides after 5 seconds if dismissible is true.
  • Emits a closed event when dismissed.
  • Hint :Use the Composition API (defineProps, ref, onMounted) and v-if for conditional rendering.

Try it Online: Vue SFC Playground

Backend Challenge

Python & PHP

Challenge Python

Problem:

    Write a script that reads a large CSV file in chunks (e.g. 10,000 lines at a time) and counts how many rows contain the word "error" in any column.

    Hint: Use pandas.read_csv(..., chunksize=10000) or itertools.islice.

Challenge PHP

Problem:

    Create a User class supporting:

  • __construct($name, $email)
  • validate() — returns true if email is valid (use filter_var), otherwise throws an exception.
  • toJson() — outputs user data as a JSON string.

Database Query Challenge

Problems on SQL - HR Database :

  1. Find employees who joined exactly on their manager’s hire date.
  2. List employees who never received a salary increase in the last 3 years.
Structure of HR database :

HR database



Data Structures & Algorithms Challenge

  • Easy:
    • Problem: Reverse a string in-place.
    • Hint: Convert to array, swap characters from ends.
  • Medium:
    • Problem: Given a rotated sorted array, find the minimum element.
    • Hint: Use modified binary search comparing mid to end.
  • Hard:
    • Problem: Implement Dijkstra’s shortest path algorithm using a priority queue.
    • Hint: Use a min-heap (e.g., Python’s heapq or PHP’s SplPriorityQueue).

Bug of the Day

Python Bug

    Code:

    
    def append_item(item, lst=[]):
        lst.append(item)
        return lst
    
    print(append_item(1))
    print(append_item(2))  # Unexpected behavior?
    
    

    Challenge: Explain and fix the default-mutable-argument issue.

PHP Bug

    Code:

    
    <?php
    function divide($a, $b) {
        if ($b == 0) {
            return "Cannot divide by zero";
        }
        return $a / $b;
    }
    echo divide(10, "0");  // What's wrong?
    ?>
    
    
    

    Challenge: Spot the type-check flaw and correct it.

📋 Daily Micro-Project

Database Focus:

Challenge :

Identify a slow-performing query on your HR database and optimize it by:

  1. Adding indexes.
  2. Rewriting any correlated subqueries into joins.
  3. Comparing execution time before vs. after (EXPLAIN PLAN).

Trivia: 5 Fun Facts

  1. The first version of PHP stood for "Personal Home Page."
  2. PostgreSQL began development in 1986 as "Ingres."
  3. Ada Lovelace wrote the first algorithm intended for a machine (1843).
  4. Guido van Rossum named Python after Monty Python, not the snake.
  5. Vue.js was created in 2014 by ex-Google engineer Evan You.

Tool of the Day

Tool: DBeaver

    A free, universal database GUI supporting MySQL, PostgreSQL, Oracle, and more—great for visual query building and ER diagrams.

  • Download DBeaver
  • Quickstart Guide

Interview Question of the Day

Daily Interview Questions

    Frontend ( Vue.js ) :
    1. How do you pass data from parent to child components?
    2. What's the difference between v-show and v-if?
    3. Explain the purpose of the <slot> element.
    4. How does Vue's reactivity detect changes in objects?
    Backend ( Python, PHP ) :
    1. What is the GIL in Python and how does it affect concurrency?
    2. How do you handle exceptions and errors in PHP?
    3. Explain Python's with statement (context managers).
    4. What are PHP traits and when would you use them?
    Database :
    1. What's the difference between clustered and non-clustered indexes?
    2. Explain the use of window functions (e.g., ROW_NUMBER()).
    3. What is a materialized view?
    Others :
    1. What is CI/CD and why is it important?
    2. Explain the concept of "Infrastructure as Code."

Daily Quiz Challenge

    Frontend :

    1. Which Vue directive binds HTML attributes?
      • v-bind
      • v-model
      • v-for
      • v-if
    2. What lifecycle hook runs after the component is mounted?
      • created
      • mounted
      • beforeMount
      • destroyed
    3. How do you conditionally render an element?
      • v-if
      • v-for
      • v-bind
      • v-show

    Backend :

    1. What does pandas.read_csv(chunksize=...) return?
      • DataFrame
      • Iterator of DataFrames
      • List of rows
      • None
    2. Which PHP function sanitizes email addresses?
      • filter_var(..., FILTER_SANITIZE_STRING)
      • filter_var(..., FILTER_SANITIZE_EMAIL)
      • htmlspecialchars()
      • trim()
    3. In SQL, which clause filters after aggregation?
      • WHERE
      • HAVING
      • GROUP BY
      • ORDER BY

    Others :

    1. What's a container orchestration tool? (e.g., Kubernetes)
    2. What is a shell pipeline (e.g., grep … | awk …)?

    Mixed Quiz :

    • What does EXPLAIN ANALYZE do in PostgreSQL?

Weekly Cross-Domain Activities ( April 25 to May 01, 2025 )

API of the Day:

Challenge:

Use the Bored API to create a simple app that suggests fun activities when you're bored.


Linux/DevOps Tip:

Useful Commands for File & Directory Management and Troubleshooting

    Here are 10 powerful and often underused commands for managing files and debugging issues in Linux systems:

    1. stat filename – View detailed metadata about a file (last access, inode, etc.)
    2. ls -lhS – List files by size in human-readable format
    3. tree -L 2 – Display a directory structure up to 2 levels deep
    4. find /path -type f -size +100M – Find files larger than 100MB
    5. ncdu – A disk usage analyzer with a simple interactive UI (install required)
    6. lsof +D /path/to/dir – List open files in a directory
    7. inotifywait -m /some/dir – Watch for real-time file changes in a directory (from inotify-tools)
    8. file filename – Determine file type and encoding
    9. tail -F /var/log/syslog – Live-follow system logs with file rotation support
    10. watch -n 1 'df -h / && free -h' – Watch disk and memory stats refresh every second

Real-World Project of the Week ( April 25 to May 01, 2025 )

Project of the Week:

    Build a Personal Expense Tracker App

  • Tech Stack Options:
    • TypeScript + Express + PostgreSQL + React

Collaborative Project:

Case Study:

    How is Notion Built?

  • Uses React + TypeScript frontend
  • Backend with C++/Rust hybrid for performance
  • Offline-first architecture

Challenge: Try replicating a basic note-taking component!


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



Follow us on Facebook and Twitter for latest update.