Software Development Engineer
80+ Software Development Engineer Interview Questions and Answers for Freshers

Asked in Microsoft Corporation

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

Asked in Microsoft Corporation

Q. How would you find the least common ancestor of two nodes in a binary tree?
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

Q. Implement the "People you may know" feature of Facebook with code using BFS and a counter for mutual friends.
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

Asked in Microsoft Corporation

Q. How would you identify two nodes that have been swapped in a binary search tree?
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

Asked in Microsoft Corporation

Q. Given a binary tree, return a doubly linked list of all the nodes at each level.
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

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




Asked in Microsoft Corporation

Q. Write code for designing the ADT (Abstract Data Type) for all the classes that might be required to represent the game of chess
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.

Asked in Microsoft Corporation

Q. How would you optimize it for a binary search tree?
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 🌟

Asked in Sigmoid

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

Asked in Microsoft Corporation

Q. Write code for the core functionality of the subtitle syncing application you mentioned.
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

Asked in Ksolves India Limited

Q. what is polymorphism and interface , what is difference between interface and abstract class
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

Q. Where is the bean annotation used in Spring Boot? In a class or method?
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

Asked in Modak Analytics

Q. Write a program to check if a given sentence is a palindrome or not, taking input from the user.
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

Q. How can you flatten an array that contains multiple nested arrays into a single array with all elements?
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

Asked in Microsoft Corporation

Q. Given a 2D character matrix, find a specific string within it, allowing for horizontal, vertical, or diagonal arrangements.
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

Asked in Microsoft Corporation

Q. Write a function to reverse the characters in a string.
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'.

Asked in Future Focus Infotech

Q. What are the basics of SQL, including Data Definition Language (DDL) and Data Manipulation Language (DML)?
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

Q. Which access modifier restricts interface method access to only derived or implemented classes?
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

Q. 1) Time complexity of binary search for array and linked list
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

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

Asked in Microsoft Corporation

Q. Write the artificial intelligence logic in code for your Chess representation
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

Asked in Ksolves India Limited

Q. What is the difference between the static and final keywords in Java?
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.

Asked in Bluestock ™

Q. How do you determine which technology or framework to use for a new project?
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

Asked in Bluestock ™

Q. What are the essential steps to consider when initiating a new software project?
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

Q. Find a palindrome, longest possible palindrome, find remainder without using modulus operator
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

Q. How do services interact with each other in a microservice architecture?
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

Q. Given a string, how can you determine if it is a palindrome?
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

Asked in Future Focus Infotech

Q. What are the functions of SQL commands such as SELECT, INSERT, GRANT, and REVOKE?
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

Q. How do you swap two numbers without using a third variable?
Swap 2 numbers without using 3rd variable
Use addition and subtraction
Use multiplication and division
Use bitwise XOR operation

Asked in Sigmoid

Q. Given an integer array, find the next greatest number for all elements and display the result in O(N) time complexity.
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
Interview Questions of Similar Designations
Interview Experiences of Popular Companies





Top Interview Questions for Software Development Engineer Related Skills

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

