Backend Developer
300+ Backend Developer Interview Questions and Answers
Q1. Vertical Order Traversal of a Binary Tree
Given a binary tree, your task is to return the vertical order traversal of its nodes' values.
For each node located at a position (X, Y), its left child will be at (X-...read more
Q2. Reverse Rows of a Matrix Problem Statement
You are given a matrix and tasked with reversing the order of elements in each row. This needs to be done for every row in the matrix.
Help a participant named Ninja, ...read more
Backend Developer Interview Questions and Answers for Freshers
Array Sum Calculation
Calculate the sum of all elements in an array of length N
.
Input:
Line 1: An integer N indicating the size of the array.
Line 2: N integers, the elements of the array, separated by spaces.
Q4. Given 9 ball all of which weigh the same except for one, what is the minimum of weighings necessary to find the ball weighs more (or less)?
The minimum number of weighings necessary is 2.
Divide the 9 balls into 3 groups of 3.
Weigh any two groups against each other.
If the two groups weigh the same, the heavier ball is in the third group.
If one group is heavier, the heavier ball is in that group.
Take the heavier group and weigh any two balls against each other.
If they weigh the same, the heavier ball is the remaining one.
If one ball is heavier, it is the heavier ball.
Q5. Remove Duplicates from String Problem Statement
You are provided a string STR
of length N
, consisting solely of lowercase English letters.
Your task is to remove all duplicate occurrences of characters in the s...read more
Q6. Reverse Words in a String: Problem Statement
You are given a string of length N
. Your task is to reverse the string word by word. The input may contain multiple spaces between words and may have leading or trai...read more
Share interview questions and help millions of jobseekers 🌟
Q7. 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
Q8. Detect Cycle in Undirected Graph Problem Statement
You are provided with an undirected graph composed of 'N' vertices and 'M' edges, where vertices are labeled from 1 to 'N'.
Your task is to determine if there ...read more
Backend Developer Jobs
Q9. Zig-Zag Level Order Traversal of Binary Tree
Given a binary tree, your task is to perform a zigzag level order traversal. This traversal starts from left to right on the first level, then switches to right to l...read more
Q10. What is oops? pillar of oops. Details explanation with proper example. Collection framework questions . Difference between collection and collections. Why collection used when there is array is available in jav...
read moreObject-oriented programming (OOP) is a programming paradigm based on the concept of objects.
OOP is based on the four pillars: encapsulation, inheritance, abstraction, and polymorphism.
Encapsulation is the practice of hiding data and methods within a class.
Inheritance allows a class to inherit properties and methods from a parent class.
Abstraction is the process of hiding implementation details while showing only the necessary information to the user.
Polymorphism allows object...read more
Q12. Sort the array which consists of 0's, 1's , 2's. (Two Pointer approach)
Sort an array of 0's, 1's, and 2's using two pointer approach.
Initialize two pointers, one at the beginning and one at the end of the array.
Traverse the array and swap 0's to the beginning and 2's to the end using the pointers.
Stop when the pointers meet or cross each other.
Q13. What is OOPs concept. Why is java called an Object Oriented Programming Language. What benefit does java have as an OOP language?
OOPs stands for Object Oriented Programming. Java is called an OOP language because it follows the principles of OOP.
OOPs is a programming paradigm that focuses on objects and their interactions.
Java supports the four main principles of OOP: encapsulation, inheritance, polymorphism, and abstraction.
Encapsulation allows bundling of data and methods into a single unit, providing data hiding and security.
Inheritance enables the creation of new classes by inheriting properties an...read more
Q14. Search in the rotated Sorted array. (Binary Search - pivot)
Search for an element in a rotated sorted array using binary search with pivot.
Find the pivot element using binary search.
Compare the target element with the first element of the array to determine which half to search.
Perform binary search on the selected half of the array.
Repeat until the target element is found or the array is exhausted.
Q15. If a rival company tries to use your code against us what will you do?
I will ensure that our code is properly protected by implementing security measures and legal actions if necessary.
Implement security measures such as encryption and access control to prevent unauthorized access to our code.
Monitor for any suspicious activity and take immediate action if any unauthorized access is detected.
If necessary, take legal action against the rival company for intellectual property theft.
Collaborate with legal and management teams to ensure that our co...read more
Q16. Q1 - Leetcode : 1577. Number of ways where the square of numbers is equal to the product of 2 numbers Q2- Leetcode medium-level question based on arrays
Backend Developer interview question on Leetcode problems related to arrays and number manipulation.
Q1: Find number of ways where the square of numbers is equal to the product of 2 numbers
Q2: Solve a medium-level Leetcode problem based on arrays
Use appropriate data structures and algorithms to optimize solutions
Practice problem-solving skills regularly to improve efficiency
Q17. Five advantages of spring boot Which java version you currently use? Features of the java version you use Output from the code Difference between this and super In order to update the string, which will be bett...
read moreSpring Boot offers advantages like rapid development, easy configuration, embedded servers, production-ready features, and more.
Rapid development: Spring Boot simplifies the setup and configuration of Spring applications, allowing developers to focus on writing business logic.
Easy configuration: Spring Boot provides auto-configuration, reducing the need for manual setup and boilerplate code.
Embedded servers: Spring Boot comes with embedded servers like Tomcat, Jetty, and Unde...read more
Q19. What is the difference between package and package-lock.json?
package.json lists dependencies and package-lock.json ensures consistent installs.
package.json lists all the dependencies required for the project
package-lock.json ensures that the same versions of dependencies are installed across all environments
package.json is manually edited while package-lock.json is generated automatically
package-lock.json is used for reproducible builds
Q20. 2. Difference between Linked List and Tree (where what should be used).
Linked list is a linear data structure while tree is a hierarchical data structure.
Linked list is used when we need to maintain a sequence of elements and perform operations like insertion and deletion at any position.
Tree is used when we need to represent a hierarchical structure and perform operations like searching, insertion, and deletion efficiently.
Linked list has a single pointer to the next node while tree has multiple pointers to its child nodes.
Linked list has a lin...read more
Q21. Features of python Difference between list and tuple explain inheritance with an example types of inheritance what is self keyword find the average of numbers in a list explain memory management in python conve...
read moreInterview questions for Backend Developer role covering Python and Django
Python features: dynamic typing, garbage collection, high-level data structures, etc.
List vs Tuple: List is mutable, Tuple is immutable
Inheritance: a way to create a new class from an existing one, inheriting its attributes and methods
Types of inheritance: single, multiple, multilevel, hierarchical
Self keyword: refers to the instance of the class, used to access its attributes and methods
Average of numbe...read more
Q22. Create an Alarm Clock which shows the current date/time, has a snooze function and can add and delete alarms provided by the user. (Must be written with OOPS)
Create an Alarm Clock with OOPS, showing current date/time, snooze function, and ability to add/delete alarms.
Create a class for AlarmClock with properties like currentDateTime, alarmsList
Implement methods for displaying current date/time, setting alarms, snooze function, adding/deleting alarms
Use OOPS concepts like encapsulation, inheritance, polymorphism for efficient code structure
Q23. Program to efficiently arrange an array with all non zero number in starting without any change in there order and keep all zero number at last, focus was without using extra memory and with least complexity.
Use two pointers to swap non-zero elements with zero elements in place.
Use two pointers, one for non-zero elements and one for zero elements.
Swap non-zero elements with zero elements in place.
Maintain the order of non-zero elements while moving them to the beginning of the array.
Q24. Given a collection of user details, write mongo query to increase the age by 20% for documents where age exists.
Mongo query to increase age by 20% for documents with age field
Use $exists operator to filter documents with age field
Use $mul operator to increase age by 20%
Example: db.users.updateMany({ age: { $exists: true } }, { $mul: { age: 1.2 } })
Q25. What is the design approach of the Amazon e-commerce application in terms of how it processes user queries and displays the results? What questions were asked regarding servlets, Hibernate, and Spring Boot? Can...
read moreThe design approach of Amazon e-commerce application involves efficient processing of user queries and displaying results. Questions on servlets, Hibernate, and Spring Boot are likely to be asked.
Amazon e-commerce application likely uses a combination of search algorithms, caching mechanisms, and distributed systems to process user queries efficiently.
Questions on servlets may involve understanding how they handle HTTP requests and responses in a web application.
Questions on ...read more
Q26. Design a Stack that can support getMin functionality. Whenever it calls getMin on stack it should return the min element in the stack.
Design a stack that supports getMin functionality to return the minimum element in the stack.
Create two stacks, one for storing the actual elements and another for storing the minimum elements.
Push elements onto both stacks simultaneously.
When popping an element, pop from both stacks.
To get the minimum element, peek at the top of the minimum stack.
Q27. Consider an e-commerce site's feature that tells you by what time the parcel will reach a pincode. We discussed on architecture, whether the service that responds with the same should have the rules coupled wit...
read moreThe rules for parcel delivery time estimation should be decoupled from the service for better maintainability and flexibility.
Decoupling the rules from the service allows for easier maintenance and updates without affecting the service itself.
Separating the rules also enables reusability across different services or components.
Using a separate rules engine or configuration file can provide flexibility to adjust the delivery time estimation logic without changing the service c...read more
Q28. Java Q1- what is java? Q2- Difference between float and double. Q3-How many loops in Java? Q4- Difference between while loop and do-while loop. Q5- Difference between for loop and for-each loop. Q6- what is cla...
read moreJava is a popular programming language used for developing various applications.
Java is a high-level, object-oriented programming language.
Float is a single-precision 32-bit floating point data type, while double is a double-precision 64-bit floating point data type.
Java has three types of loops: for, while, and do-while.
While loop checks the condition before executing the code block, whereas do-while loop executes the code block first and then checks the condition.
For loop i...read more
Q29. Sum of two numbers without using arthimetic operators.
The sum of two numbers can be obtained using bitwise operators.
Use the bitwise XOR operator to get the sum of two numbers without carrying.
Use the bitwise AND operator to get the carry.
Repeat the process until there is no carry left.
Q30. Tell me about id selector in CSS
ID selector is used to select an element with a specific ID attribute in CSS.
ID selector is denoted by '#' followed by the ID name.
ID should be unique on a page.
ID selector has higher specificity than class selector.
Example: #header { color: blue; }
Q31. How can we make sure that package versions are taken from package-lock.json and not package.json
To ensure package versions are taken from package-lock.json, use npm ci instead of npm install.
npm ci installs packages based on package-lock.json
npm install may update package versions in package.json
Always commit package-lock.json to version control
Q32. DSA : Search an element in infinite soted array
Search an element in an infinite sorted array using binary search.
Initialize low as 0 and high as 1.
Double the high index until arr[high] is greater than the target element.
Perform binary search between low and high indexes.
Q33. Design the table diagram and the ways different tables will be linked for a movie booking website like bookmyshow.
Design table diagram and link tables for a movie booking website like bookmyshow.
Create tables for movies, theaters, users, bookings, payments, and reviews
Link movies and theaters through a many-to-many relationship
Link users and bookings through a one-to-many relationship
Link bookings and payments through a one-to-one relationship
Link movies and reviews through a one-to-many relationship
Q34. 4. An array and 2 variables x and y are given, print y sub arrays with x elements.
Print y sub arrays with x elements from given array and variables.
Use a loop to iterate through the array and create subarrays of x elements.
Use another loop to print y number of subarrays.
Handle edge cases where x or y is greater than the length of the array.
Q35. How does over-indexing affect MongoDB performance, and how can it be prevented ?
Over-indexing in MongoDB can negatively impact performance by increasing memory usage and slowing down query execution.
Over-indexing can lead to increased memory usage as each index consumes memory.
Having too many indexes can slow down write operations as each index needs to be updated when a document is inserted, updated, or deleted.
To prevent over-indexing, carefully analyze query patterns and create indexes only for fields that are frequently queried.
Regularly review and r...read more
Q36. In Redis, how would you retrieve all keys that contain the substring "xyz" ?
Use the KEYS command in Redis to retrieve all keys containing a specific substring.
Use the KEYS command followed by the pattern '*xyz*' to retrieve all keys containing the substring 'xyz'.
Be cautious when using the KEYS command as it can be resource-intensive on large datasets.
Consider using SCAN command for better performance when dealing with large datasets.
Q37. What are the key consideration when designing a database in Mongodb ?
Key considerations include data modeling, indexing, sharding, and replication.
Consider the data model carefully to ensure it fits the application's needs.
Use indexing to improve query performance.
Plan for sharding to distribute data across multiple servers for scalability.
Implement replication for high availability and fault tolerance.
Q38. What are the key factors to consider when designing a database ?
Key factors include data modeling, normalization, indexing, scalability, and performance.
Consider data modeling to ensure efficient storage and retrieval of data.
Normalize the database to reduce redundancy and improve data integrity.
Use indexing to speed up data retrieval operations.
Design for scalability to accommodate future growth and changes.
Optimize for performance by considering query optimization and data caching.
Q39. What are the major difference between Promises and Callbacks in Javascript ?
Promises are objects representing the eventual completion or failure of an asynchronous operation, while callbacks are functions passed as arguments to be executed after a task is completed.
Promises allow chaining multiple asynchronous operations, while callbacks can lead to callback hell.
Promises have built-in error handling through .catch(), while callbacks rely on error-first callbacks.
Promises are easier to read and maintain due to their sequential nature, while callbacks...read more
Q40. What is your perception of no-code tools(XANO), and have you used any ?
I believe no-code tools like XANO are great for rapid prototyping and simplifying development processes.
No-code tools like XANO allow for faster development by eliminating the need for manual coding
They are great for prototyping and testing ideas quickly
XANO specifically offers a visual interface for building backend logic without writing code
I have used XANO in a few projects and found it to be user-friendly and efficient
Q41. Write a program to filter out only the alphabets from the provided Email Address, then sort the filter out alphabets then put the sorted alphabets back to the Email Address without disturbing the positions of o...
read moreProgram to filter and sort alphabets from email address without disturbing other characters.
Use regular expressions to filter out alphabets from email address.
Store the filtered alphabets in an array and sort it.
Iterate through the email address and replace the alphabets with sorted array elements.
Return the modified email address.
Q42. 1. Mininum cost to reach the last cell of a 2D matrix. Required moves are only downward or to the right direction
Minimum cost to reach last cell of 2D matrix with only downward or right moves.
Use dynamic programming approach to solve the problem.
Calculate minimum cost for each cell by considering minimum cost of its adjacent cells.
Final answer will be the minimum cost to reach the last cell.
Q43. 2. Find the first non repeating character in a string
Find the first non-repeating character in a string.
Create a hash table to store the frequency of each character in the string.
Iterate through the string and check the frequency of each character.
Return the first character with a frequency of 1.
Q44. Write a function that can keep a count of certain functions in our application.
Function to count certain functions in the application
Create a dictionary to store the count of each function
Increment the count of the function each time it is called
Include a reset function to reset the count of all functions
Example: def count_functions(): function_count = {}
Example: def function1(): function_count['function1'] += 1
Example: def reset_count(): function_count.clear()
Q45. Differences between ShallowCopy & DeepCopy
ShallowCopy copies only the reference of an object while DeepCopy creates a new object with a new reference.
ShallowCopy creates a new reference to the same object, so changes made to the copy will reflect in the original object.
DeepCopy creates a new object with a new reference, so changes made to the copy will not reflect in the original object.
ShallowCopy is faster and less memory-intensive than DeepCopy.
DeepCopy is necessary when you need to modify the copied object withou...read more
Q46. how to migrate a database from one to another with out any down time
Use replication and switch over to new database when ready
Set up replication between old and new databases
Monitor replication status to ensure data consistency
Switch over to new database when ready
Redirect traffic to new database
Verify data integrity on new database
Q48. Can you briefly explain the request-response cycle in node.js ?
The request-response cycle in node.js involves a client sending a request to a server, which processes the request and sends back a response.
Client sends a request to the server using HTTP methods like GET, POST, PUT, DELETE.
Server receives the request, processes it, and generates a response.
The response is sent back to the client, typically in the form of HTML, JSON, or other data formats.
Node.js uses event-driven, non-blocking I/O model to handle multiple requests efficient...read more
Q49. What are the different authentication methods used in applications ?
Different authentication methods include OAuth, JWT, Basic Auth, and OAuth2.
OAuth: Allows third-party applications to access resources without sharing credentials.
JWT (JSON Web Tokens): Securely transmit information between parties as a JSON object.
Basic Auth: Sends user credentials in the header of each request.
OAuth2: Authorization framework that enables a third-party application to obtain limited access to an HTTP service.
Q50. On a scale from 1 to 10, how would you rate your proficiency in data structures and algorithms?
I would rate my proficiency in data structures and algorithms as an 8.
I have a strong understanding of common data structures like arrays, linked lists, trees, and graphs.
I am proficient in implementing algorithms like sorting, searching, and dynamic programming.
I have experience solving algorithmic problems on platforms like LeetCode and HackerRank.
Top Interview Questions for Backend 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