Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

Programming Exercises

Create a button that, when clicked, displays an alert saying 'Button clicked!'.

Easy

Problem Statement

Create a button that, when clicked, displays an alert saying 'Button clicked!'.

Sample Output

An alert box that says 'Button clicked!'

Limits

Time: 2s · Memory: 256 MB

Code Editor

Try your code in this preview. Submit marks it done.

import React from "react";
 
 const ClickAlert = () => {
  const handleClick = () => {
  // Add alert logic here
  };
 
  return (
  // Add button element here and link the click handler
    <></>  
);
 };
 
 export default ClickAlert;