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

Programming Exercises

Create a component that implements a stop timer, allowing users to start, stop, and reset the timer.

Medium

Problem Statement

Create a component that implements a stop timer, allowing users to start, stop, and reset the timer.

Sample Input

Initial time: 0

Sample Output

A timer that counts up when started, pauses when stopped, and resets to 0.

Limits

Time: 2s · Memory: 256 MB

Code Editor

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

import React, { useState, useEffect } from "react";
 
 const Timer = () => {
  return (
  <div>
  <p>Time: 0</p>
  <button>Start</button>
  <button>Stop</button>
  <button>Reset</button>
  </div>
  );
 };
 
 export default Timer;