SDE (Software Development Engineer)

100+ SDE (Software Development Engineer) Interview Questions and Answers

Updated 8 Jul 2025
search-icon

Asked in Freo

2d ago

Q. Given a string, determine if it is a palindrome. You are allowed to remove at most one character to make it a palindrome.

Ans.

Check if a string is a palindrome and can be made a palindrome by removing at most one character.

  • Iterate through the string from both ends and check if the characters match.

  • If the characters don't match, try removing one character from either end and check if the remaining string is a palindrome.

  • If removing one character doesn't make the string a palindrome, then it's not possible to make it a palindrome by removing at most one character.

Asked in Ola Cabs

2w ago

Q. Implement three stacks using a single array, optimizing for space and time complexity.

Ans.

Implement 3 stacks using one array with optimized space and time complexity.

  • Divide the array into three equal parts to represent each stack.

  • Keep track of the top index of each stack separately.

  • When pushing an element, increment the top index of the respective stack and store the element.

  • When popping an element, retrieve the element from the top index of the respective stack and decrement the top index.

  • Handle stack overflow and underflow conditions appropriately.

Asked in Myntra

2w ago

Q. What is startup all about and what all technology is used

Ans.

A startup is a newly established business that aims to solve a problem or meet a need using innovative technology.

  • Startups are focused on growth and scalability.

  • They often operate in a fast-paced and dynamic environment.

  • Startups use various technologies depending on their industry and product.

  • Common technologies used in startups include web and mobile development, cloud computing, data analytics, artificial intelligence, and blockchain.

  • Examples of startup technologies include...read more

Q. Explain the Waterfall model, including its advantages and disadvantages.

Ans.

Waterfall model is a linear sequential approach to software development.

  • Advantages: clear and well-defined stages, easy to understand and manage, suitable for small projects with stable requirements

  • Disadvantages: inflexible, difficult to make changes once a stage is completed, testing is done only at the end, not suitable for large or complex projects

  • Stages: requirements gathering, design, implementation, testing, deployment, maintenance

  • Example: building a house, where each s...read more

Are these interview questions helpful?

Q. What Software Development Models are you familiar with?

Ans.

Different software development models

  • Waterfall model

  • Agile model

  • Spiral model

  • V-model

  • Iterative model

  • RAD model

  • Prototype model

  • Incremental model

Asked in Dream11

1d ago

Q. Given two integers, print the most common ancestor nodes of a binary tree.

Ans.

Find most common ancestor nodes of a binary tree given two integers.

  • Traverse the tree to find the nodes with the given integers

  • Store the path from root to each node in separate arrays

  • Compare the two arrays to find the most common ancestor node

  • If there are multiple common ancestors, return the one closest to the root

SDE (Software Development Engineer) Jobs

Teamware Solutions ( A division of Quantum Leap Co     nsulting Private LTD). logo
MySQL 2-5 years
Teamware Solutions ( A division of Quantum Leap Co nsulting Private LTD).
0.0
₹ 6 L/yr - ₹ 43 L/yr
(AmbitionBox estimate)
India
Teamware Solutions ( A division of Quantum Leap Consulting Private LTD). logo
MySQL 2-5 years
Teamware Solutions ( A division of Quantum Leap Consulting Private LTD).
0.0
₹ 6 L/yr - ₹ 24 L/yr
(AmbitionBox estimate)
Chennai
Teamware Solutions ( A division of Quantum Leap Consulting Private LTD). logo
MySQL 2-5 years
Teamware Solutions ( A division of Quantum Leap Consulting Private LTD).
0.0
₹ 3 L/yr - ₹ 53 L/yr
(AmbitionBox estimate)
Bangalore / Bengaluru

Asked in Ola Cabs

2w ago

Q. How can you sort an array of 0s, 1s, and 2s in O(n) time complexity and O(1) space complexity?

Ans.

Dutch National Flag algorithm can be used to sort an array of 0, 1, and 2 in O(n) time complexity and O(1) space complexity.

  • Initialize three pointers: low, mid, and high.

  • Iterate through the array and swap elements based on their values.

  • Increment low and mid pointers when encountering 0.

  • Increment mid pointer when encountering 1.

  • Decrement high pointer when encountering 2.

Asked in Carwale

2w ago

Q. What are the differences between methods and constructors? (List at least five.)

Ans.

Methods are functions that perform a specific task, while constructors are special methods that initialize objects.

  • Constructors have the same name as the class they belong to.

  • Constructors are called automatically when an object is created.

  • Constructors can be overloaded with different parameters.

  • Methods can be called multiple times with different arguments.

  • Methods can have a return type, while constructors do not.

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Asked in Carwale

2w ago

Q. What is OOP? Describe its properties.

Ans.

OOP is a programming paradigm that organizes code into objects with properties and behaviors.

  • OOP stands for Object-Oriented Programming.

  • It focuses on creating reusable code by organizing it into objects.

  • Objects have properties (attributes) and behaviors (methods).

  • Encapsulation, inheritance, and polymorphism are key principles of OOP.

  • Example: In Java, a class represents an object with its properties and methods.

3d ago

Q. Given a rotated sorted array, find an element in it.

Ans.

Finding an element in a rotated array

  • Identify the pivot point where the array is rotated

  • Divide the array into two sub-arrays based on the pivot point

  • Perform binary search on the appropriate sub-array to find the element

  • Handle edge cases like when the element is at the pivot point

Asked in Carwale

2w ago

Q. What are stacks and their properties?

Ans.

Stacks are a data structure that follows the Last-In-First-Out (LIFO) principle.

  • Stacks have two main operations: push (adds an element to the top) and pop (removes the top element).

  • Stacks can be implemented using arrays or linked lists.

  • Common applications of stacks include function call stack, undo/redo operations, and expression evaluation.

  • Example: A stack of books, where the last book placed is the first one to be removed.

Asked in Emtec

2w ago

Q. Given a nested array like [1,3,4,[6,7,[8,5],9],2], flatten it to produce a single-dimensional array [1,3,4,6,7,8,5,9,2].

Ans.

The given array needs to be flattened to a single-level array.

  • Iterate through the array elements

  • If an element is an array, recursively flatten it

  • If an element is not an array, add it to the result array

Asked in Carwale

1w ago

Q. Write a program to print the Fibonacci series up to 1000.

Ans.

Print Fibonacci series less than or equal to 1000.

  • Start with two variables, a and b, initialized to 0 and 1 respectively.

  • Print a and update a to the value of b, and b to the sum of the previous a and b.

  • Repeat until a exceeds 1000.

Asked in UST

3d ago

Q. How do you count the number of set bits in a given number?

Ans.

Count the number of set bits in a given number.

  • Use bitwise AND operator with 1 to check if the rightmost bit is set.

  • Shift the number to right by 1 bit and repeat the process until the number becomes 0.

  • Keep a count of the number of set bits encountered.

  • Example: For number 5 (101 in binary), the answer is 2 as there are 2 set bits.

  • Example: For number 15 (1111 in binary), the answer is 4 as there are 4 set bits.

Asked in Carwale

5d ago

Q. Write a function to convert a given number to its hexadecimal form.

Ans.

Convert a number to its hexadecimal form

  • Use the built-in function to convert the number to hexadecimal

  • Alternatively, use the algorithm to convert the number to hexadecimal manually

  • Ensure to handle negative numbers appropriately

Q. Sort the given array using only O(n) solution: [0,1,1,1,0,0,0,1,0,1,0,1,1,0,0]

Ans.

Sort an array of 0s and 1s using O(n) solution.

  • Use two pointers, one at the beginning and one at the end of the array.

  • Swap the elements at the pointers if they are not in the correct order.

  • Move the pointers towards each other until they meet in the middle.

  • Time complexity is O(n) and space complexity is O(1).

Asked in Amazon

3d ago

Q. Given a sorted dictionary (array of words) of an alien language, find the order of characters in the language.

Ans.

Sorting a list of words with a random order using an alien dictionary

  • Create a graph with nodes as characters and edges as the order of characters in words

  • Topologically sort the graph to get the correct order of characters

  • Use the order to sort the list of words

Q. Do you understand how the project directory is structured in Django?

Ans.

Yes, the project directory in Django follows a specific structure.

  • The main project directory contains settings.py, urls.py, and wsgi.py files.

  • Each app within the project has its own directory with models.py, views.py, and urls.py files.

  • Static files are stored in a 'static' directory within each app.

  • Templates are stored in a 'templates' directory within each app.

  • Media files are stored in a 'media' directory within the project directory.

Asked in Carwale

1w ago

Q. Explain the singleton class and provide example code.

Ans.

Singleton class is a class that can only have one instance at a time.

  • Singleton pattern is used when we need to ensure that only one instance of a class is created and that instance can be accessed globally.

  • The constructor of a singleton class is always private to prevent direct instantiation.

  • A static method is used to access the singleton instance.

  • Example: public class Singleton { private static Singleton instance = new Singleton(); private Singleton() {} public static Single...read more

Asked in Carwale

2w ago

Q. Given the head of a linked list, detect if the linked list has a cycle (i.e., a node in the list can be reached again by continuously following the next pointer). If there is a cycle, return the node where the...

read more
Ans.

Detect and remove cycle in a linked list

  • Use two pointers, one slow and one fast, to detect a cycle

  • Once a cycle is detected, move one pointer to the head and iterate both pointers until they meet again

  • Set the next node of the last node in the cycle to null to remove the cycle

Asked in Ola Cabs

1w ago

Q. Given a 2D matrix, find the submatrix with the largest sum.

Ans.

Find the maximum sum of a rectangle in a 2D matrix.

  • Use Kadane's algorithm to find the maximum sum subarray in each row.

  • Iterate over all possible combinations of rows and find the maximum sum rectangle.

  • Keep track of the maximum sum and the coordinates of the rectangle.

Asked in MakeMyTrip

2w ago

Q. Given a string a="aabbfaffb" and b="ab", write code to replace the given string and print "faffb".

Ans.

Replace substring in a given string and print the remaining string

  • Use string.replace() method to replace the substring

  • Print the remaining string using string slicing

Asked in Amazon

2w ago

Q. How would you store a particular data set, and what data structure would you suggest for that?

Ans.

The choice of data structure depends on the type of data and the operations to be performed on it.

  • Consider the size and complexity of the data

  • Determine the operations to be performed on the data

  • Choose a data structure that supports those operations efficiently

  • Examples: arrays, linked lists, hash tables, trees, graphs

Q. Why should we use polymorphism?

Ans.

Polymorphism allows for flexibility and extensibility in code by enabling objects to take on multiple forms.

  • Polymorphism allows for code reuse and simplifies maintenance.

  • It enables the creation of generic code that can work with objects of different classes.

  • It allows for the creation of interfaces and abstract classes, which can be implemented by multiple classes.

  • Examples include using a parent class to represent multiple child classes, or implementing an interface to allow f...read more

Asked in Oracle

2w ago

Q. What is Ingress? What is Prometheus ?What is Grafana?

Ans.

Ingress is a Kubernetes resource that manages external access to services. Prometheus is a monitoring system and Grafana is a visualization tool.

  • Ingress is used to route external traffic to the appropriate Kubernetes service

  • Prometheus is used to collect and store metrics from various sources

  • Grafana is used to visualize the collected metrics in a user-friendly way

  • Ingress can be configured to use different load balancing algorithms

  • Prometheus has a powerful query language for an...read more

Q. How do you check whether a string is a palindrome or not?

Ans.

To check if a string is palindrome or not.

  • Compare the first and last characters of the string and continue towards the middle until all characters have been compared.

  • If all characters match, the string is a palindrome.

  • If any characters do not match, the string is not a palindrome.

Q. How to find length , freq of each char and list of unique characters of a string

Ans.

To find length, frequency of each character and list of unique characters of a string.

  • Iterate through the string and count the frequency of each character using a hash table.

  • Create a list of unique characters by iterating through the hash table.

  • Calculate the length of the string using the built-in length function.

  • Return the frequency, length and list of unique characters as an array of strings.

2w ago

Q. What is the result of the expression 2+2-4*6?

Ans.

The answer is -22

  • Perform multiplication first

  • Then perform addition and subtraction from left to right

Asked in Walmart

2w ago

Q. Explain lexical scoping with an example.

Ans.

Lexical scoping is a way of defining variable scope based on where they are declared in the code.

  • Variables declared inside a function have local scope and are not accessible outside the function.

  • Variables declared outside a function have global scope and can be accessed from anywhere in the code.

  • Nested functions can access variables declared in their parent function.

  • Example: function outer() { let x = 10; function inner() { console.log(x); } inner(); } outer(); // Output: 10

Asked in RadiSys

1d ago

Q. Which statement about a binary heap is false?

Ans.

Answering which statement about a binary heap is false.

  • A binary heap is a complete binary tree where the parent node is always greater or smaller than its children.

  • A binary heap can be represented as an array.

  • A binary heap can be used to implement priority queues.

  • A binary heap can only be a max heap and not a min heap.

Previous
1
2
3
4
5
6
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Infosys Logo
3.6
 • 7.9k Interviews
Amazon Logo
4.0
 • 5.4k Interviews
Google Logo
4.4
 • 897 Interviews
Oracle Logo
3.7
 • 895 Interviews
View all
interview tips and stories logo
Interview Tips & Stories
Ace your next interview with expert advice and inspiring stories

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

SDE (Software Development Engineer) 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