Front end Developer
700+ Front end Developer Interview Questions and Answers
You have been given an integer array/list 'ARR' of size 'N'. Write a solution to check if it could become non-decreasing by modifying at most 1 element.
We define an array as non-decreasing,...read more
The solution checks if an integer array can become non-decreasing by modifying at most one element.
Iterate through the array and check if there are more than one decreasing pairs of elements.
If there are more than one decreasing pairs, return false.
If there is only one decreasing pair, check if modifying one of the elements can make the array non-decreasing.
If modifying the element at index i-1 or i can make the array non-decreasing, return true.
Otherwise, return false.
You have been given an integer array/list(ARR) of size N. Where N is equal to [2M + 1].
Now, in the given array/list, 'M' numbers are present twice and one number is present only once.
You need to fi...read more
The task is to find the unique number in an array where all other numbers occur twice.
The array size is given by N = 2M + 1, where M is the number of elements occurring twice.
Loop through the array and use a hashmap to count the occurrences of each number.
Return the number with a count of 1, as it is the unique number.
Front end Developer Interview Questions and Answers for Freshers
You have been given an undirected graph of ‘V’ vertices (labelled from 0 to V-1) and ‘E’ edges. Each edge connecting two nodes u and v has a weight denoting the distance between them.
Yo...read more
The question is about finding the shortest path distance from a source node to all vertices in an undirected graph.
The graph is represented by the number of vertices and edges, followed by the edges and their distances.
The task is to find the shortest path distance from the source node (0) to all other nodes.
If a node is disconnected from the source node, print the maximum positive integer value (2147483647).
Implement the function and return the shortest path distances in asc...read more
You have been given an N-ary tree ‘N’ nodes with node ‘1’ as head of the tree. Encode the above N-ary tree into a binary tree such that if only the encoded binary tree was given ...read more
The task is to encode an N-ary tree into a binary tree and then decode the binary tree back into the original N-ary tree.
Encode the N-ary tree by representing each node as a binary tree node with its first child as the left child and subsequent children as the right child.
To decode the binary tree, traverse the binary tree and for each node, create a new N-ary tree node with its left child as the first child and subsequent right children as siblings.
Use a level order traversa...read more
You are given a Singly Linked List of integers which is sorted based on absolute value.
You have to sort the Linked List based on actual values.
The absolute value of a real number x, denoted |...read more
The task is to sort a singly linked list based on actual values instead of absolute values.
Traverse the linked list and store the values in an array
Sort the array using any sorting algorithm
Create a new linked list using the sorted array
Return the new linked list
You are given an array consisting of 'N' positive integers where each integer is either 0 or 1 or 2. Your task is to sort the given array in non-decreasing order.
Note :
1. The array consists of only ...read more
Share interview questions and help millions of jobseekers 🌟
You are given a Singly Linked List of integers. You have to find if the given linked list is palindrome or not.
A List is a palindrome if it reads the same from the left to the...read more
You are given a directed and unweighted graph of 'V' vertices and 'E' edges. All edges are given in a 2-dimensional array ‘Edges’ in which ‘Edges[i][0]’ and ‘Edges[i][1]’ contain an edge. Yo...read more
The task is to check if there exists a path from a given source vertex to a destination vertex in a directed and unweighted graph.
Read the number of test cases.
For each test case, read the number of vertices and edges.
Read the edges of the graph.
Read the source and destination vertices.
Implement a graph traversal algorithm (e.g., BFS or DFS) to check if a path exists from the source to the destination.
Print 'true' if a path exists, otherwise print 'false'.
Front end Developer Jobs
You are given a sorted array A consisting of N integers. Your task is to find the magic index in the given array.
Note :
A magic index in an array A[0 ... N - 1] is defined to be an index i such that...read more
You are given a Binary Tree. You are supposed to return the length of the diameter of the tree.
The diameter of a binary tree is the length of the longest path between any two end nodes i...read more
The diameter of a binary tree is the length of the longest path between any two end nodes in the tree.
The diameter of a binary tree can be calculated by finding the maximum of the following three values: 1) the diameter of the left subtree, 2) the diameter of the right subtree, and 3) the longest path that passes through the root node.
To find the diameter of a binary tree, we can use a recursive approach. We calculate the height of the left and right subtrees, and then calcul...read more
You are given a string 'S'. Your task is to check whether the string is palindrome or not. For checking palindrome, consider alphabets and numbers only and ignore the symbols ...read more
You have been given ‘K’ different arrays/lists, which are sorted individually (in ascending order). You need to merge all the given arrays/list such that the output array/list should be sor...read more
Ninja is playing with numbers but hates when he gets duplicate numbers. Ninja is provided an array, and he wants to remove all duplicate elements and return the array, but he has to maintain th...read more
You are given a string ‘STR’ containing space-separated words. A word is a sequence of non-space characters. Your task is to reverse the order of words in ‘STR’.
Note: Try ...read more
Given an array ‘arr’ of integer numbers . where ‘arr[i]’ represents the number of pages in the ‘i-th’ book. There are ‘m’ number of students and the task is to allocate all the books to their stud...read more
Get the frogs and the lilypads line up in order (e.g. yellow lilypad is the first among all other lilypads and yellow frog is first among all other frogs) using flex-direction.
Arrange the fr...read more
You have been given a Linked List having ‘N’ nodes and an integer ‘K’. You have to rotate the Linked List by ‘K’ positions in a clockwise direction.
Example :
Given Linked List : 1 2 3 4 -1 a...read more
There is a wedding ceremony at NinjaLand. The bride and groom want everybody to play a game and thus, they have blindfolded the attendees. The people from the bride’s side are holding odd numb...read more
You are given a paragraph that may have letters both in lowercase and uppercase, spaces, and punctuation. You have also given a list of banned words. Now your task is to find the most frequent...read more
Take two numbers as input and swap them and print the swapped values.
Input Format:
The first line of input contains a single integer 't', representing the total number of test cases. The second...read more
You are given an array/list ARR consisting of N integers. Your task is to find all the distinct triplets present in the array which adds up to a given number K.
An array is said to have a...read more
Q22. How to redirect to login page through React Router if the user has not logged in and trying to go to another page through URL.
Use React Router's Redirect component to redirect to login page if user is not logged in.
Create a PrivateRoute component that checks if user is logged in
If user is not logged in, redirect to login page using Redirect component
Wrap the routes that require authentication with PrivateRoute component
Given an array/list of integer numbers 'CHOCOLATES' of size 'N', where each value of the array/list represents the number of chocolates in the packet. There are ‘M’ number of students and the t...read more
You are given a webpage design and you have to code the same using html, CSS, core Js
The candidate is asked to code a given webpage design using HTML, CSS, and core JavaScript.
Understand the webpage design thoroughly before starting the coding process.
Use HTML to structure the content of the webpage.
Apply CSS to style the webpage according to the design.
Utilize core JavaScript to add interactivity and functionality to the webpage.
Ensure cross-browser compatibility and responsiveness of the webpage.
Test the webpage thoroughly to identify and fix any bugs or is...read more
Q25. How can you only accept jpg and png files using HTML5.
Use the 'accept' attribute in the input tag to specify accepted file types.
Add the 'accept' attribute to the input tag.
Set the value of the 'accept' attribute to 'image/jpeg, image/png'.
You are given an integer ’N’ denoting the length of the array ‘Arr’ of strings made up of lower case English alphabets. The cost of this array is equal to the sum of length of each string in the ...read more
You have been given a sorted (lexical order) dictionary of an alien language. Write a function that finds the order of characters in the alien language. This dictionary will be given to you in t...read more
Design and implement a data structure for Least Recently Used (LRU) cache to support the following operations:
1. get(key) - Return the value of the key if the key exists in the cache, o...read more
First, he asked me about different meta tags in HTML and different types of CSS media queries.
Then he asked me questions about Promise and async-await. I need to create a function that takes ...read more
How would you handle transaction failures?
How can we check if the transaction happening is a genuine or fraud?
What was your role in your resume projects? Why and when did you coded it?
To handle transaction failures, implement error handling and rollback mechanisms. To check for fraud, use fraud detection algorithms and verification processes. Role in projects: coding, testing, and deployment.
Implement error handling and rollback mechanisms to handle transaction failures
Use fraud detection algorithms and verification processes to check for fraud
Role in projects: coding, testing, and deployment
Projects coded as per requirements and timeline
You are given a positive integer N, your task is to find all the Jumping Numbers smaller than or equal to N.
A number is defined as a Jumping Number if all adjacent digits in it have an absolute ...read more
I was told to build a compound interest calculator where we need to store the previous calculation, ability to modify/delete them. There were 2 bonus features like store data in local storage ...read more
How do you ensure that your website design or web application is accessible and user-friendly? How do you structure your CSS and JavaScript to make it easier for other developers to work with...read more
You are given a binary tree having ‘N’ distinct nodes and an integer ‘M’, you have to return the postorder successor of ‘M’.
Note:
The postorder successor of ‘M’ is defined as the next elemen...read more
Given a string, determine if it is a palindrome, considering only alphanumeric characters.
Palindrome
A palindrome is a word, number, phrase, or other sequences of characters which read the sam...read more
You are given the ‘N’ processes with their “burst times”, and the “arrival time” for all processes is ‘0’. You are also given the ‘priority’ of each process.
Your task...read more
What are the different lifecycle methods in React?
Explain Strict Mode in React.
How to prevent re-renders in React?
Lifecycle methods in React, Strict Mode, and preventing re-renders.
Lifecycle methods in React include componentDidMount, componentDidUpdate, componentWillUnmount, etc.
Strict Mode is a tool for highlighting potential problems in React components.
To prevent re-renders in React, use shouldComponentUpdate or React.memo.
What happens when you call a function with the new keyword?
Create a Stopwatch using HTML, CSS, and JS
Create an input form using HTML, CSS, and JS
Create some basic structure using HTML, CSS, and JS. I can't remember it but it was also some ...read more
Q40. How to center align a div in just one line in css.
Use flexbox to center align a div in just one line in CSS.
Set the parent container's display property to flex.
Use the justify-content property with the value 'center' to horizontally center the div.
Use the align-items property with the value 'center' to vertically center the div.
What are the data types in Javascript?
What are the features of HTML-5?
Q43. Is Javascript single thread or multithread?
Javascript is single-threaded.
Javascript runs on a single thread called the event loop.
This means that it can only execute one task at a time.
However, it can delegate tasks to other threads using web workers.
This allows for parallel processing without blocking the main thread.
What is the return type of getElementsByClass method?
Q45. implement a calculator class which does this cal.add(2).sub(3).mul(4).delay(2000).add(4) etc
Implement a calculator class with chaining methods and delay function.
Create a Calculator class with add, sub, mul methods that return the instance of the class.
Implement a delay method that uses setTimeout and returns the instance of the class.
Use a queue to store the operations and execute them in order after the delay.
Return the result of the operations when the equals method is called.
What is Prototype Chaining in JS?
1) What is currying in Javascript?
2) Explain hoisting with a code snippet.
3) What does this return (typeof null) ?
4) What is callback hell?
We were given a Figma link for a landing page of a website. We need to pixel-perfect that design.
How can you import all exports of a file as an object in JavaScript?
What is the typeof() operator?
Interview Questions of Similar Designations
Top Interview Questions for Front end Developer Related Skills
Interview experiences of popular companies
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
Reviews
Interviews
Salaries
Users/Month