Square Yards Interview

square yards logo
square yards
· MERN Stack Developer· 6y exp
September 27, 2026 · 0 reads

Summary

I interviewed for a MERN Stack Developer role at Square Yards, where I was asked several logical brain teasers, React component tasks, Node.js concepts, and system design questions.

Full Experience

Company: Square Yards Role: MERN Stack Developer Experience: 6 Years Stack: React.js + Node.js + Express.js + MongoDB Hiring: Naukri Job Posting Salary: 25LPA+

Logical Questions A bat and a ball cost ₹110 together. The bat costs ₹100 more than the ball. How much does the ball cost? Answer : ₹5 (bat ₹105)

You have ₹100. You spend ₹70, then get ₹50 back, then spend ₹60. How much money do you have? Answer: 20

React Js Create a counter Requirements Increment Decrement Reset Show the last 5 counter values

Copy Color to an Empty Box Build a React component that displays 4 boxes: 3 colored boxes (e.g., Red, Green, Blue) 1 empty white box Requirements Clicking on one of the colored boxes should copy its color. This is the first click. The selected color should be stored in state, but the white box should remain unchanged. Clicking on the white box should paste the copied color into it. This is the second click. The white box should change to the copied color. The interaction should require exactly two clicks: First click → Select (copy) a color. Second click → Apply (paste) the copied color to the white box.

Create a Stopwatch Requirements Start Pause Reset

Sort Users You are given the following array of users: const users = [ { id: 1, name: "John", age: 30 }, { id: 2, name: "Mike", age: 20 }, { id: 3, name: "Alex", age: 25 }, { id: 4, name: "Sarah", age: 28 }, { id: 5, name: "Emma", age: 22 } ];

Requirements Build a React component that displays the list of users in a table Provide the following functionality: Sort by Name (A–Z) When the "Sort by Name" button is clicked, users should be sorted alphabetically by their name. Sort by Age (Ascending) When the "Sort by Age" button is clicked, users should be sorted from youngest to oldest. The UI should update immediately after sorting.

Q: How do you decide what should be local state and what should be global state? Q: How would you prevent duplicate API requests?

Node.js How does Node.js handle multiple concurrent requests if it runs on a single thread? Expected topics Event Loop Non-blocking I/O libuv Worker threads OS thread pool

When would Node.js become slow? CPU intensive work Infinite loops Huge JSON parsing Synchronous filesystem calls Large regex

Print numbers 1 to 5 with 1-second delay between each async function printNumbers() { for (let i = 1; i <= 5; i++) { await new Promise(resolve => setTimeout(resolve, 1000)); console.log(i); } } printNumbers();

Create a simple Express middleware to log request time

function requestLogger(req, res, next) {

const start = Date.now(); res.on("finish", () => { console.log(${req.method} ${req.url} - ${Date.now() - start}ms); }); next(); }

Count word frequency in a string

How would you design a high-throughput notification service (Email, SMS, WhatsApp)?

How would you optimize an API handling 10,000 requests per second?

A MongoDB collection has 100 million documents. Queries have become slow. What would you do?

How do you ensure messages are not processed twice in Kafka?

Design a rate limiter for an API.

Design a file upload service supporting files up to 10 GB.

Database architecture to show customer chat history like ChatGpt shows.

Interview Questions (20)

1.

Bat and Ball Price Puzzle

Other·Easy

A bat and a ball cost ₹110 together. The bat costs ₹100 more than the ball. How much does the ball cost?

2.

Money Transaction Puzzle

Other·Easy

You have ₹100. You spend ₹70, then get ₹50 back, then spend ₹60. How much money do you have?

3.

React Counter Component

Data Structures & Algorithms·Medium

Create a counter component with the following requirements:

  • Increment
  • Decrement
  • Reset
  • Show the last 5 counter values
4.

React Color Copy‑Paste Component

Data Structures & Algorithms·Medium

Build a React component that displays 4 boxes:

  • 3 colored boxes (Red, Green, Blue)
  • 1 empty white box Requirements:
  1. Clicking a colored box copies its color (first click).
  2. Store the selected color in state while the white box remains unchanged.
  3. Clicking the white box pastes the copied color (second click) and changes its background. The interaction must consist of exactly two clicks: copy then paste.
5.

React Stopwatch

Data Structures & Algorithms·Medium

Create a stopwatch component with the following functionality:

  • Start
  • Pause
  • Reset
6.

React User Sort Component

Data Structures & Algorithms·Medium

Given an array of user objects, build a React component that displays the users in a table and provides two buttons:

  • "Sort by Name" sorts users alphabetically (A‑Z).
  • "Sort by Age" sorts users from youngest to oldest. The UI should update immediately after sorting.
7.

Local vs Global State Decision

Behavioral

How do you decide what should be local state and what should be global state in a React application?

8.

Prevent Duplicate API Requests

Behavioral

How would you prevent duplicate API requests in a frontend application?

9.

Node.js Concurrency Handling

Behavioral

How does Node.js handle multiple concurrent requests if it runs on a single thread? Discuss the event loop, non‑blocking I/O, libuv, worker threads, and the OS thread pool.

10.

Node.js Performance Bottlenecks

Behavioral

When would Node.js become slow? Consider CPU‑intensive work, infinite loops, huge JSON parsing, synchronous filesystem calls, and large regular expressions.

11.

Async Print Numbers with Delay

Data Structures & Algorithms·Easy

Write an async function that prints numbers 1 to 5 with a 1‑second delay between each.

12.

Express Request Logger Middleware

Data Structures & Algorithms·Easy

Create a simple Express middleware that logs the request method, URL, and response time.

13.

Word Frequency Counter

Data Structures & Algorithms

Write a function that counts the frequency of each word in a given string.

14.

High‑Throughput Notification Service Design

System Design

Design a high‑throughput notification service that can send Email, SMS, and WhatsApp messages.

15.

API Optimization for 10,000 RPS

System Design

How would you optimize an API that needs to handle 10,000 requests per second?

16.

MongoDB Performance Troubleshooting

System Design

A MongoDB collection has 100 million documents and queries have become slow. What steps would you take to improve performance?

17.

Exactly‑Once Processing in Kafka

System Design

How do you ensure messages are not processed twice in Kafka?

18.

API Rate Limiter Design

System Design

Design a rate limiter for an API.

19.

Large File Upload Service Design

System Design

Design a file upload service that supports files up to 10 GB.

20.

Chat History Database Architecture

System Design

Design a database architecture to store and retrieve customer chat history similar to the chat view in ChatGPT.

📣 Found this helpful? Please share it with friends who are preparing for interviews!

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!