w3resource

Daily Coding Challenges & Projects


Wednesday


Frontend Mini Project Challenge

Vue.js Components

Challenge :

Create a Vue.js component <UserCard> that:

  • Accepts a user prop with name, email, and avatar
  • Displays user details.
  • Emits a select-user event when clicked.

Bonus : Style it with scoped CSS so it looks like a card.

Try Online : Use Vue SFC Playground to test your solution.

Backend Challenge

Language Focus: Python & PHP

Python Problem :

    Write a Python function to compress a string using Run-Length Encoding (e.g., "aaabbc" → "a3b2c1"), but without using any built-in groupby or external libraries.

PHP Task :

    Create a REST API in pure PHP (no framework) that:

  • Accepts a GET request with a user_id.
  • Returns user data in JSON from a mock associative array.

Database Query Challenge

Problems on SQL - HR Database :

  1. Write a SQL query to find employees who earn more than the highest-paid employee in department 90.
  2. Find employees who have been hired in the same month (regardless of year) as their manager.
Structure of HR database :

HR database



Data Structures & Algorithms Challenge

  • Easy:
    • Problem: Given a list of integers, find the first element that appears exactly twice.
    • Example: [1, 3, 5, 3, 1, 5, 3] → 3
    • Hint: Use dictionary
  • Medium:
    • Problem: Write a function to solve a Word Search in a 2D board: Given a grid of letters and a word, return true if the word exists in the grid (can move up/down/left/right).
    • Hint: DFS & backtracking
  • Hard:
    • Problem: You are given an array of integers. Implement a data structure that can:
      • Update an element.
      • Return the sum of elements between two indices.
    • Hint: Binary Indexed Tree or Segment Tree

Bug of the Day

Node.js / Go

Node.js Bug :

    Buggy Code:

    
    app.get('/user/:id', (req, res) => {
      const userId = req.params.id;
      const user = users.find(u => u.id === req.param.id);
      res.send(user);
    });
    

Challenge :

It should multiply, but it’s doing something else. Fix it.

PHP Bug:

    Buggy Code:

    
    <?php
    function greet($name) {
        return "Hello, $name";
    }
    
    echo greet();
    ?>
    

Challenge :

What's wrong here? Fix the bug and make it default to "Guest" if no name is passed.

📋 Daily Micro-Project

Database Focus

Challenge :

Optimize the following SQL query for performance on large HR datasets:

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

Hint :

Consider JOINs, indexes, and EXPLAIN.

Trivia: 5 Fun Facts

  1. PHP originally stood for "Personal Home Page."
  2. The first computer bug was a real moth found in a Harvard Mark II computer.
  3. Vue.js was created by Evan You, who previously worked at Google.
  4. Python’s name comes from Monty Python, not the snake.
  5. The world's first high-level programming language was Fortran, developed in the 1950s.

Tool of the Day (Updated)

Tool : Postwoman/Hoppscotch

Resource Roundup:

    Top Vue.js Learning Resources

    • Vue.js Docs
    • Vue Mastery Free Courses
    • Vue 3 Cheat Sheet: vue-cheatsheet.netlify.app

Interview Question of the Day

Daily Interview Questions

    Frontend :
    1. What are Vue.js lifecycle hooks? Name at least 3.
    2. How does v-model work in Vue?
    3. How are slots different from props in Vue.js?
    4. What’s the purpose of the key attribute in a v-for loop?
    Backend :
    1. How does error handling work in Python using try/except/finally?
    2. What are the main differences between PHP 7 and PHP 8?
    3. Explain the concept of closures in PHP..
    4. What are Python generators, and why are they memory-efficient?
    Database :
    1. What’s the difference between HAVING and WHERE?
    2. How does normalization improve database design?
    3. What is the purpose of a composite key?
    Others :
    1. What is a monolith vs microservices architecture?
    2. Explain the difference between CI and CD in DevOps.

Daily Quiz Challenge

    Frontend :

    1. What directive binds data to input in Vue.js?
      • v-bind
      • v-model
      • v-if
      • v-text
    2. Which of the following is a lifecycle hook in Vue.js?
      • onRender
      • created
      • initialize
      • preMount
    3. In Vue, which syntax is correct for dynamic class binding?
      • :class="className"
      • v-bind-class="className"
      • bind:class="className"
      • class:bind="className"

    Backend :

    1. What’s the correct way to define a lambda function in Python?
      • lambda x: x+1
      • function(x) => x+1
      • def lambda(x): return x+1
      • fn x => x + 1
    2. What is the output of print(2 ** 3 ** 2) in Python?
      • 64
      • 512
      • 256
      • Error
    3. In PHP, which superglobal is used for form data from GET?
      • $_POST
      • $_GET
      • $_FORM
      • $_REQUEST

    Database :

    1. Which SQL command is used to remove duplicates?
      • UNIQUE
      • REMOVE DUPLICATES
      • DISTINCT
      • NO DUPLICATE

    Mixed Quiz :

    1. Which of the following is NOT a frontend technology?
      • Vue.js
      • CSS
      • React
      • Flask

Weekly Cross-Domain Activities ( Updated ) ( May 02 to May 08, 2025 )

API of the Day:

Challenge : Cat Facts API

Build a fun web app that displays random cat facts. Add a "New Fact" button to fetch and display a new fact with each click.

API: https://catfact.ninja/fact

Linux/DevOps Tip:

Automate Backups with cron

    Use crontab -e to schedule a daily backup of a directory:

    0 2 * * * tar -czf /backup/$(date +\%F).tar.gz /your/data/folder
    

    This runs at 2:00 AM daily and compresses your target folder into a date-stamped .tar.gz archive.

Real-World Project of the Week ( Updated ) ( May 02 to May 08, 2025 )

Project of the Week:

    Build a Markdown Blog Engine using Node.js + Express or Flask.

    • Users should be able to create blog posts using Markdown files. Convert them to HTML for rendering.

Collaborative Project:

    Contribute to Public APIs GitHub repo — help by submitting useful APIs or improving documentation for developers worldwide.

Case Study:

    Study "Trello" clone functionality

    Focus on drag-and-drop lists, card management, and task labels using React + Redux or Vue + Pinia.


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



Follow us on Facebook and Twitter for latest update.