Sample exam questions

by Mateusz Pawełkiewicz published 2025/04/10 21:49:04 GMT+1, last modified 2025-04-10T21:49:04+01:00

Sample exam questions

Authorization and Data Storage

What are cookies in the context of web applications?
What attributes can we set for cookies and what do they mean (Secure, HttpOnly, SameSite, etc.)?
What is the difference between localStorage and sessionStorage?
What is a JWT token and how does it work in a frontend application?
How to securely store a JWT on the client side? What are the pros and cons of different methods?
What is the process of token refreshing (refresh token) on the frontend side?
What is a route guard and what is it used for?
How to create a route that is only available to logged-in users?
How to hide or show a layout or UI elements (e.g., menu) depending on whether the user is logged in?
How can the frontend detect that an access token has expired and automatically refresh it?

Components and Architecture

What is component-based architecture in a frontend application?
What is the difference between a “dumb” (presentational) component and a “smart” (container) component?
How to pass data from a parent component to a child component?
How to pass a callback (e.g., a method) from a parent component to a child component?
How can a child component send data back to the parent?
How to communicate between two sibling components?
What is the component lifecycle and what are its stages?
When is the best time to fetch data in the component lifecycle?
How does component unmounting work and why is it important to clean up resources?
How does React Strict Mode work and why are components rendered twice in development mode?

State and Logic

What are good practices for state management in a frontend application?
What is "lifting state up" and when should it be used?
When is it worth using the Context API?
How do React hooks like useEffect and useState work?
How to create a component with a custom hook?
How to manage forms and their validation in a modern frontend application?

Testing

What is a unit test and why is it worth writing them?
What is the difference between unit, integration, and end-to-end tests?
How to test a simple JavaScript function (e.g., summing numbers)?
How to write a test for a frontend component (e.g., rendering with props)?
What tools are used for frontend testing (Jest, Testing Library, etc.)?

Debugging and Tools

What are the ways to debug a frontend application?
How to set a breakpoint in the browser and inspect application state?
How to track network requests in DevTools?
How to analyze errors in the console and what do common JavaScript errors mean?
How to use the debugger statement and what is it for?

Backend Communication

What is the difference between synchronous and asynchronous requests?
What is the difference between fetch and the Axios library?
How to make a GET and POST request to an API using fetch?
How to handle errors in fetch or Axios requests?
How to send a JWT token in the request header?
How to set up a proxy in the frontend dev server and why would you do that?

JavaScript and TypeScript

What is the difference between an arrow function and a regular function?
What is the spread operator (...) and how can it be used in arrays and objects?
How to merge two JavaScript objects into one?
What are array and object destructuring in JavaScript?
How does "use strict" work and what changes in JavaScript behavior?
How to define and use types in TypeScript (number, string, array)?
What is the difference between type and interface in TypeScript?
How to type functions in TypeScript (parameters and return type)?
How to define a generic type in TypeScript?
How to set a type for a component with props in TypeScript?

Styling and Preprocessors

What is the difference between CSS and preprocessors like SASS and LESS?
What are the benefits of CSS preprocessors (e.g., variables, nesting)?
How does a variable in SASS work and how to use it in styles?
How do inheritance and mixins work in SASS?

Routing and Layout

How to configure routing in a frontend application?
How to add a layout that only displays after login (e.g., menu)?
How to redirect the user if they are not logged in?
How to pass parameters (e.g., ID) through the URL in routing?