task_id
stringlengths
6
6
question
stringlengths
12
399
choices
sequencelengths
2
4
k00601
Which lifecycle method is called right before rendering a component?
[ "componentDidMount", "componentWillUpdate", "componentWillReceiveProps", "componentWillMount" ]
k00602
When does the componentWillUnmount lifecycle method get called?
[ "Before a component is mounted.", "After a component is unmounted and removed from the DOM.", "After a component's state has been updated.", "During the initial render of a component." ]
k00603
Which lifecycle method is used to handle errors that occur during rendering, in lifecycle methods, or in constructors of any child component?
[ "componentDidCatch", "componentDidUpdate", "componentWillUnmount", "componentDidMount" ]
k00604
When does the componentDidUpdate lifecycle method get called?
[ "Before a component is rendered.", "After a component is unmounted.", "After a component's state or props have been updated and it has re-rendered.", "During the initial render of a component." ]
k00605
What is a reducer in react-redux?
[ "Reducers are the fundamental method of updating the redux store", "Reducers are the only source of information for the store", "Reducers are plain JavaScript objects that have the type field", "Reducer takes the previous state and return a new state" ]
k00606
Which of the following is a feature of ContextAPI?
[ "ContextAPI cannot be directly used in the application", "ContextAPI directly sends information from parent to child at any level", "ContextAPI stops sending data to child elements", "ContextAPI encrypts data before sending" ]
k00607
Which of the following is not a method of redux store?
[ "getState()", "subscribe()", "dispact()", "render()" ]
k00608
What is the use of mapStateToProps() in redux?
[ "The method is used to render the stored data to the component.", "The method is used to render the action creators with props to the component.", "The method is used to connect redux to react props", "The method is used to render data fetched from APIs" ]
k00609
Which of the following is wrong about redux?
[ "Using redux data is easily passed between components", "Debugging and testing become easier with redux", "Redux offers state persistence", "Redux can only be used with React" ]
k00610
Which of the following handles passing props throughout the component tree without having to manually pass it to each and every level?
[ "useState", "useReducer", "useContext", "useEffects" ]
k00611
Which of the following handles passing props throughout the component tree without having to manually pass it to each and every level?
[ "useState", "useReducer", "useContext", "useEffects" ]
k00612
Which of the following handles passing props throughout the component tree without having to manually pass it to each and every level?
[ "useState", "useReducer", "useContext", "useEffects" ]
k00613
Advantages of useReducer over useState?
[ "Helps in giving amore predictable state transition", "Makes the state more manageable", "They have no side effects and return the same outcome given the same arguments", "All of the above" ]
k00614
Which of the following are examples of sideEffects in React?
[ "Data fetching", "Setting up a subscription", "Manually changing the DOM", "All of the above" ]
k00615
What is Conditional Rendering?
[ "It describes the ability to render different user interfaces if a condition is true or false", "It describes the ability to render a single user interface", "It is used for child to parent communication", "None of the above" ]
k00616
What is Conditional Rendering?
[ "It describes the ability to render different user interfaces if a condition is true or false", "It describes the ability to render a single user interface", "It is used for child to parent communication", "None of the above" ]
k00617
What is Conditional Rendering?
[ "It describes the ability to render different user interfaces if a condition is true or false", "It describes the ability to render a single user interface", "It is used for child to parent communication", "None of the above" ]
k00618
What is Conditional Rendering?
[ "It describes the ability to render different user interfaces if a condition is true or false", "It describes the ability to render a single user interface", "It is used for child to parent communication", "None of the above" ]
k00619
What is Conditional Rendering?
[ "It describes the ability to render different user interfaces if a condition is true or false", "It describes the ability to render a single user interface", "It is used for child to parent communication", "None of the above" ]
k00620
What is Conditional Rendering?
[ "It describes the ability to render different user interfaces if a condition is true or false", "It describes the ability to render a single user interface", "It is used for child to parent communication", "None of the above" ]
k00621
What is Conditional Rendering?
[ "It describes the ability to render different user interfaces if a condition is true or false", "It describes the ability to render a single user interface", "It is used for child to parent communication", "None of the above" ]
k00622
What is Conditional Rendering?
[ "It describes the ability to render different user interfaces if a condition is true or false", "It describes the ability to render a single user interface", "It is used for child to parent communication", "None of the above" ]
k00623
Which of the following are the lifecycles of a component in React? (Multiple options may be correct)
[ "Mounting", "Uploading", "Updating", "Unmounting" ]
k00624
What is false about keys in React
[ "Gives a unique identity", "Helps in re-rendering the desired component", "It is used for styling purposes", "All of the above" ]
k00625
What is false about keys in React
[ "Gives a unique identity", "Helps in re-rendering the desired component", "It is used for styling purposes", "All of the above" ]
k00626
The arbitrary inputs of components are called ___.
[ "Keys", "Props", "Elements", "Ref" ]
k00627
What is false about keys in React
[ "Gives a unique identity", "Helps in re-rendering the desired component", "It is used for styling purposes", "All of the above" ]
k00628
What is the best way to iterate through a list in React?
[ "For loop", "While loop", "For-each loop", "map()" ]
k00629
What is the best way to iterate through a list in React?
[ "For loop", "While loop", "For-each loop", "map()" ]
k00630
What is false about prop drilling in React?
[ "A situation when the same data is being sent at almost every level due to requirements in the final level", "useReducer is used to correct prop drilling", "useContect is used to correct prop drilling", "It causes inconvenience" ]
k00631
What is false about prop drilling in React?
[ "A situation when the same data is being sent at almost every level due to requirements in the final level", "useReducer is used to correct prop drilling", "useContect is used to correct prop drilling", "It causes inconvenience" ]
k00632
What is false about prop drilling in React?
[ "A situation when the same data is being sent at almost every level due to requirements in the final level", "useReducer is used to correct prop drilling", "useContect is used to correct prop drilling", "It causes inconvenience" ]
k00633
What is useEffect React Hook used for?
[ "To perform side effects to functional components", "Helps to avoid redundancy of code", "Groups together related codes", "All of the above" ]
k00634
What is useEffect React Hook used for?
[ "To perform side effects to functional components", "Helps to avoid redundancy of code", "Groups together related codes", "All of the above" ]
k00635
What is useEffect React Hook used for?
[ "To perform side effects to functional components", "Helps to avoid redundancy of code", "Groups together related codes", "All of the above" ]
k00636
What is useEffect React Hook used for?
[ "To perform side effects to functional components", "Helps to avoid redundancy of code", "Groups together related codes", "All of the above" ]
k00637
What is useEffect React Hook used for?
[ "To perform side effects to functional components", "Helps to avoid redundancy of code", "Groups together related codes", "All of the above" ]
k00638
What is useEffect React Hook used for?
[ "To perform side effects to functional components", "Helps to avoid redundancy of code", "Groups together related codes", "All of the above" ]
k00639
Advantages of useReducer over useState?
[ "Helps in giving amore predictable state transition", "Makes the state more manageable", "They have no side effects and return the same outcome given the same arguments", "All of the above" ]
k00640
What is false about keys in React
[ "Gives a unique identity", "Helps in re-rendering the desired component", "It is used for styling purposes", "All of the above" ]
k00641
Choose the right answer about JSX.
[ "JSX is faster as it performs optimization while compiling code to JavaScript", "JSX is a syntax notation for JavaScript XML", "JSX provides expressiveness of JavaScript along with HTML, like template syntax", "All of the above options" ]
k00642
What disadvantages does ReactJS have?
[ "It is only a view layer. You have to plug your code for Ajax requests, events, and so on.", "The library is pretty large.", "The learning curve can be slow.", "All of the above options" ]
k00643
What advantages does ReactJS have?
[ "Increases the application’s performance with Virtual DOM", "It renders both on the client and server-side", "Easy to integrate with other frameworks(Angular, BackboneJS) since it is only a view library", "All of the above" ]
k00644
What is the following is the use of ref in React.js ?
[ "for direct access to the DOM node", "for reference to another JS file", "for bind the function", "for calling a function" ]
k00645
Which of the following is a way for webpack command to do in React.js?
[ "Transpiles all of the javaScript into one", "local development server", "A and B are true", "None of the above" ]
k00646
Which of the following is needed to change the code for compilation? class date extends React.Component { render() { return <h1>Todays Date is : {this.props.date}</h1>; } }
[ "Remove this", "Capitalize date", "Remove the render", "The return value" ]
k00647
What is the correct way to set the default value for uncontrolled components ?
[ "Value property", "DefaultValue property", "Default property", "Assigns automatically" ]
k00648
What happens when a property is assigned to a method ?
[ "get()", "destructor()", "constructor()", "init()" ]
k00649
Which of the following react components act like function with respect to props ?
[ "Recursive functions", "Monads", "Pure functions", "Higher-order functions" ]
k00650
Which of the following is true about the catch the JavaScript error ?
[ "error helpers", "error catchers", "error bosses", "error boundaries" ]
k00651
Which of the following statement must be written in a class component heading
[ "extends React.Component", "extends React", "extends ReactDOM", "extends ReactRouer" ]
k00652
JSX allows us to write____
[ "BootStrap in React", "Jquery in React", "HTML in React", "MongoDB in React" ]
k00653
React is a ___
[ "Frontend Framework", "Backend Framework", "JavaScript Library", "JavaScript Module" ]
k00654
Which of the following is a basic hook in react?
[ "useReducer()", "useMemo()", "useCallback()", "useContext()" ]
k00655
What will happen if the following render() method executes?render(){let langs = ["Ruby","ES6","Scala"]return <div>{langs.map(it => <p>{it}</p>)}</div>}
[ "Displays the list of languages in the array", "Error. Cannot use direct JavaScript code in JSX", "Displays nothing", "Error. Should be replaced with a for..loop for correct output" ]
k00656
Which of the following is used to make data in-class components ?
[ "componentWillMount", "constructor", "componentDidMount", "componentWillReceiveProps" ]
k00657
Which of the following is used to increase the performance of the React.js ?
[ "Virtual DOM", "Original DOM", "Shallow DOM", "Both of the above" ]
k00658
Which of the following is true about the below syntax ? disabled = {false}
[ "rendered as disabled", "rendered at all", "rendered as enabled", "All of the above" ]
k00659
Which of the below category does react events come from ?
[ "Destruction", "Initialization", "State/Property Updates", "All of the above" ]
k00660
Which of the following is a way in which data get handled in React ?
[ "state", "props", "model", "A and B" ]
k00661
What is the output of the below code ? var Geeks=(props)=> { return( DSA Course 1 DSA Course 2 ); } ReactDOM.render(<DSA Course/>,mountNode)
[ "DSA Course 1", "DSA Course 2", "DSA Course 1 DSA Course 2", "Error" ]
k00662
Which of the following is called a message that is closed inside the curly braces? const messages="Hii Geeks"; const element =<p>{messages}<p>
[ "JS Function", "JS Element", "JS Expression", "JSX Wrapper" ]
k00663
Which below hooks in React js allows to directly create a reference to the DOM element ?
[ "useHook", "useState", "useEffect", "useRef" ]
k00664
Which of the following is the correct output of the below code. If a component is called Geeks and is rendered to another Dom which element will be rendered ? function Geeks(){ return <h1> geeks For geeks </h1> ReactDOM.render(,document.getElementById(\'root\')); }
[ "div", "section", "h1", "component" ]
k00665
Which of the below methods is used to render react content on an HTML page ?
[ "React.mount()", "ReactDOM.start()", "ReactDOM.render()", "React.render()" ]
k00666
What will happen if you call setState() inside render() method?
[ "Repetitive output appears on the screen", "Duplicate key error", "Stack overflow error", "Nothing happens" ]
k00667
Which of the following is the correct syntax for a button click event handler foo?
[ "<button onclick={this.foo()}>", "<button onclick={this.foo}>", "<button onClick={this.foo()}>", "<button onClick={this.foo}>" ]
k00668
Which of the following methods in a React Component is called after the component is rendered for the first time?
[ "componentDidUpdate", "componentDidMount", "componentMounted", "componentUpdated" ]
k00669
What is used to pass data to a component from outside?
[ "setState", "render with arguments", "PropTypes", "props" ]
k00670
Which of the following is the class-based component in React.js ?
[ "class", "factory", "render", "props" ]
k00671
Which is the right way of accessing a function fetch() from an h1 element in JSX?
[ "<h1>{fetch()}</h1>", "<h1>${fetch()}</h1>", "<h1>{fetch}</h1>", "<h1>${fetch}</h1>" ]
k00672
Which of the below expression is required to write the JSX ?
[ "{}", "[]", "\"\"", "()" ]
k00673
Which of the following is the current definition of components?
[ "Components are the HTML elements.", "Components are the set of variables defined in ReactJS.", "Components are independent and reusable code that return HTML elements", "None of the above" ]
k00674
How do you write an inline style which specifies the font-size:12px and color:red; in JSX?
[ "style={{font-size:12,color:'red'}}", "style={{fontSize:'12px',color:'red'}}", "style={fontSize:'12px',color:'red'}", "style={{font-size:12px,color:'red'}}" ]
k00675
In which of the following directory React.js components are saved?
[ "Inside the js/components/", "Inside the vendor/components/", "Inside the external/components/", "Inside the vendor/" ]
k00676
What are the two ways to handle data in React?
[ "State & Props", "Services & Components", "State & Services", "State & Components" ]
k00677
How many ways of defining your variables in ES6?
[ "1", "2", "3", "5" ]
k00678
What is the declarative way to render a dynamic list of components based on values in an array?
[ "Using the reduce array method", "Using the <Each /> component", "Using the Array.map() method", "With a for/while loop" ]
k00679
What is the default port where webpack-server runs?
[ "3000", "8080", "3030", "6060" ]
k00680
In which version strict mode was introduced in React?
[ "12.3", "16.3", "14.3", "13.3" ]
k00681
Which function is used to retrieve the current state in Redux?
[ "getState", "setState", "reduce", "action" ]
k00682
Which function is used to dispatch action in Redux?
[ "getState", "setState", "reduce", "dispatch" ]
k00683
What is the global object to manage state in redux called?
[ "Store", "File", "Library", "Database" ]
k00684
What flow does flux design pattern follow in Redux?
[ "Bidirectional", "Multi-Directional", "One to many", "Unidirectional" ]
k00685
In which React lifecycle method should you perform asynchronous operations like making API calls or setting up timers?
[ "componentWillMount", "componentDidMount", "componentDidUpdate", "componentWillUnmount" ]
k00686
What is the output of the below code snippets ? import React from \'react\'; import ReactDOM from \'react-dom\'; const Component=()=> { return <h1>This is Quiz Portal</h1> } ReactDOM.render( <Component />, document.getElementById("root") );
[ "Component", "This is Quiz Portal", "Error in code", "None of the above" ]
k00687
Which React lifecycle method is called after a component has been rendered to the DOM?
[ "componentWillMount", "componentDidMount", "componentDidUpdate", "componentWillUnmount" ]
k00688
To get the first item from the array ("cooking") using array destructuring, how do you adjust this line?const topics = ['cooking', 'art', 'history'];
[ "const topics = ['cooking', 'art', 'history'];", "const [] = [\"cooking\", \"art\", \"history\"]", "const [, first][\"cooking\", \"art\", \"history\"]", "const [first] = [\"cooking\", \"art\", \"history\"]" ]
k00689
What do you need to change about this code to get it to run?class clock extends React.Component {render() {return <h1>Look at the time: {this.props.time}</h1>;}}
[ "Remove this", "Capitalize clock", "Remove the render method", "Add quotes around the return value" ]
k00690
what is the outputconst name = 'Venkat'; const age = 30; const person = { name, age }; console.log(person);
[ "{{name: \"Venkat\", age: 30}}", "{name: \"Venkat\", age: 30}", "{person: \"Venkat\", person: 30}}", "{person: {name: \"Venkat\", age: 30}}" ]
k00691
What happens when the following render() method executes?render(){let langs = ["Ruby","ES6","Scala"]return (<div>{langs.map(it => <p>{it}</p>)}</div>)}
[ "Error. Cannot use direct JavaScript code in JSX", "Error. Should be replaced with a for..loop for correct output", "Displays the list of languages in the array", "Displays nothing" ]
k00692
How do you write an inline style specifying the font-size:12px and color:red; in JSX
[ "style={{font-size:12,color:'red'}}", "style={{fontSize:'12px',color:'red'}}", "style={fontSize:'12px',color:'red'}", "style={{font-size:12px,color:'red'}}" ]
k00693
Which method in a React Component should you override to stop the component from updating?
[ "willComponentUpdate", "shouldComponentUpdate", "componentDidUpdate", "componentDidMount" ]
k00694
In which of the following condition, the React.js Lifecycle method static getDerivedSateFromProps(props, state) is called?
[ "The component is created for the first time.", "The state of the component is updated.", "Both of the above.", "None of the above." ]
k00695
Which technique is used in React Memo?
[ "Hashing", "Memoization", "Sorting", "Pipelining" ]
k00696
What is the correct definition of prop drilling?
[ "Concept of passing data as props through intermediate components until data is reached where it is required.", "Concept of passing data between sibling components", "Concept of passing data to required destination as states until data is reached where it is required", "Concept of passing data inside the component itself" ]
k00697
What is the correct syntax for  arrow function?
[ "()", "=>", "()=>", ">=()" ]
k00698
Which of the following is the correct definition of state?
[ "It is a temporary storage of elements", "It is the internal storage of components", "It is used to know about the current state of the element", "It is the permanent storage of elements" ]
k00699
How many types of components are there in react?
[ "1", "2", "3", "4" ]
k00700
How do you access the updated state value immediately after calling the setState function with the useState hook?
[ "It's automatically available in the next line of code.", "You need to use a callback function provided as the second argument to setState.", "You can't access it immediately; you need to use the useEffect hook.", "You can access it" ]