🚀 React Interview Experience (August 2025): CapGemini(Part-1)
Overview
This case study presents a React developer interview experience at CapGemini in August 2025. The interview focused on assessing the candidate's understanding of core JavaScript concepts, including variable hoisting, scope, and immediately invoked function expressions (IIFEs), as well as React Router fundamentals.
Interview Rounds
The interview consisted of a series of technical questions designed to evaluate the candidate's knowledge and problem-solving abilities. The questions covered the following topics:
-
Question 1: Variable declaration and hoisting with
var.var a; console.log(a); a = 20; console.log(a); var a = 30;Expected Output:
undefined 20 -
Question 2: Variable declaration and scope with
let.let a; let a = 20; console.log(a);Expected Output:
SyntaxError: Identifier 'a' has already been declared -
Question 3: Variable declaration and initialization with
const.const a; a = 20; console.log(a)Expected Output:
SyntaxError: Missing initializer in const declaration -
Question 4: Variable declaration and initialization with
const(again).const a; console.log(a)Expected Output:
SyntaxError: Missing initializer in const declaration -
Question 5: Hoisting of functions and function expressions.
foo(); var foo = function() { console.log("foo"); } bar(); function bar() { console.log("bar"); }Expected Output:
TypeError: foo is not a function -
Question 6: Immediately Invoked Function Expressions (IIFEs) and semicolon insertion.
(function(){ console.log('abc'); })() ( () => { console.log('abc'); })();Expected Output:
abc TypeError: undefined is not a function -
Question 7: Array
mapmethod with arrow functions and function expressions.
arr.map((ele) => ele / 2);
arr.map(function(ele){ return ele / 2; }); ```
**Expected Output:** Both code snippets produce the same output. For example, if `arr = [2, 4, 6, 8]`, the output would be `[1, 2, 3, 4]`.
-
Question 8: Object property access.
const obj = {a: 10, b:20} console.log(a) console.log(b) obj.a , obj.bExpected Output:
ReferenceError: a is not defined -
Question 9: Destructuring and Temporal Dead Zone (TDZ).
const {a, b} = obj; const obj = {a: 10, b:20} console.log(c) console.log(d) const { c, d } = obj; const {a: c, b:d} = obj; let a = 1, b = 2, c= 3;Expected Output:
ReferenceError: Cannot access 'obj' before initialization -
Question 10: React Router path matching.
<Route path="/users" comp={C1} /> <Route path="/users/count" comp={C2} />Expected Output: With React Router v5, visiting
/users/countrenders bothC1andC2. Visiting/usersrendersC1only.
Key Takeaways
- A strong understanding of JavaScript fundamentals, including hoisting, scope, and the Temporal Dead Zone, is crucial for React developers.
- The ability to predict the output of code snippets involving these concepts is essential for passing technical interviews.
- Candidates should be familiar with React Router's path-matching behavior and how to control it using the
exactprop (v5) or by understanding the default behavior in v6. - Attention to detail, such as the presence or absence of semicolons, can significantly impact the execution of JavaScript code.
Original Source
This experience was originally published on medium. Support the author by visiting the original post.
Read on medium