Search test library by skills or roles
⌘ K

Adaface Sample React Questions

Here are some sample React questions from our premium questions library (10273 non-googleable questions).

Skills

🧐 Question

Hard

Context re-renders
React Context API
Conditional Rendering
Component Lifecycle State
Solve
Review the following React code:
 image
Pick the correct statements:
            
            A: The code renders 10 INDIAN RUPEE
            B: The code renders 10 SINGAPORE DOLLAR
            C: The code does not render anything and throws an error since JavaScript objects are not valid as React children
            D: When the currency portion is clicked, the parent component is re-rendered
            E: When the currency portion is clicked, parent component will skip the re-render because shouldComponentUpdate returns false
            F: Parent component can be converted to a functional component with memoization (useMemo or memo) to avoid the re-render

Medium

Hooks with Conditional Rendering
Hooks
Conditional Rendering
Event Handling
Solve
Consider a React functional component that utilizes various hooks and conditional rendering. The component is designed to fetch and display a list of items from an API, with the ability to filter the list based on user input. Here's the pseudo-code structure:
 image
In this component, which of the following is a potential issue or inefficiency?
A: The component will re-render excessively due to the `setFilter` call.
            B: The `useEffect` hook will run on every render, causing performance issues.
            C: The `fetchItems` function may cause a memory leak if the component unmounts during the fetch.
            D: The `useMemo` hook for `filteredItems` is unnecessary and can be removed without impact.
            E: The component will fail to display items when the filter is cleared.
            F: There are no significant issues; the component is implemented optimally.

Medium

Rhyme Reducer
Reducer functions
Immutable update patterns
Lazy initialization
Solve
Which of the following React code snippets
            - triggers the reducer ‘rhymeReducer’ to update the ‘song’ value to ‘Jack and Jill’
            - renders the updated ‘song’ value
            - does not produce any errors/warnings
 image
 image

Hard

State Handling with Custom Hooks
Custom Hooks
Context API
Event Handling
Solve
Consider a React application where a custom hook `useComplexState` is defined to manage a complex state object. The application also uses the Context API to pass down the state and dispatch function. Below is the pseudo-code for the custom hook and a component using it:
 image
Given this setup, which of the following statements best describes the potential issue or challenge with `MyComponent`?
A: The component will not re-render when the global state changes.
            B: The `fetchData` function will cause an infinite loop of re-renders.
            C: The component will lose its state when the global state updates.
            D: There will be a memory leak due to improper cleanup in `useEffect`.
            E: The `dispatch` function from `useComplexState` will conflict with the global dispatch.
            F: There is no issue; the component is implemented correctly.
🧐 Question🔧 Skill

Hard

Context re-renders
React Context API
Conditional Rendering
Component Lifecycle State

3 mins

React
Solve

Medium

Hooks with Conditional Rendering
Hooks
Conditional Rendering
Event Handling

3 mins

React
Solve

Medium

Rhyme Reducer
Reducer functions
Immutable update patterns
Lazy initialization

3 mins

React
Solve

Hard

State Handling with Custom Hooks
Custom Hooks
Context API
Event Handling

3 mins

React
Solve
🧐 Question🔧 Skill💪 Difficulty⌛ Time
Context re-renders
React Context API
Conditional Rendering
Component Lifecycle State
React
Hard3 mins
Solve
Hooks with Conditional Rendering
Hooks
Conditional Rendering
Event Handling
React
Medium3 mins
Solve
Rhyme Reducer
Reducer functions
Immutable update patterns
Lazy initialization
React
Medium3 mins
Solve
State Handling with Custom Hooks
Custom Hooks
Context API
Event Handling
React
Hard3 mins
Solve

Trusted by recruitment teams in enterprises globally

Amazon Morgan Stanley Vodafone United Nations HCL PayPal Bosch WeWork Optimum Solutions Deloitte Microsoft NCS Doubtnut Sokrati J&T Express Capegemini

We evaluated several of their competitors and found Adaface to be the most compelling. Great library of questions that are designed to test for fit rather than memorization of algorithms.


Swayam Narain, CTO, Affable

hashtag image heart icon Swayam
customers across world
Join 1500+ companies in 80+ countries.
Try the most candidate friendly skills assessment tool today.
g2 badges
Ready to streamline your recruitment efforts with Adaface?
Ready to streamline your recruitment efforts with Adaface?
logo
40 min tests.
No trick questions.
Accurate shortlisting.
ada
Ada
● Online
Previous
Score: NA
Next
✖️