Front end Developer

filter-iconFilter interviews by

800+ Front end Developer Interview Questions and Answers

Updated 8 Mar 2025

Popular Companies

search-icon

Q101. What is Redux, and what are the differences between Redux and Context?

Ans.

Redux is a predictable state container for JavaScript apps. It helps manage the state of an application in a centralized way.

  • Redux is a state management library commonly used with React to manage the state of an application.

  • It follows a unidirectional data flow pattern, where the state is stored in a single store and changes are made through actions and reducers.

  • Redux allows for a more structured way of managing state compared to local component state in React.

  • Context, on the...read more

Q102. What is the difference between visibility: hidden and display: none in CSS?

Ans.

visibility: hidden hides an element but still takes up space, while display: none hides an element and removes it from the flow of the document.

  • visibility: hidden hides the element but it still occupies space on the page

  • display: none hides the element and removes it from the document flow

  • visibility: hidden elements are still rendered, just not visible

  • display: none elements are not rendered at all

Q103. What is the difference between synchronous and asynchronous functions, and how are they created?

Ans.

Synchronous functions block the code execution until they are completed, while asynchronous functions allow the code to continue running without waiting for them to finish.

  • Synchronous functions execute one after the other in a sequential manner.

  • Asynchronous functions allow other code to run while waiting for a task to complete.

  • Asynchronous functions are typically created using callbacks, promises, or async/await syntax.

  • Example: Synchronous function - const result = getData();...read more

Q104. How to analyze and opttimize website performance?

Ans.

Analyze and optimize website performance by monitoring loading times, reducing server requests, optimizing images, and using caching techniques.

  • Monitor loading times using tools like Google PageSpeed Insights or GTmetrix

  • Reduce server requests by combining CSS and JavaScript files, minifying code, and using asynchronous loading

  • Optimize images by resizing them, using the correct file format, and lazy loading

  • Implement caching techniques like browser caching, server-side caching,...read more

Are these interview questions helpful?

Q105. What is the method to find the missing number in a series of an array?

Ans.

Use the formula n*(n+1)/2 to find the missing number in an array series.

  • Sum all numbers in the array using a loop

  • Calculate the expected sum of the series using the formula n*(n+1)/2

  • Subtract the sum of the array from the expected sum to find the missing number

Q106. How to get data from a NoSQL database in a fast and efficient manner?

Ans.

To get data from a NoSQL database in a fast and efficient manner, utilize indexing, denormalization, caching, and optimizing queries.

  • Utilize indexing to quickly locate and retrieve data.

  • Denormalize data to reduce the number of queries needed.

  • Implement caching mechanisms to store frequently accessed data.

  • Optimize queries by using appropriate query language and techniques.

  • Consider sharding or partitioning data for scalability.

  • Use asynchronous programming to handle multiple requ...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q107. What is the Same-origin policy?
Ans.

Same-origin policy is a security measure in web browsers that restricts how a document or script loaded from one origin can interact with a resource from another origin.

  • It prevents a web page from making requests to a different domain than the one it was loaded from.

  • It helps protect user data and prevent malicious attacks like cross-site scripting (XSS).

  • Cross-origin resource sharing (CORS) headers can be used to relax the same-origin policy in certain situations.

Q108. What's the difference between event bubbling and capturing?

Ans.

Event bubbling and capturing are two ways of propagating events in the DOM tree.

  • Event capturing is the process of triggering the outermost element's event first and then moving towards the innermost element.

  • Event bubbling is the process of triggering the innermost element's event first and then moving towards the outermost element.

  • Event capturing is rarely used in practice, while event bubbling is the default behavior in most browsers.

  • Event.stopPropagation() can be used to st...read more

Front end Developer Jobs

FrontEnd Developer (UI) 3-8 years
A.P. Moller Maersk
4.2
₹ 25 L/yr - ₹ 40 L/yr
Bangalore / Bengaluru
Front End Developer - Reactjs 6-9 years
Cognizant
3.7
Pune
Frontend Developer 2-6 years
MSD Pharmaceuticals Private Limited
4.2
Hyderabad / Secunderabad

Q109. what is the diffrent between let var and cost

Ans.

let, var, and const are all used to declare variables in JavaScript, but they have different scopes and behaviors.

  • let has block scope, meaning it is only accessible within the block it is declared in.

  • var has function scope, meaning it is accessible throughout the function it is declared in.

  • const is used to declare constants, its value cannot be reassigned once it is initialized.

  • Using let and const helps avoid common bugs like variable hoisting and accidental reassignments.

  • Exa...read more

Q110. 1. Difference between client-side and server side scripting? 2. What is destructuring? 3. What is HOC? 4. Write code to combine nested array 5. Write code to count the number of vowels in a string

Ans.

1. Client-side scripting runs on the user's browser, while server-side scripting runs on the server. 2. Destructuring is a way to extract values from objects and arrays. 3. HOC stands for Higher Order Component in React. 4. Combining nested arrays involves flattening them into a single array. 5. Counting vowels in a string involves iterating through the characters and checking if they are vowels.

  • Client-side scripting executes on the user's browser, while server-side scripting...read more

Q111. How you manage state in React application

Ans.

State in React is managed using useState hook for functional components and this.state for class components.

  • Use useState hook for managing state in functional components

  • Use this.state for managing state in class components

  • State can be passed down to child components using props

  • State can be updated using setState method

Q112. Do you try every new framework comes in the market

Ans.

I do not try every new framework that comes in the market, but I do stay updated on the latest trends and evaluate them based on project requirements.

  • I prioritize learning frameworks that align with the project needs

  • I assess the pros and cons of new frameworks before deciding to use them

  • I stay updated on industry trends and experiment with new frameworks in personal projects

Q113. What are arrow functions in JavaScript?
Ans.

Arrow functions are a concise way to write functions in JavaScript.

  • Arrow functions are defined using the '=>' syntax.

  • They have a shorter syntax compared to traditional function expressions.

  • They do not have their own 'this' keyword, instead they inherit it from the parent scope.

  • Example: const add = (a, b) => a + b;

Q114. Remove duplicates from string array. Array to matrix conversion.

Ans.

Remove duplicates from string array and convert array to matrix.

  • Use a Set to remove duplicates from the string array.

  • To convert the array to a matrix, determine the number of rows and columns and then populate the matrix accordingly.

  • Example: ['apple', 'banana', 'apple', 'orange'] can be converted to [['apple', 'banana'], ['orange']]

Q115. How to pass data in components using Vue js and react js?

Ans.

Data can be passed in components using props in Vue.js and React.js.

  • In Vue.js, data can be passed down to child components using props.

  • In React.js, data can be passed down to child components using props as well.

  • In Vue.js, props are defined in the parent component and passed down to the child component.

  • In React.js, props are passed down from parent to child components as attributes.

Q116. If we give both id and class to an element which one's style will apply first

Ans.

The style of the id will apply first before the style of the class.

  • IDs have higher specificity than classes, so the style of the id will take precedence over the style of the class.

  • If both id and class have conflicting styles, the style of the id will be applied.

  • Example: <div id='uniqueId' class='commonClass'>...</div> - the style of 'uniqueId' will be applied.

Q117. What is redux ? How can we joint react with redux

Ans.

Redux is a predictable state container for JavaScript apps.

  • Redux helps manage the state of an application in a predictable way

  • It provides a central store for all the state of the application

  • React components can access the state from the store using the connect() function

  • Actions are dispatched to the store to update the state

  • Reducers are pure functions that update the state based on the dispatched actions

Q118. What are the three stages of event propagation and how to handle it

Ans.

Event propagation consists of three stages: capturing, target, and bubbling.

  • Capturing phase: Events are captured from the outermost element to the target element.

  • Target phase: Event reaches the target element where the event originated.

  • Bubbling phase: Events bubble up from the target element to the outermost element.

Q119. Why use redux and what difference between redux and context Api .

Ans.

Redux is a predictable state container for JavaScript apps, while Context API is a feature in React for managing global state.

  • Redux is more suitable for complex state management and large-scale applications.

  • Redux provides a single source of truth for the application state, making it easier to debug and trace changes.

  • Context API is simpler to use and is built into React, making it easier to get started with global state management.

  • Context API is more suitable for smaller appli...read more

Q120. How can we use component will unmount method in functional components by using hooks

Ans.

Unmounting logic can be implemented using useEffect hook with a return statement.

  • Use useEffect hook with a return statement to implement unmounting logic

  • Return a function from useEffect hook to execute cleanup logic

  • Cleanup logic can include clearing intervals, removing event listeners, etc.

Q121. What are callbacks in JavaScript?
Ans.

Callbacks in JavaScript are functions passed as arguments to other functions, to be executed later.

  • Callbacks are commonly used in asynchronous operations, such as event handling or AJAX requests.

  • They allow for more flexible and dynamic programming, by defining behavior that should happen after a certain event or task is completed.

  • Example: setTimeout function in JavaScript takes a callback function as an argument to be executed after a specified time.

Q122. What is interceptor and where using and how to add interceptor for only selected requests?

Ans.

Interceptors are middleware functions that can be used to intercept and modify HTTP requests and responses.

  • Interceptors can be used in Angular to modify requests before they are sent to the server or responses before they are delivered to the application.

  • To add an interceptor for only selected requests, you can create a custom interceptor class that implements the HttpInterceptor interface and then provide it in the HTTP_INTERCEPTORS multi-provider array.

  • You can then use cond...read more

Q123. Tell the five background properties in CSS

Ans.

Background properties in CSS are used to control the background of an element.

  • background-color: sets the background color of an element

  • background-image: sets an image as the background of an element

  • background-repeat: specifies how a background image should repeat

  • background-position: sets the starting position of a background image

  • background-size: specifies the size of the background image

Q124. What tools and techniques to do you use for debugging and optimizing JavaScript Performance?

Ans.

I use browser developer tools, console.log, performance profiling, and code review for debugging and optimizing JavaScript performance.

  • Utilize browser developer tools like Chrome DevTools for debugging and profiling

  • Use console.log statements to log values and debug code

  • Perform performance profiling to identify bottlenecks and optimize code

  • Conduct code reviews to identify potential performance issues and suggest improvements

Q125. Fetch the API with proper error handling and async await?

Ans.

To fetch an API with proper error handling and async await, use try-catch block and await keyword.

  • Use the fetch() function to make the API request.

  • Wrap the fetch() call in a try-catch block to handle errors.

  • Use the await keyword before the fetch() call to wait for the response.

  • Check the response status code to handle different scenarios.

  • Handle any errors or exceptions that may occur during the API request.

Q126. In html span is a tag or not

Ans.

Yes, span is a tag in HTML used to apply styles to inline elements.

  • Span is an inline element used to apply styles to a specific section of text or content.

  • It does not add any extra space or line breaks.

  • Example: <span style='color: red;'>This text will be red</span>

Q127. What is AOT compilation in Angular?
Ans.

AOT compilation in Angular stands for Ahead-of-Time compilation, which compiles Angular templates and components during the build process.

  • AOT compilation improves the performance of Angular applications by pre-compiling the templates and components before the browser downloads and runs them.

  • It detects template errors during the build process rather than at runtime, leading to faster rendering and reduced bundle size.

  • AOT compilation eliminates the need for the Angular compiler...read more

Q128. How can you include external CSS and JavaScript files in an HTML document.

Ans.

External CSS and JavaScript files can be included in an HTML document using the <link> and <script> tags.

  • Use the <link> tag with the 'rel' attribute set to 'stylesheet' to include external CSS files.

  • Use the <script> tag with the 'src' attribute to include external JavaScript files.

  • Make sure to specify the correct file path in the 'href' attribute for CSS files and 'src' attribute for JavaScript files.

Q129. What is the DOCTYPE declaration in HTML, and why is it important

Ans.

DOCTYPE declaration in HTML specifies the version of HTML being used in the document.

  • DOCTYPE declaration is placed at the very beginning of an HTML document before the <html> tag.

  • It informs the web browser about the version of HTML being used, which helps in rendering the page correctly.

  • It also helps in triggering the browser's standards mode, ensuring consistent display across different browsers.

  • Example: <!DOCTYPE html> specifies the document is using HTML5.

Q130. how can you pass data child component to the parent component

Ans.

Using props and callback functions to pass data from child to parent component in React

  • Passing data from child to parent can be achieved by defining a callback function in the parent component and passing it down to the child component as a prop

  • The child component can then call this callback function with the data as an argument, allowing the parent component to update its state with the passed data

  • Example: Parent component defines a callback function handleData and passes it...read more

Q131. Develop a simple todo app with add and remove option. Using useState, useEffect hook and persistent storage to keep data in memory.

Ans.

A simple todo app with add and remove option using useState, useEffect hook and persistent storage.

  • Create a functional component with a form to add new tasks

  • Use useState hook to manage the list of tasks

  • Use useEffect hook to save and retrieve data from local storage

  • Add a button to remove tasks from the list

  • Style the app with CSS or a UI library like Material-UI

Q132. What is computer in your language

Ans.

A computer is an electronic device that can perform various tasks by executing instructions given to it.

  • A computer is made up of hardware components such as CPU, memory, and storage devices.

  • It runs on an operating system and software applications.

  • Computers can be used for various purposes such as communication, entertainment, and work.

  • Examples of computers include desktops, laptops, tablets, and smartphones.

Q133. What is denbouncer and throttle

Ans.

Debouncer and throttle are techniques used to limit the frequency of function calls.

  • Debouncing delays the execution of a function until a certain amount of time has passed without the function being called again.

  • Throttling limits the frequency of function calls to a certain rate, executing the function at fixed intervals.

  • Debouncing is useful for events that may be triggered multiple times in quick succession, such as resizing a window.

  • Throttling is useful for events that need...read more

Q134. What are components in Angular?
Ans.

Components in Angular are reusable building blocks that encapsulate HTML, CSS, and TypeScript logic.

  • Components are the basic building blocks of Angular applications.

  • They consist of an HTML template, CSS styles, and TypeScript code.

  • Components help in organizing the application into smaller, reusable pieces.

  • They can communicate with other components using @Input and @Output decorators.

  • Example: A 'navbar' component can be created to display navigation links across the applicatio...read more

Q135. what is virtual dom in react and what makes it faster ?

Ans.

Virtual DOM is a lightweight copy of the actual DOM in React, allowing for efficient updates and rendering.

  • Virtual DOM is a representation of the actual DOM in memory.

  • React compares the virtual DOM with the actual DOM to identify changes.

  • Only the differences between the virtual and actual DOM are updated, making it faster.

  • Example: When a user interacts with a React component, the virtual DOM is updated first before the actual DOM.

Q136. Are you willing to work as Back end developer if needed ?

Ans.

Yes, I am willing to work as a Back end developer if needed.

  • I have experience with both front end and back end technologies.

  • I am open to learning new skills and technologies.

  • Being versatile in both front end and back end development can make me a valuable asset to the team.

Q137. Your are a Full Stack developer ,why would you like to work in front end developer only ?

Ans.

I enjoy focusing on front end development as it allows me to specialize and excel in creating user-friendly interfaces.

  • I have a passion for creating visually appealing and interactive user interfaces.

  • I excel in front end technologies such as HTML, CSS, and JavaScript.

  • I enjoy the creativity and design aspect of front end development.

  • I believe specializing in front end development will allow me to hone my skills and become an expert in this area.

Q138. what is box model? What is Clousers ? let var and const difference

Ans.

Box model is a concept in CSS where every HTML element is considered as a rectangular box with content, padding, border, and margin.

  • Content is the actual content of the element

  • Padding is the space between the content and the border

  • Border is the line that surrounds the padding and content

  • Margin is the space between the border and the adjacent elements

  • Box-sizing property can be used to change the default box model behavior

Q139. Design a frontend application on the case study given.

Ans.

Design a frontend application for a healthcare management system.

  • Include user authentication for healthcare professionals and patients.

  • Implement features for scheduling appointments, viewing medical records, and sending messages.

  • Ensure HIPAA compliance for data security and privacy.

  • Design a user-friendly interface with easy navigation and accessibility.

  • Integrate telemedicine capabilities for virtual consultations.

Q140. Why you prefer to use react for build large scale application?

Ans.

React is preferred for building large scale applications due to its component-based architecture, virtual DOM for efficient updates, and strong community support.

  • Component-based architecture allows for reusability and easier maintenance of code.

  • Virtual DOM enables efficient updates by only re-rendering components that have changed.

  • Strong community support provides access to a wide range of libraries, tools, and resources for development.

  • React's one-way data flow and state man...read more

Q141. what are the different array methods in js?

Ans.

JS has various array methods like push, pop, shift, unshift, splice, slice, forEach, map, filter, reduce, etc.

  • push() - adds one or more elements to the end of an array

  • pop() - removes the last element from an array

  • shift() - removes the first element from an array

  • unshift() - adds one or more elements to the beginning of an array

  • splice() - adds or removes elements from an array

  • slice() - returns a new array with a portion of the original array

  • forEach() - executes a provided funct...read more

Q142. 1. if you want to retain the state in react what you should do

Ans.

Use React's state management to retain state in components.

  • Use the useState hook to create and update state variables

  • Use the setState method to update state in class components

  • Use context API or Redux for managing state across multiple components

Q143. What is HTML, and what is its role in web development?

Ans.

HTML stands for Hypertext Markup Language and is the standard markup language for creating web pages.

  • HTML is used to structure content on the web by using a series of elements and tags.

  • It provides the basic building blocks for creating websites, such as headings, paragraphs, images, links, and forms.

  • HTML works in conjunction with CSS (Cascading Style Sheets) and JavaScript to create visually appealing and interactive web pages.

  • Example: <h1>This is a heading</h1>, <p>This is a...read more

Q144. Major difference between class based components and class based components

Ans.

There is no difference between class based components and class based components.

  • There seems to be a typo in the question.

  • Assuming the question is about functional components vs class components, the major difference is that class components use a class to define the component while functional components are defined as functions.

  • Class components have access to lifecycle methods while functional components do not.

  • Functional components are simpler and easier to read and write.

  • E...read more

Q145. What is html and diffrence between html and HTML5?

Ans.

HTML is a markup language used to create the structure of web pages. HTML5 is the latest version with new features and improvements.

  • HTML stands for HyperText Markup Language and is used to create the structure of web pages.

  • HTML5 is the latest version of HTML with new features like <video>, <audio>, <canvas>, and more.

  • HTML5 introduced new semantic elements like <header>, <footer>, <nav>, <article>, <section>, <aside>, and <main>.

  • HTML5 supports multimedia elements, form validat...read more

Q146. What is a service in Angular?
Ans.

A service in Angular is a reusable piece of code that can be injected into components to provide specific functionality.

  • Services are singleton objects in Angular that are instantiated only once during the lifetime of an application.

  • They are used to encapsulate logic and data that can be shared across multiple components.

  • Services can be injected into components, directives, and other services using Angular's dependency injection system.

  • Examples of services in Angular include H...read more

Q147. What are the key features of SCSS

Ans.

SCSS is a preprocessor scripting language that is a superset of CSS, adding features like variables, nesting, and mixins.

  • Variables allow for reusable values throughout a stylesheet

  • Nesting helps to keep styles organized and easier to read

  • Mixins allow for reusable blocks of styles to be included in other selectors

  • SCSS supports operations like math calculations and functions

  • SCSS can be compiled into regular CSS for use in web development

Q148. What motivates you to join protocolzone

Ans.

I am motivated to join ProtocolZone because of their innovative projects and collaborative team environment.

  • Exciting projects at ProtocolZone

  • Collaborative team environment

  • Opportunity for growth and learning

  • Alignment with company values and mission

Q149. How we do error handling in js ?

Ans.

Error handling in JavaScript involves using try-catch blocks, throwing errors, and using error objects.

  • Use try-catch blocks to catch errors and handle them gracefully

  • Throw errors using the throw keyword to indicate when something goes wrong

  • Use error objects like Error, SyntaxError, TypeError, etc. to provide more information about the error

  • Handle asynchronous errors using promises and the .catch() method

Q150. What is the method for arranging a box diagonally inside another box?

Ans.

Use CSS transform property with rotate and translate functions to arrange a box diagonally inside another box.

  • Use CSS position property to position the inner box relative to the outer box

  • Apply CSS transform property with rotate function to rotate the inner box diagonally

  • Use translate function within the transform property to move the inner box to the desired position

Previous
1
2
3
4
5
6
7
Next
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

Interview experiences of popular companies

3.7
 • 10.5k Interviews
3.8
 • 8.2k Interviews
3.6
 • 7.6k Interviews
3.7
 • 5.6k Interviews
3.7
 • 5.6k Interviews
3.7
 • 4.8k Interviews
3.5
 • 3.8k Interviews
4.0
 • 2.4k Interviews
2.4
 • 13 Interviews
View all

Calculate your in-hand salary

Confused about how your in-hand salary is calculated? Enter your annual salary (CTC) and get your in-hand salary

Recently Viewed
JOBS
Sibca Electronics
No Jobs
INTERVIEWS
Abk Imports
No Interviews
DESIGNATION
INTERVIEWS
Perficient
No Interviews
INTERVIEWS
Perficient
No Interviews
JOBS
Tippers Trailers
No Jobs
JOBS
Total IT Consult
No Jobs
INTERVIEWS
Perficient
20 top interview questions
INTERVIEWS
Perficient
No Interviews
JOBS
Freture Techno
No Jobs
Front end Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter