
Coding Interview - Python, Java, Programming, AI Tools & Tech News
June 12, 2025 at 06:20 PM
*Coding interview questions with concise answers for software roles*:
*1️⃣ What happens when you type a URL and hit Enter?*
*Answer:*
- DNS Lookup → IP address
- Browser sends HTTP/HTTPS request
- Server responds with HTML/CSS/JS
- Browser builds DOM, applies styles (CSSOM), runs JS
- Page is rendered
*2️⃣ Difference between var, let, and const?*
*Answer:*
- `var`: function-scoped, hoisted
- `let`: block-scoped, not hoisted
- `const`: block-scoped, can’t be reassigned
*3️⃣ Reverse a String in JavaScript*
```js
function reverseString(str) {
return str.split('').reverse().join('');
}
```
*4️⃣ Find the max number in an array*
```js
const max = Math.max(...arr);
```
*5️⃣ Write a function to check if a number is prime*
```js
function isPrime(n) {
if (n < 2) return false;
for (let i = 2; i <= Math.sqrt(n); i++) {
if (n % i === 0) return false;
}
return true;
}
```
*6️⃣ What is closure in JavaScript?*
*Answer:*
A function that remembers variables from its outer scope even after the outer function has returned.
*7️⃣ What is event delegation?*
*Answer:*
Attaching a single event listener to a parent element to manage events on its children using `event.target`.
*8️⃣ Difference between == and ===*
*Answer:*
- `==` checks value (with type coercion)
- `===` checks value + type (strict comparison)
*9️⃣ What is the Virtual DOM?*
*Answer:*
A lightweight copy of the real DOM used in React. React updates the virtual DOM first and then applies only the changes to the real DOM for efficiency.
*🔟 Write code to remove duplicates from an array*
```js
const uniqueArr = [...new Set(arr)];
```
*React ❤️ for more*
❤️
♥
❤
👍
25