Backend Developer

300+ Backend Developer Interview Questions and Answers

Updated 16 Dec 2024

Popular Companies

search-icon
Q1. Print a Binary Tree in Vertical Order

Given a binary tree, return the vertical order traversal of the values of the nodes of the given tree.

For each node at position (X, Y), (X-1, Y-1) will be its left child po...read more

Q2. Reverse the rows of a matrix

As a part of its annual techno-cultural fest, NinjaCity will conduct a technical event, Decode, where it has given a matrix, and the participants have to decode it.

The participants ...read more

Backend Developer Interview Questions and Answers for Freshers

illustration image
Q3. Print array Sum

Given an array of length N, you need to find and print the sum of all elements of the array.

Input Format :
Line 1 : An Integer N i.e. size of array Line 2 : N integers which are elements of the ...read more

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

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.

Are these interview questions helpful?
Q5. Remove Duplicates From String

You are given a string (STR) of length N, consisting of only the lower case English alphabet.

Your task is to remove all the duplicate occurrences of characters in the string.

For E...read more
Q6. Reverse Words In A String

You are given a string of length N. You need to reverse the string word by word. There can be multiple spaces between two words and there can be leading or trailing spaces but in the ou...read more

Share interview questions and help millions of jobseekers 🌟

man-with-laptop
Q7. Reverse Linked List

Given a singly linked list of integers. Your task is to return the head of the reversed linked list.

For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked lis...read more
Frequently asked in, ,
Q8. Detect cycle in undirected graph

You have been given an undirected graph with 'N' vertices and 'M' edges. The vertices are labelled from 1 to 'N'.

Your task is to find if the graph contains a cycle or not.

A pat...read more

Backend Developer Jobs

Backend Developer_Python 3-5 years
IBM India Pvt. Limited
4.1
Bangalore / Bengaluru
Network BackEnd Developer 5-10 years
IBM India Pvt. Limited
4.1
Bangalore / Bengaluru
Security Backend Developer 8-13 years
IBM India Pvt. Limited
4.1
Pune
Q9. Zig-Zag Tree Traversal

Given a binary tree, return the zigzag level order traversal of the nodes' values of the given tree. Zigzag traversal means starting from left to right, then right to left for the next lev...read more

Q10. System Design Question

Design a movie site booking portal using objects and classes. Design the table diagram and the ways different tables will be linked for a movie booking website like bookmyshow.

Q11. OOPS Question

Why is Java called an Object Oriented Programming Language?

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

Q13. Sort the array which consists of 0's, 1's , 2's. (Two Pointer approach)

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.

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

Q15. Search in the rotated Sorted array. (Binary Search - pivot)

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.

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

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

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

Q19. DBMS Question

What is indexing and partitioning in DBMS?

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

Q21. 2. Difference between Linked List and Tree (where what should 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

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

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

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

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.

Q25. Given a collection of user details, write mongo query to increase the age by 20% for documents where age 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 } })

Q26. Design a Stack that can support getMin functionality. Whenever it calls getMin on stack it should return the min element in the stack.

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.

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

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

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

Ans.

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

Ans.

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

Ans.

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

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.

Q33. Design the table diagram and the ways different tables will be linked for a movie booking website like bookmyshow.

Ans.

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.

Ans.

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 ?

Ans.

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" ?

Ans.

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 ?

Ans.

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 ?

Ans.

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 ?

Ans.

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 ?

Ans.

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

Program 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

Ans.

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

Ans.

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.

Ans.

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

Ans.

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

Ans.

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

Q47. DBMS Question

What is an aggregate function?

Q48. Can you briefly explain the request-response cycle in node.js ?

Ans.

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 ?

Ans.

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. 3) Write a code to create Models to connect to the Database

Ans.

Code to create Models for connecting to a Database

  • Define a class for each table in the database

  • Use ORM frameworks like Sequelize or Django ORM for easier database connectivity

  • Specify the table name, columns, and their data types in the model

  • Define relationships between models using foreign keys or associations

  • Implement CRUD operations in the models to interact with the database

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
 • 10k Interviews
3.9
 • 7.8k Interviews
3.7
 • 7.3k Interviews
4.1
 • 2.3k Interviews
3.3
 • 737 Interviews
3.2
 • 286 Interviews
3.7
 • 159 Interviews
3.2
 • 16 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

Backend 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
Get AmbitionBox app

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