Frontend Developer Intern
100+ Frontend Developer Intern Interview Questions and Answers

Asked in Encore Capital Group

Q. Last Stone Weight Problem Explanation
Given a collection of stones, each having a positive integer weight, perform the following operation: On each turn, select the two heaviest stones and smash them together. ...read more
This question is about finding the weight of the last stone after repeatedly smashing the two heaviest stones together.
Sort the array of stone weights in descending order.
Repeatedly smash the two heaviest stones until there is at most 1 stone left.
If there is 1 stone left, return its weight. Otherwise, return 0.

Asked in Samsung

Q. Reverse Linked List Problem Statement
Given a singly linked list of integers, return the head of the reversed linked list.
Example:
Initial linked list: 1 -> 2 -> 3 -> 4 -> NULL
Reversed linked list: 4 -> 3 -> 2...read more
Reverse a singly linked list of integers and return the head of the reversed linked list.
Iterate through the linked list and reverse the pointers to point to the previous node instead of the next node.
Use three pointers to keep track of the current, previous, and next nodes while reversing the linked list.
Update the head of the reversed linked list as the last node encountered during the reversal process.
Frontend Developer Intern Interview Questions and Answers for Freshers

Asked in Samsung

Q. Cousins of a Given Node in a Binary Tree
Given a binary tree with 'N' nodes and a specific node in this tree, you need to determine and return a sorted list of the values of the node's cousins. The cousins shou...read more
Given a binary tree and a specific node, return a sorted list of the values of the node's cousins.
Traverse the binary tree to find the parent of the given node and its depth.
Traverse the tree again to find nodes at the same depth but with different parents.
Return the sorted list of cousin node values or -1 if no cousins exist.

Asked in Daffodil Software

Q. Find the Second Largest Element
Given an array or list of integers 'ARR', identify the second largest element in 'ARR'.
If a second largest element does not exist, return -1.
Example:
Input:
ARR = [2, 4, 5, 6, ...read more
Find the second largest element in an array of integers.
Iterate through the array to find the largest and second largest elements.
Handle cases where all elements are identical.
Return -1 if a second largest element does not exist.

Asked in Nagarro

Q. Maximum Sum Path in a Binary Tree
Your task is to determine the maximum possible sum of a simple path between any two nodes (possibly the same) in a given binary tree of 'N' nodes with integer values.
Explanati...read more
Find the maximum sum of a simple path between any two nodes in a binary tree.
Use a recursive approach to traverse the binary tree and calculate the maximum sum path.
Keep track of the maximum sum path found so far while traversing the tree.
Consider all possible paths between any two nodes in the tree to find the maximum sum.

Asked in Amazon

Q. Rat in a Maze Problem Statement
You need to determine all possible paths for a rat starting at position (0, 0) in a square maze to reach its destination at (N-1, N-1). The maze is represented as an N*N matrix w...read more
Find all possible paths for a rat in a maze from source to destination.
Use backtracking to explore all possible paths in the maze.
Keep track of visited cells to avoid revisiting them.
Recursively move in all directions (up, down, left, right) until reaching the destination.
Return the list of valid paths sorted in alphabetical order.
Frontend Developer Intern Jobs




Asked in VMware Software

Q. Reverse the String Problem Statement
You are given a string STR
which contains alphabets, numbers, and special characters. Your task is to reverse the string.
Example:
Input:
STR = "abcde"
Output:
"edcba"
Input...read more
Reverse a given string containing alphabets, numbers, and special characters.
Create a function that takes a string as input
Use built-in functions like reverse() or loop through the string to reverse it
Return the reversed string

Asked in Samsung

Q. Trie Data Structure Implementation
Design and implement a Trie (prefix tree) to perform the following operations:
insert(word)
: Add a string "word" to the Trie.search(word)
: Verify if the string "word" exists...read more
Implement a Trie data structure to insert, search, and determine if a string starts with a given prefix.
Create a TrieNode class with children and isEndOfWord attributes.
Implement insert() to add words by traversing the Trie.
Implement search() to check if a word exists by traversing the Trie.
Implement startsWith() to check if any word starts with a given prefix.
Use lowercase English letters a-z for words.
Handle queries efficiently based on constraints.
Share interview questions and help millions of jobseekers 🌟

Asked in Samsung

Q. Gold Mine Problem Statement
You are provided with a gold mine, represented as a 2-dimensional matrix of size N x M with N rows and M columns. Each cell in this matrix contains a positive integer representing th...read more
The task is to determine the maximum amount of gold a miner can collect by moving in allowed directions in a 2D gold mine matrix.
Create a function that takes the gold mine matrix and dimensions as input
Implement a dynamic programming approach to find the maximum amount of gold that can be collected
Consider the constraints and optimize the solution for efficiency
Traverse the matrix from left to right, calculating the maximum gold that can be collected at each cell based on the...read more

Asked in Quikr

Q. Subsequences of String Problem Statement
You are provided with a string 'STR'
that consists of lowercase English letters ranging from 'a' to 'z'. Your task is to determine all non-empty possible subsequences of...read more
Generate all possible subsequences of a given string.
Use recursion to generate all possible subsequences by including or excluding each character in the string.
Maintain the order of characters while generating subsequences.
Handle base cases where the string is empty or has only one character.
Example: For input 'abc', possible subsequences are 'a', 'ab', 'abc', 'ac', 'b', 'bc', 'c'.

Asked in Oyo Rooms

Implement Stack with Linked List
Your task is to implement a Stack data structure using a Singly Linked List.
Explanation:
Create a class named Stack
which supports the following operations, each in O(1) time:
Implement a Stack data structure using a Singly Linked List with operations in O(1) time.
Create a class named Stack with getSize, isEmpty, push, pop, and getTop methods.
Implement the Stack using a Singly Linked List for efficient operations.
Ensure each operation runs in O(1) time complexity.
Handle queries to print size, check if empty, push, pop, and get top element of the stack.
Test the implementation with sample input and output provided.

Asked in TCS

Q. Find Duplicates in an Array
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any order. If n...read more
Find duplicates in an array of integers within a specified range.
Iterate through the array and keep track of the count of each element using a hashmap.
Return elements with count greater than 1 as duplicates.
Handle edge cases like empty array or no duplicates found.
Example: For input [0, 3, 1, 2, 3], output should be [3].

Asked in Amazon

Q. Pair Sum Problem Statement
You are provided with an array ARR
consisting of N
distinct integers in ascending order and an integer TARGET
. Your objective is to count all the distinct pairs in ARR
whose sum equal...read more
Count the number of distinct pairs in an array whose sum equals a given target.
Iterate through the array and for each element, check if the complement (target - current element) exists in a hash set.
If the complement exists, increment the count of pairs and add the current element to the hash set.
Return the count of pairs at the end.

Asked in GoComet

Q. Remove Consecutive Duplicates Problem Statement
Given a string str
of size N
, your task is to recursively remove consecutive duplicates from this string.
Input:
T (number of test cases)
N (length of the string f...read more
Recursively remove consecutive duplicates from a given string.
Iterate through the string and remove consecutive duplicates using recursion.
Keep track of the current character and compare it with the next character.
If they are the same, remove the next character and continue recursively until no consecutive duplicates are left.

Asked in Josh Technology Group

A todo list application using localstorage.
Use HTML, CSS, and JavaScript to create the user interface.
Use the localstorage API to store and retrieve todo items.
Implement features like adding, editing, and deleting todo items.
Display the list of todo items and their status.
Allow users to mark todo items as completed or incomplete.
Asked in CA Monk

Q. Can we send the state from the child component to the parent component?
Yes, we can send the state from a child component to a parent component in React.
Use callback functions to pass data from child to parent
Parent component can pass a function as a prop to child component
Child component can call this function with the data to update parent's state

Asked in FoodVybe

Q. Create a responsive template using pure CSS (flex, grid, media query) without using any library or framework!
Creating a responsive template using pure CSS without any library or framework.
Start with a mobile-first approach
Use media queries to adjust layout for different screen sizes
Utilize flexbox and/or grid for layout and positioning
Test on multiple devices and browsers
Asked in CA Monk

Q. Can we make a custom hook? How can we make custom hooks and what purpose?
Yes, custom hooks are reusable functions in React that allow you to extract component logic into separate functions.
Custom hooks are created by prefixing the function name with 'use' and can be used to share logic between components.
They can be used to manage state, side effects, and other features in functional components.
For example, a custom hook can be created to fetch data from an API and handle loading and error states.
Custom hooks can also be used to encapsulate comple...read more
Asked in CA Monk

Q. What is React Query? Have you used it in any of your projects?
React Query is a library for managing server state in React applications.
React Query is used for fetching, caching, synchronizing and updating server state in React applications.
It provides hooks like useQuery and useMutation to interact with server data.
React Query helps in handling loading, error and stale data states efficiently.
Example: const { data, isLoading, isError } = useQuery('todos', fetchTodos)

Asked in Samsung

The four pillars of OOP are encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation: Bundling data and methods that operate on the data into a single unit.
Inheritance: Allowing a new class to inherit properties and behaviors from an existing class.
Polymorphism: The ability for objects of different classes to respond to the same message in different ways.
Abstraction: Hiding the complex implementation details and showing only the necessary features of an object.

Asked in FoodVybe

Q. How did you implement the API in your code?
I have implemented APIs in my code using various methods such as AJAX, fetch, and axios.
Used AJAX to make asynchronous requests to the server and retrieve data
Used fetch API to make HTTP requests and handle responses
Used axios library to handle HTTP requests and responses
Implemented RESTful APIs to interact with the server
Used API documentation to understand the endpoints and parameters

Asked in Josh Technology Group

Higher order functions are functions that can take other functions as arguments or return functions as their results.
Higher order functions can be used to create more flexible and reusable code.
They enable functional programming paradigms.
Examples of higher order functions include map, filter, and reduce in JavaScript.

Asked in Josh Technology Group

Memoization is a technique in JavaScript to cache the results of expensive function calls for future use.
Memoization improves performance by avoiding redundant calculations
It is commonly used in recursive functions or functions with expensive computations
The cached results are stored in a data structure like an object or a map
Memoization can be implemented manually or using libraries like Lodash or Memoizee
Asked in CA Monk

Q. As part of the interview, you were given 10 to 15 minutes to create a "To-Do" Application in React JS.
A simple To-Do application built with React to manage tasks efficiently.
Use functional components and hooks like useState for state management.
Create an input field to add new tasks, e.g., <input type='text' />.
Display tasks in a list using the map function, e.g., {tasks.map(task => <li>{task}</li>)}.
Implement a delete function to remove tasks, e.g., const deleteTask = (index) => { ... }.
Style the application using CSS or a library like styled-components.

Asked in FoodVybe

Q. How can you change CSS using JavaScript code?
CSS can be changed through JavaScript by accessing the style property of an element and modifying its CSS properties.
Access the element using document.querySelector() or document.getElementById()
Use element.style.propertyName to modify the CSS property
Alternatively, add or remove CSS classes using element.classList.add() and element.classList.remove()
Use CSS variables to dynamically change multiple properties at once

Asked in Josh Technology Group

Arrow functions are a concise way to write functions in JavaScript.
Arrow functions have a shorter syntax compared to regular functions.
They do not have their own 'this' value.
They do not have the 'arguments' object.
They cannot be used as constructors with the 'new' keyword.
They are commonly used in functional programming and with array methods like 'map' and 'filter'.

Asked in Samsung

A process in an operating system is an instance of a program that is being executed.
A process is a unit of execution within an operating system.
Each process has its own memory space, resources, and state.
Processes can communicate with each other through inter-process communication.
Examples of processes include web browsers, word processors, and media players.

Asked in SpireHub Softwares

Q. What is the difference between REST and SOAP web services, and in what scenarios would you choose one over the other?
REST is lightweight and uses HTTP, while SOAP is protocol-based and more rigid, suited for complex transactions.
REST (Representational State Transfer) is an architectural style, while SOAP (Simple Object Access Protocol) is a protocol.
REST uses standard HTTP methods (GET, POST, PUT, DELETE), whereas SOAP relies on XML-based messaging.
REST is stateless and can return data in multiple formats (JSON, XML), while SOAP is stateful and primarily uses XML.
REST is generally easier to...read more

Asked in SpireHub Softwares

Q. What is the role of middleware in a web application, and can you provide an example of its usage in a typical Express.js application?
Middleware in web applications processes requests and responses, enhancing functionality and managing tasks like authentication.
Middleware functions are functions that have access to the request, response, and the next middleware function in the application’s request-response cycle.
They can perform tasks such as logging, authentication, error handling, and modifying request and response objects.
In an Express.js application, middleware can be used to parse JSON bodies of incom...read more
Asked in CA Monk

Q. What Is UseEffect and UseState Hooks?
UseEffect and UseState are React hooks used for managing state and side effects in functional components.
UseEffect is used to perform side effects in functional components, similar to componentDidMount and componentDidUpdate in class components.
UseState is used to manage state in functional components, allowing for re-rendering when the state changes.
Example: const [count, setCount] = useState(0); useEffect(() => { document.title = `You clicked ${count} times`; });
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Frontend Developer Intern Related Skills

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

