Software Development Engineer

80+ Software Development Engineer Interview Questions and Answers for Freshers

Updated 4 Jul 2025
search-icon
4d ago

Q. Given two words, find the similarity between them. You have to develop your own sense of similarity here. Normalize length of LCS by the total length of the string.

Ans.

The question asks to find the similarity between two words by normalizing the length of the longest common subsequence (LCS) by the total length of the string.

  • Implement a function that takes two words as input

  • Find the length of the longest common subsequence (LCS) between the two words

  • Normalize the length of LCS by dividing it by the total length of the string

  • Return the normalized similarity value

3d ago

Q. How would you find the least common ancestor of two nodes in a binary tree?

Ans.

To find least common ancestor of two nodes in a binary tree, traverse the tree from root to the nodes and store the paths. Then compare the paths to find the common ancestor.

  • Traverse the binary tree from root to the two nodes and store the paths

  • Compare the paths to find the common ancestor

  • If the binary tree is a BST, compare the values of the nodes to find the common ancestor

  • If one of the nodes is the ancestor of the other, return the ancestor node

Asked in Amazon

1d ago

Q. Implement the "People you may know" feature of Facebook with code using BFS and a counter for mutual friends.

Ans.

Implement Facebook's 'People you may know' feature using BFS and mutual friend counter.

  • Create a graph of users and their friends

  • Perform BFS on the graph starting from the user in question

  • For each friend of the user, increment a counter for their mutual friends

  • Sort the list of potential friends by mutual friend count

  • Exclude already connected friends and suggest top potential friends

5d ago

Q. How would you identify two nodes that have been swapped in a binary search tree?

Ans.

To identify swapped nodes in a binary search tree, we need to perform an inorder traversal and compare adjacent nodes.

  • Perform an inorder traversal of the binary search tree

  • Compare each node with its adjacent node

  • If a node is smaller than its previous node, mark it as a swapped node

  • If two nodes are swapped, swap their values to restore the original binary search tree

Are these interview questions helpful?
1d ago

Q. Given a binary tree, return a doubly linked list of all the nodes at each level.

Ans.

The function takes a binary tree as input and returns a doubly linked list of all the nodes at each level.

  • Use a breadth-first search (BFS) algorithm to traverse the binary tree level by level.

  • For each level, create a doubly linked list and add the nodes to it.

  • Connect the doubly linked lists of each level to form the final result.

Asked in Leena AI

1d ago

Q. Given 8 identical balls, one of which is heavier, find the heavier ball using a balance weighting machine in the least number of tries.

Ans.

Find the heavier ball from 8 identical balls using a balance weighting machine in least number of tries.

  • Divide the balls into 3 groups of 3, 3, and 2 balls.

  • Weigh the first two groups against each other.

  • If they balance, the heavier ball is in the remaining group of 2 balls.

  • If one group is heavier, weigh two balls from that group against each other.

  • If they balance, the heavier ball is the remaining ball.

  • If one ball is heavier, that is the heavier ball.

Software Development Engineer Jobs

Apple India Pvt Ltd logo
Software Development Engineer 4-9 years
Apple India Pvt Ltd
4.3
Hyderabad / Secunderabad
Amazon Development Centre (India) Pvt. Ltd. logo
Software Development Engineer 3-8 years
Amazon Development Centre (India) Pvt. Ltd.
4.0
Bangalore / Bengaluru
Apple India Pvt Ltd logo
Cellular Software Development Engineer 10-15 years
Apple India Pvt Ltd
4.3
Bangalore / Bengaluru
6d ago

Q. Write code for designing the ADT (Abstract Data Type) for all the classes that might be required to represent the game of chess

Ans.

Design ADT for chess game classes

  • Create classes for pieces (king, queen, etc.), board, player, game

  • Use inheritance to represent different types of pieces

  • Implement methods for moving pieces, checking for checkmate, etc.

1d ago

Q. How would you optimize it for a binary search tree?

Ans.

Optimizing for binary search tree

  • Ensure the tree is balanced to maintain O(log n) search time

  • Implement efficient insertion and deletion algorithms

  • Use in-order traversal for sorted output

  • Consider using AVL or Red-Black trees for self-balancing

  • Avoid using recursion for large trees to prevent stack overflow

Share interview questions and help millions of jobseekers 🌟

man-with-laptop

Asked in Sigmoid

3d ago

Q. Given an integer array where elements represent stock prices and indices represent days, how do you detect the best day to buy and the best day to sell in O(N) time complexity?

Ans.

To detect the best day to buy and sell stock in an integer array representing stock prices and days in O(N).

  • Iterate through the array and keep track of the minimum price seen so far.

  • Calculate the profit by subtracting the current price from the minimum price.

  • Update the maximum profit and best buy/sell days accordingly.

  • Return the best buy and sell days to maximize profit.

3d ago

Q. Write code for the core functionality of the subtitle syncing application you mentioned.

Ans.

Code for subtitle syncing application

  • Create a function to parse subtitle file and extract time stamps

  • Create a function to parse video file and extract time stamps

  • Calculate time difference between subtitle and video time stamps

  • Adjust subtitle time stamps accordingly

  • Output synced subtitle file

4d ago

Q. what is polymorphism and interface , what is difference between interface and abstract class

Ans.

Polymorphism allows objects of different classes to be treated as objects of a common superclass. Interface is a contract that defines a set of methods that a class must implement.

  • Polymorphism allows for flexibility in programming by enabling a single interface to be used to represent multiple types of objects

  • Interfaces in Java are similar to abstract classes, but they cannot contain any implementation code

  • Abstract classes can have both abstract and concrete methods, while in...read more

Asked in Sigmoid

1d ago

Q. Where is the bean annotation used in Spring Boot? In a class or method?

Ans.

Bean annotation is used in Spring Boot on class or method to indicate that a method produces a bean to be managed by the Spring container.

  • Bean annotation is used on methods within a class to indicate that the method produces a bean to be managed by the Spring container.

  • It can also be used at the class level to indicate that the class itself is a Spring bean.

  • For example, @Bean annotation can be used on a method that creates and returns a DataSource bean in a configuration clas...read more

2d ago

Q. Write a program to check if a given sentence is a palindrome or not, taking input from the user.

Ans.

The program checks if a given sentence is a palindrome or not.

  • Prompt the user to input a sentence

  • Remove all spaces and punctuation from the sentence

  • Reverse the sentence and compare it with the original sentence to check for palindrome

Asked in Bridgenext

5d ago

Q. How can you flatten an array that contains multiple nested arrays into a single array with all elements?

Ans.

Flattening a nested array involves recursively extracting elements into a single array.

  • Use recursion: Define a function that checks if an element is an array. If it is, call the function on that element.

  • Example: For input [[1, 2], [3, [4, 5]]], the output should be [1, 2, 3, 4, 5].

  • Use Array.prototype.flat(): In JavaScript, you can use the flat method to flatten arrays to a specified depth.

  • Example: [1, [2, [3, 4]]].flat(2) results in [1, 2, 3, 4].

  • Use reduce: Combine elements i...read more

6d ago

Q. Given a 2D character matrix, find a specific string within it, allowing for horizontal, vertical, or diagonal arrangements.

Ans.

Search for a string in a 2D character matrix in any direction

  • Iterate through each cell of the matrix

  • For each cell, check all possible directions for the string

  • If found, return the starting and ending coordinates of the string

6d ago

Q. Write a function to reverse the characters in a string.

Ans.

This function reverses the characters in a given string and returns the reversed string.

  • Use Python slicing: `reversed_string = original_string[::-1]`.

  • Iterate through the string in reverse: `for char in original_string[::-1]:`.

  • Use the `reversed()` function: `''.join(reversed(original_string))`.

  • Example: Input: 'hello', Output: 'olleh'.

  • Example: Input: '12345', Output: '54321'.

5d ago

Q. What are the basics of SQL, including Data Definition Language (DDL) and Data Manipulation Language (DML)?

Ans.

SQL basics include DDL for defining database structures and DML for manipulating data within those structures.

  • DDL (Data Definition Language) includes commands like CREATE, ALTER, and DROP to define and modify database structures.

  • Example of DDL: CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(100));

  • DML (Data Manipulation Language) includes commands like SELECT, INSERT, UPDATE, and DELETE to manage data within tables.

  • Example of DML: INSERT INTO users (id, name) VALUES (1, ...read more

Asked in Sigmoid

6d ago

Q. Which access modifier restricts interface method access to only derived or implemented classes?

Ans.

Protected access modifier restricts interface method access to only derived or implemented classes.

  • Use 'protected' access modifier to restrict access to only derived or implemented classes

  • Protected members are accessible within the same package or by subclasses

  • Example: 'protected void methodName() {}' in an interface

Asked in Leena AI

6d ago

Q. 1) Time complexity of binary search for array and linked list

Ans.

Binary search has O(log n) time complexity for arrays and O(n) for linked lists.

  • Binary search is efficient for arrays due to their random access nature.

  • Linked lists require sequential traversal, making binary search inefficient.

  • For arrays, the time complexity is O(log n) as the search space is halved with each iteration.

  • For linked lists, the time complexity is O(n) as all nodes must be visited to find the target.

  • Binary search can be implemented recursively or iteratively.

Asked in Deeptek

5d ago

Q. How would you find a substring within a larger string without using built-in functions? What if the larger string is extremely large? What is the time complexity of your solution?

Ans.

Use a sliding window approach to search for a substring in a larger string without using built-in functions.

  • Iterate through the larger string using a window of the size of the substring to search for.

  • Compare the characters in the window with the substring to check for a match.

  • Move the window one character at a time until the end of the larger string is reached.

  • Time complexity is O(n*m) where n is the length of the larger string and m is the length of the substring.

3d ago

Q. Write the artificial intelligence logic in code for your Chess representation

Ans.

AI logic for Chess representation

  • Implement minimax algorithm with alpha-beta pruning

  • Use evaluation function to assign values to board positions

  • Implement move ordering to improve efficiency

  • Use transposition tables to store previously evaluated positions

  • Implement iterative deepening to improve search depth

6d ago

Q. What is the difference between the static and final keywords in Java?

Ans.

Static keyword is used to create class-level variables and methods, while final keyword is used to make a variable constant.

  • Static keyword is used to create variables and methods that belong to the class itself, rather than to any specific instance of the class.

  • Final keyword is used to make a variable constant and cannot be changed once it has been assigned a value.

  • Static variables are shared among all instances of a class, while final variables are unique to each instance.

6d ago

Q. How do you determine which technology or framework to use for a new project?

Ans.

Choosing the right technology involves assessing project requirements, team expertise, and long-term maintainability.

  • Evaluate project requirements: Understand the specific needs, such as performance, scalability, and security.

  • Consider team expertise: Leverage technologies that your team is already familiar with to reduce the learning curve.

  • Assess community support: Choose frameworks with strong community backing for better resources and troubleshooting.

  • Look at long-term maint...read more

1d ago

Q. What are the essential steps to consider when initiating a new software project?

Ans.

Initiating a software project involves defining goals, gathering requirements, and planning resources effectively.

  • Define project goals and objectives clearly. For example, 'Develop a mobile app for online shopping.'

  • Conduct a feasibility study to assess technical and financial viability.

  • Gather and document requirements from stakeholders, such as user stories or use cases.

  • Assemble a project team with the necessary skills, like developers, designers, and testers.

  • Create a project...read more

Asked in Info Edge

4d ago

Q. Find a palindrome, longest possible palindrome, find remainder without using modulus operator

Ans.

Answering questions on finding palindromes and remainders without modulus operator.

  • To find a palindrome, compare the first and last characters of the string and move towards the center until they meet or the string is not a palindrome.

  • To find the longest palindrome, iterate through all possible substrings and check if they are palindromes.

  • To find remainder without modulus operator, use repeated subtraction until the dividend is less than the divisor.

Asked in Sigmoid

1d ago

Q. How do services interact with each other in a microservice architecture?

Ans.

Microservices interact with each other through APIs, messaging, or events.

  • Microservices communicate with each other through APIs, which can be synchronous or asynchronous.

  • Messaging systems like RabbitMQ or Kafka can be used for communication between microservices.

  • Events can be used for loosely coupled communication between microservices.

  • Service discovery mechanisms like Eureka or Consul help microservices locate and communicate with each other.

  • API gateways can be used to mana...read more

Asked in Bridgenext

6d ago

Q. Given a string, how can you determine if it is a palindrome?

Ans.

A palindrome is a string that reads the same forwards and backwards. Check by comparing characters from both ends.

  • 1. Initialize two pointers: one at the start and one at the end of the string.

  • 2. Compare the characters at both pointers. If they are not the same, it's not a palindrome.

  • 3. Move the left pointer right and the right pointer left, and repeat the comparison.

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

  • Example: 'racecar' is a palindrome, while 'hello' is not...read more

3d ago

Q. What are the functions of SQL commands such as SELECT, INSERT, GRANT, and REVOKE?

Ans.

SQL commands like SELECT, INSERT, GRANT, and REVOKE manage data retrieval, insertion, and user permissions in databases.

  • SELECT: Retrieves data from one or more tables. Example: SELECT * FROM users;

  • INSERT: Adds new records to a table. Example: INSERT INTO users (name, age) VALUES ('Alice', 30);

  • GRANT: Provides specific privileges to users. Example: GRANT SELECT ON users TO user1;

  • REVOKE: Removes specific privileges from users. Example: REVOKE SELECT ON users FROM user1;

Asked in Infosys

6d ago

Q. How do you swap two numbers without using a third variable?

Ans.

Swap 2 numbers without using 3rd variable

  • Use addition and subtraction

  • Use multiplication and division

  • Use bitwise XOR operation

Asked in Sigmoid

5d ago

Q. Given an integer array, find the next greatest number for all elements and display the result in O(N) time complexity.

Ans.

Find the next greatest number for each integer in an array in O(N) time complexity.

  • Iterate through the array from right to left

  • Use a stack to keep track of potential next greatest numbers

  • Pop elements from the stack that are less than the current element and update their next greatest number to the current element

  • Push the current element onto the stack

  • Repeat until all elements have a next greatest number

1
2
3
Next

Interview Experiences of Popular Companies

TCS Logo
3.6
 • 11.1k Interviews
Accenture Logo
3.8
 • 8.6k Interviews
Amazon Logo
4.0
 • 5.4k Interviews
HCLTech Logo
3.5
 • 4.1k Interviews
Flipkart Logo
3.9
 • 1.5k 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

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