NEW
Font size
WorksheetsFrontend - CTO Cup
Total questions: 20
Worksheet time: 15mins
What is in the console?
1
2
9
undefined
What is in the console?
1
0
"true"
true
What is in the console?
true
false
What is in the console?
string
number
1
true
What is in the console?
NaN
3
5
7
Who is this?
Who is this?
Who is this?
Who is this?
What is the main goal of Cross-Site Scripting (XSS) attacks?
To inject malicious SQL queries into a database
To trick users into providing sensitive information
To execute malicious scripts in the victim’s browser
To force users to change their passwords
Which of the following methods helps prevent Cross-Site Request Forgery (CSRF)?
Using a CAPTCHA
Adding a CSRF token to forms
Implementing password complexity rules
Validating the format of input fields
How can a frontend developer help prevent XSS attacks?
By validating user input on the client-side
By escaping or sanitizing HTML content
By disabling JavaScript in the browser
By using strong encryption on all forms
How does the Content Security Policy (CSP) header help mitigate security risks like XSS?
It prevents users from submitting forms without validation
It restricts the types of resources (e.g., scripts) that can be loaded on a webpage
It forces users to log in using multi-factor authentication
It encrypts data sent between the browser and the server
How does React’s useMemo hook help optimize performance in a component?
By memoizing component rendering
By preventing re-rendering of child components
By caching the results of expensive function calculations between renders
By avoiding side effects in functional components
What happens when you pass a function as the second argument to setState in a class component?
The function will be executed after the state has been updated
The function will replace the current state instead of merging it
The function receives the previous state and props, and updates state based on them
The function is used to force the component to re-render immediately
What is the primary purpose of React’s useEffect hook?
To manage component state
To handle side effects in functional components
To define how a component should render
To create a context for global state management
What is the virtual DOM in React?
A real-time copy of the browser’s DOM
A lightweight representation of the real DOM for improved performance
A database for storing React components
A debugging tool used by React developers
What is NOT a state management library?
Zustand
MobX
Redux
Fuse
What is the difference between getStaticProps and getServerSideProps in Next.js?
getStaticProps runs at build time, while getServerSideProps runs on every request
getStaticProps is for client-side data fetching, while getServerSideProps is for server-side fetching
getStaticProps is used for API routes, while getServerSideProps is used for page routes
There is no difference; they are interchangeable
What feature of Next.js allows for both static generation and server-side rendering in the same application?
Incremental Static Regeneration (ISR)
Dynamic Routing
Static Exports
Client-Side Rendering (CSR)
