Viva Questions

INT252

Unit I Refreshing JavaScript Easy
1
In the context of rendering lists in React, why do we prefer using the .map() array method over .forEach()?
Unit I ReactJS Installation & JSX Intermediate
2
If I write a standard HTML 'class' attribute inside JSX, React throws a warning. Why does this happen, and what is the underlying technical reason regarding JavaScript?
Unit I ES6 Refresher Intermediate
3
Scenario: You have a state object with user details. You want to update only the email address while keeping the rest of the properties intact. Which ES6 operator would you use and how?
Unit II React Virtual DOM Hard
4
Explain the concept of 'Reconciliation' in React. How does the Virtual DOM minimize performance costs compared to the real DOM?
Unit II Components and styles in React Easy
5
What is the primary difference in scope between standard CSS stylesheets and CSS Modules in React?
Unit II Components (Functional vs Class) Intermediate
6
Before Hooks were introduced, what was a major limitation of Functional Components compared to Class Components?
Unit III Understanding Hooks Intermediate
7
If I put a console.log immediately after a setFunction in useState (e.g., setCount(5); console.log(count)), I usually see the old value. Why?
Unit III Understanding Hooks Hard
8
Compare useMemo and useCallback. In what specific scenario would you choose useCallback over useMemo?
Unit III Component Lifecycle Intermediate
9
In a Class Component, we use componentWillUnmount to clean up resources. How do we achieve this exact same behavior using the useEffect hook?
Unit III Understanding Hooks Intermediate
10
What happens if you use the useRef hook to store a value and then change that value? Does it trigger a re-render?
Unit III Events Easy
11
In React, event handlers are often named in camelCase (e.g., onClick). Is this the same as the native DOM onclick event?
Unit IV Working with Forms Intermediate
12
Explain the difference between a 'Controlled' and an 'Uncontrolled' component in the context of React forms.
Unit IV Handling forms Easy
13
When submitting a form in React, we almost always call e.preventDefault() as the first line in the handler. Why?
Unit V Routing Intermediate
14
Why should we use the <Link> component from React Router instead of a standard HTML <a> tag for navigation?
Unit V HTTP Methods Intermediate
15
Compare Axios and Fetch. Since Fetch is built into the browser, why does the syllabus include Axios? What is one convenience Axios offers?
Unit V Routing Hard
16
Scenario: You need to pass a specific Product ID from a list page to a details page via the URL. How do you define this in the Route, and how do you access it in the destination component?
Unit VI Redux Hard
17
In Redux, reducers must be 'pure functions'. If I need to update an array in the Redux store, why is it wrong to use .push()?
Unit VI Redux Intermediate
18
Briefly explain the 'Unidirectional Data Flow' in Redux.
Unit VI Debugging and Deployment Easy
19
When you run the command 'npm run build', what is being generated in the 'build' or 'dist' folder?
Unit VI Debugging the React App Intermediate
20
Code Defense: You see a warning in the console saying 'Each child in a list should have a unique key prop'. Why shouldn't you just use the array index as the key?
Unit I Refreshing JavaScript Easy
21
What is the specific advantage of using the 'Arrow Function' syntax when passing a callback to an event handler in a Class Component?
Unit I Refreshing JavaScript Intermediate
22
Explain 'Object Destructuring' in the context of receiving Props. Why do developers prefer ({ name, age }) over (props) in the function signature?
Unit I ReactJS Installation Easy
23
When you look at the folder structure created by Vite or Create React App, what is the purpose of the 'public' folder versus the 'src' folder?
Unit I JSX Expressions Intermediate
24
Can I use an if-else statement directly inside a JSX expression (inside the curly braces)? Why or why not?
Unit II Components and styles Easy
25
What is the 'children' prop in React, and how is it different from a standard prop like 'title'?
Unit II CSS in React Intermediate
26
When using Inline Styling in React, why do we write backgroundColor instead of the standard CSS background-color?
Unit II Props Intermediate
27
React enforces 'Unidirectional Data Flow'. If a child component needs to communicate with a parent component, how is this achieved using Props?
Unit II Components Hard
28
Code Defense: I have a Functional Component that calculates a heavy mathematical value on every render, causing lag. Which specific Hook should I use to fix this and how?
Unit III Understanding Hooks Easy
29
What is the first rule of Hooks regarding where they can be called inside a component?
Unit III useContext Intermediate
30
Scenario: You have a 'Theme' (Light/Dark) that needs to be accessed by a button nested 5 levels deep. Why is useContext better than passing props here?
Unit III Component Lifecycle Intermediate
31
Which lifecycle phase is associated with the useEffect hook when the dependency array is missing entirely (not empty, but omitted)?
Unit III useReducer Hard
32
When would you prefer useReducer over useState for managing local component state?
Unit III Custom Hooks Intermediate
33
What is a 'Custom Hook' technically? Does it share state between the components that use it?
Unit IV Forms validation Easy
34
In a controlled form, what prop must be set on the <input> element to ensure React controls the data?
Unit IV Handling forms Intermediate
35
Scenario: You have a form with 10 input fields. Instead of creating 10 separate handleNameChange, handleEmailChange, etc., functions, how can you write one generic change handler?
Unit IV Forms Hard
36
What happens if you pass the value undefined or null to a controlled input's value prop initially, and then later update it to a string?
Unit V HTTP Methods Easy
37
In the context of a CRUD application, which HTTP method is typically used to update an existing resource, and which is used to create a new one?
Unit V Routing Intermediate
38
What is the difference between useParams and useSearchParams (or query parameters)?
Unit V Fetching data Intermediate
39
If you perform a fetch call inside a useEffect, why is it important to use a dependency array []?
Unit V Routing Easy
40
In React Router, what does the <Outlet /> component do?
Unit V HTTP Methods Hard
41
When using fetch(), if the server returns a 404 error, does the code enter the .catch() block? Why or why not?
Unit VI Redux Easy
42
What is a 'Store' in Redux?
Unit VI Redux Intermediate
43
Explain the role of an 'Action' in Redux. What two properties does it typically have?
Unit VI Connecting Components (Redux) Intermediate
44
In modern Redux (Hooks), which hook is used to read data from the store, and which hook is used to trigger state changes?
Unit VI Redux Hard
45
Why can't we perform asynchronous operations (like API calls) directly inside a Redux Reducer?
Unit VI Debugging Easy
46
What is the specific browser extension recommended for inspecting the Component hierarchy and Props in a React app?
Unit VI Deployment Intermediate
47
Why do we set an environment variable like NODE_ENV to 'production' before deploying?
Unit III State vs Props Easy
48
In one sentence, what is the key difference between State and Props regarding ownership?
Unit I ES6 Refresher Easy
49
What does the .filter() array method return?
Unit III Events Intermediate
50
If I want to access the underlying DOM element inside a functional component to set focus manually, which Hook should I use?