Backend Developer

400+ Backend Developer Interview Questions and Answers

Updated 13 Jul 2025
search-icon

Asked in NoBroker

1d ago

Q. 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

Ans.

Vertical order traversal of a binary tree is required to be implemented for given input format and constraints.

  • Implement a function to perform vertical order traversal of a binary tree

  • Maintain the order of nodes based on their positions (X, Y)

  • Handle cases where two nodes have the same position by considering the left node first

  • Follow the input and output format as specified in the question

2d ago
Q. ...read more

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.
Ans.

Calculate the sum of all elements in an array of length N.

  • Read the size of the array N and then read N integers as elements of the array.

  • Iterate through the array and add each element to a running sum.

  • Return the final sum as the output.

Backend Developer Interview Questions and Answers for Freshers

illustration image

Q. Given 9 balls, all of which weigh the same except for one, what is the minimum number of weighings necessary to find the ball that weighs more or less?

Ans.

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.

Asked in Cisco

3d ago

Q. 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

Ans.

Remove duplicate occurrences of characters in a given string.

  • Use a hash set to keep track of characters seen so far.

  • Iterate through the string and add non-duplicate characters to a new string.

  • Return the new string without duplicate characters.

Are these interview questions helpful?
3d ago

Q. 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

Ans.

Reverse words in a string while handling leading, trailing, and multiple spaces.

  • Split the input string by spaces to get individual words

  • Reverse the order of the words

  • Join the reversed words with a single space in between

  • Handle leading, trailing, and multiple spaces appropriately

6d ago

Q. 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

Ans.

Reverse the order of elements in each row of a given matrix.

  • Iterate through each row of the matrix

  • Reverse the elements in each row

  • Return the modified matrix

Backend Developer Jobs

Robert Bosch Engineering and Business Solutions Private Limited logo
Senior Java AWS Backend Developer with Terraform 6-9 years
Robert Bosch Engineering and Business Solutions Private Limited
4.1
Bangalore / Bengaluru
IBM India Pvt. Limited logo
Backend Developer-Installer 4-9 years
IBM India Pvt. Limited
3.9
₹ 15 L/yr - ₹ 34 L/yr
(AmbitionBox estimate)
Bangalore / Bengaluru
Capgemini logo
AWS Lambda typescript Backend Developer 6-10 years
Capgemini
3.7
Hyderabad / Secunderabad

Asked in Samsung

5d ago

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
Ans.

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.

  • Keep track of the previous, current, 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.

Asked in Cvent

6d ago

Q. 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

Ans.

Detect if there exists a cycle in an undirected graph.

  • Use Depth First Search (DFS) to traverse the graph and detect cycles.

  • Maintain a visited set to keep track of visited vertices.

  • If a visited vertex is encountered again during DFS, a cycle exists.

  • Return 'Yes' if a cycle is found, 'No' otherwise.

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Asked in Paytm Money

5d ago

Q. 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

Ans.

Perform zigzag level order traversal on a binary tree.

  • Use a queue to perform level order traversal of the binary tree.

  • Alternate between left to right and right to left traversal for each level.

  • Handle null nodes represented by -1 in the input.

Q. 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 more
Ans.

Object-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

Asked in NoBroker

6d ago
Q. Why is Java considered an Object Oriented Programming Language?
Ans.

Java is considered an Object Oriented Programming Language because it supports the key principles of OOP such as encapsulation, inheritance, and polymorphism.

  • Java allows for the creation of classes and objects, which are the building blocks of OOP.

  • It supports encapsulation by allowing data hiding within classes.

  • Inheritance is supported in Java, allowing classes to inherit attributes and methods from other classes.

  • Polymorphism is achieved through method overloading and overrid...read more

Q. Given an array consisting of only 0s, 1s, and 2s, sort the array in-place.

Ans.

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.

Asked in NoBroker

3d ago

Q. What is OOPs concept. Why is java called an Object Oriented Programming Language. What benefit does java have as an OOP language?

Ans.

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

Q. Given a sorted array that has been rotated, find the index of a target element. If the target element is not found, return -1.

Ans.

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.

Q. If a rival company tries to use your code against us, what will you do?

Ans.

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

Asked in PayPal

1d ago

Q. 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 more
Ans.

Spring 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

Asked in Spinny

4d ago

Q. 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

Ans.

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

2d ago

Q. What is the difference between package and package-lock.json?

Ans.

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

Q. What are the differences between a Linked List and a Tree, and when should each be used?

Ans.

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

Asked in Rupicard

4d ago

Q. Climbing Stairs Problem: You are climbing a staircase with n steps. Each time you can either climb 1 or 2 steps. In addition, suppose you have the ability to skip a step if needed. Write a function to count how...

read more
Ans.

Count distinct ways to climb n steps by climbing 1 or 2 steps at a time, with the ability to skip steps.

  • Use dynamic programming to solve this problem efficiently.

  • Define a recursive function to calculate the number of ways to climb to the top.

  • Consider base cases where n is 0, 1, or 2 for easy calculation.

  • Example: For n = 3, there are 3 distinct ways: 1+1+1, 1+2, 2+1.

Asked in Rupicard

6d ago

Q. Combination Sum II - Given a collection of candidates (distinct integers) and a target number, find all unique combinations in candidates where the candidate numbers sum to the target. Each number in the candid...

read more
Ans.

Find unique combinations of candidate numbers that sum to target, each number can be used only once.

  • Use backtracking to explore all possible combinations

  • Sort the candidates array to avoid duplicate combinations

  • Skip duplicates while exploring combinations to ensure uniqueness

Q. 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 more
Ans.

Interview 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

Asked in Loco

3d ago

Q. Write a program to efficiently arrange an array such that all non-zero numbers are at the beginning, maintaining their original order, and all zero numbers are at the end. Optimize for minimal memory usage and...

read more
Ans.

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.

Asked in NoBroker

2d ago
Q. What are indexing and partitioning in DBMS?
Ans.

Indexing and partitioning are techniques used in DBMS to improve performance by organizing data efficiently.

  • Indexing involves creating an index on a column in a database table to speed up data retrieval. It works like an index in a book, allowing the database to quickly locate the desired data.

  • Partitioning involves dividing a large table into smaller, more manageable parts called partitions. This can improve query performance by reducing the amount of data that needs to be sc...read more

5d ago

Q. 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)

Ans.

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

6d ago

Q. Given a collection of user details, write a MongoDB query to increase the age by 20% for documents where the age field exists.

Ans.

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 } })

Q. 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 more
Ans.

The 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

Asked in RapiPay

6d ago

Q. When designing a feature for an e-commerce site that predicts parcel delivery times by pincode, should the service responsible for this prediction have the rules coupled with it?

Ans.

The 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

Q. Given an infinite sorted array, how would you search for an element?

Ans.

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.

Asked in Paytm

2d ago

Q. Design a Stack data structure that supports a getMin operation, which returns the minimum element in the stack in O(1) time.

Ans.

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.

1
2
3
4
5
6
7
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Accenture Logo
3.7
 • 8.7k Interviews
Infosys Logo
3.6
 • 7.9k Interviews
Wipro Logo
3.7
 • 6.1k Interviews
IBM Logo
3.9
 • 2.5k Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories
Backend Developer Interview Questions
Share an Interview
Stay ahead in your career. Get AmbitionBox app
play-icon
play-icon
qr-code
Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+

Reviews

10L+

Interviews

4 Cr+

Salaries

1.5 Cr+

Users

Contribute to help millions

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

Follow Us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter
Profile Image
Hello, Guest
AmbitionBox Employee Choice Awards 2025
Winners announced!
awards-icon
Contribute to help millions!
Write a review
Write a review
Share interview
Share interview
Contribute salary
Contribute salary
Add office photos
Add office photos
Add office benefits
Add office benefits