Frameworks Quiz - Languages JavaScript
Free practice quiz: Frameworks (Languages JavaScript). 52 multiple-choice questions with answers and explanations. Play online, no sign-up needed.
Play all 52 questions freeSample questions
Which of the following is a client-side JavaScript framework primarily used for building user interfaces?
- Node.js
- React
- Express.js
- AngularJS (AngularJS 1.x)
Show answer
Answer: B. React
React is a popular JavaScript library (often referred to as a framework) for building user interfaces, primarily focused on the view layer of an application. Node.js and Express.js are backend technologies, and AngularJS (the older version) is also a client-side framework but React has a different architectural approach.
Which of the following is a characteristic of Svelte?
- It relies heavily on a virtual DOM.
- It compiles components into highly efficient imperative JavaScript code at build time.
- It is primarily a library for managing application state.
- It requires a runtime library on the client for all its functionality.
Show answer
Answer: B. It compiles components into highly efficient imperative JavaScript code at build time.
Svelte is a compiler. Instead of using a virtual DOM or shipping a runtime library, Svelte compiles your components into small, vanilla JavaScript modules that efficiently update the DOM when state changes.
Which React lifecycle method is invoked immediately after a component's updates are flushed to the DOM?
- componentDidMount
- shouldComponentUpdate
- componentDidUpdate
- getSnapshotBeforeUpdate
Show answer
Answer: C. componentDidUpdate
`componentDidUpdate()` is called after the component updates and the changes have been rendered to the DOM. `getSnapshotBeforeUpdate()` is called before the DOM changes.
Which of the following is a meta-framework built on top of React, providing features like SSR, SSG, and API routes?
- Angular
- Vue.js
- Next.js
- Ember.js
Show answer
Answer: C. Next.js
Next.js is a popular React framework that enables Server-Side Rendering (SSR) and Static Site Generation (SSG) for server-rendered React applications, as well as API routes for building backends.
What is the purpose of `React.memo`?
- To create a higher-order component.
- To memoize a functional component, preventing re-renders if its props have not changed.
- To manage state in functional components.
- To define prop types for a component.
Show answer
Answer: B. To memoize a functional component, preventing re-renders if its props have not changed.
`React.memo` is a higher-order component that memoizes a functional component. It performs a shallow comparison of the component's props. If the props are the same, React skips re-rendering the component and reuses the last rendered result.