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

Asked in Carwale

Q. Given a string consisting of lowercase alphabets, write a function that returns 'yes' if the string contains all lowercase letters at least once. The solution should have O(N) time complexity and use no extra s...
read moreFunction to check if a string has all lowercase letters appearing at least once without extra space in O(N) time.
Create a boolean array of size 26 to keep track of the occurrence of each letter.
Iterate through the string and mark the corresponding index in the array as true.
Check if all the elements in the array are true and return yes if so.
Alternatively, use a bit vector to keep track of the occurrence of each letter.

Asked in Microsoft Corporation

Q. How would you design a text editor like notepad, focusing on the insert, delete, and search functionalities? What data structures would you use to efficiently implement these features, assuming other functional...
read moreDesigning a text editor requires efficient data structures for insert, delete, and search operations.
Use a linked list to represent lines of text, allowing efficient insertions and deletions.
For searching, maintain an index or use a hash map to quickly locate specific words or phrases.
Consider using a gap buffer for efficient insertions and deletions within a single line of text.
Implement a trie for efficient prefix searching, which can enhance search functionality.
SDE (Software Development Engineer) Interview Questions and Answers for Freshers

Asked in Carwale

Q. Given a balance and 100 coins, where one coin is heavier than the others, what is the minimum number of weighings required to find the heavier coin?
Find minimum number of weighings required to find the heavier coin out of 100 coins with a balance.
Divide the coins into 3 groups of 33 each and weigh 2 groups against each other.
If one group is heavier, divide it into 3 groups of 11 each and weigh 2 groups against each other.
Repeat the process until the heavier coin is found.
Minimum number of weighings required is 4.

Asked in Microsoft Corporation

Q. Given a binary search tree, print the path which has the sum equal to k and has minimum hops. That is, if there are multiple paths with the sum equal to k then print the path with the minimum number of nodes.
Given a binary search tree, print the path with sum k and minimum hops.
Traverse the tree using DFS and keep track of the current path and its sum.
If the current sum equals k, compare the current path with the minimum path found so far.
If the current sum is greater than k, backtrack to the previous node and continue traversal.
If the current sum is less than k, continue traversal.
Return the minimum path found.
Time complexity: O(nlogn) for balanced tree, O(n^2) for skewed tree.

Asked in Housing.com

Q. Given a 1024x1024 map with flats at locations (x, y) and a visibility index, display each flat with a 32x32 square on the map.
Given a map with flats and their location and visibility index, show every flat with a square of 32x32.
Create a 1024x1024 map with flats and their visibility index
Loop through each flat and draw a 32x32 square around it
Display the map with all the flats highlighted

Asked in Carwale

Q. Given a singly linked list, delete all nodes which have a greater value on right side.
Delete nodes in linkedlist with greater value on right side
Traverse the linked list from right to left
Compare each node with the maximum value seen so far
If the current node has a greater value, delete it
Update the maximum value seen so far
SDE (Software Development Engineer) Jobs




Asked in Carwale

Q. Explain priority scheduling (preemptive , non-preemptive). Explain a case when a low priority process will preempt a high priority process
Priority scheduling is a scheduling algorithm where processes are assigned priorities and executed based on their priority level.
Preemptive priority scheduling allows a higher priority process to interrupt a lower priority process that is currently running.
Non-preemptive priority scheduling allows a higher priority process to wait until the lower priority process finishes executing.
A low priority process can preempt a high priority process if the high priority process is wait...read more

Asked in Carwale

Q. Using the numbers 8, 8, 3, and 3, and the operations +, =, /, *, and parentheses, can you make 24?
Make 24 using 8, 8, 3, 3 using + = / * ( )
Use multiplication to get 8*3=24
Add the remaining 8 to get 32
Divide by the remaining 3 to get 10.67
Subtract the other 3 to get 7.67
Multiply by the remaining 3 to get 23.01
Add the remaining 8 to get 31.01
Divide by the remaining 8 to get 3.88
Add the other 3 to get 6.88
Multiply by the remaining 3 to get 20.64
Add the other 8 to get 28.64
Share interview questions and help millions of jobseekers 🌟

Asked in Carwale

Q. What is runtime polymorphism and compile time polymorphism? What are the differences between them?
Runtime polymorphism is when the method to be executed is determined at runtime, while compile-time polymorphism is determined at compile-time.
Runtime polymorphism is achieved through method overriding.
Compile-time polymorphism is achieved through method overloading.
Runtime polymorphism is also known as dynamic polymorphism.
Compile-time polymorphism is also known as static polymorphism.
Runtime polymorphism is associated with inheritance.
Compile-time polymorphism is associated...read more

Asked in Jio

Q. Given a sorted array, print all the elements that are not present in the array and state the time and space complexity of the algorithm.
Print all elements not present in a sorted array with time and space complexity.
Iterate through array and print missing elements
Use binary search for faster search
Time complexity: O(n log n)
Space complexity: O(1)

Asked in Carwale

Q. Given an array of size 98 containing natural numbers from 1 to 100, with two numbers missing, how would you find the missing numbers?
Given an array of size 98 with natural numbers from 1-100 but 2 numbers are missing, find them.
Calculate the sum of all numbers from 1-100 using the formula n(n+1)/2
Calculate the sum of all numbers in the array
Subtract the sum of array from the sum of all numbers to get the sum of missing numbers
Find the missing numbers by iterating through the array and checking which numbers are not present

Asked in Carwale

Q. Develop a tic-tac-toe game in C++ using object-oriented programming principles.
Develop tic-tac-toe game using OOPS concepts in CPP.
Create a class for the game board
Create a class for the players
Create a class for the game logic
Use inheritance and polymorphism for game objects
Implement functions for checking win/lose/draw conditions

Asked in Carwale

Q. Given a singly linked list, delete all nodes which have a greater value on the right side.
Delete nodes in a linked list which have greater value on right side
Traverse the linked list and compare each node with its right side node
If the current node's value is less than its right side node, delete the current node
Repeat the process until the end of the linked list is reached

Asked in Carwale

Q. Implement a max() function that returns the maximum of all elements in the stack with optimized time and space complexity.
Implement max() function to find the maximum element in a stack with optimized time and space complexity.
Use an additional stack to keep track of the maximum element at each step.
When pushing an element onto the stack, compare it with the top element of the maximum stack and push the larger one.
When popping an element from the stack, also pop the top element from the maximum stack if they are equal.
The top element of the maximum stack will always be the maximum element in the...read more

Asked in Jio

Q. Given a sorted array arr, and integers start and end, find all the elements within the range [start, end] that are missing from the array.
Find missing elements in a sorted array within a given range.
Loop through the array and check if each element is within the given range.
If an element is outside the range, add all the missing elements within the range to a list.
Return the list of missing elements.

Asked in Carwale

Q. What is inheritance? What are diffence types of inheritance?
Inheritance is a mechanism in object-oriented programming where a class inherits properties and behaviors from another class.
Inheritance allows code reuse and promotes code organization.
There are different types of inheritance: single inheritance, multiple inheritance, multilevel inheritance, hierarchical inheritance, and hybrid inheritance.
Single inheritance involves a class inheriting from a single base class.
Multiple inheritance involves a class inheriting from multiple ba...read more

Asked in Maventic Innovative Solutions

Q. 1. Sort characters in a string based on its frequency?
Sort characters in a string based on its frequency.
Create a dictionary to store character frequency
Sort the dictionary based on frequency
Reconstruct the string using the sorted dictionary

Asked in Carwale

Q. Calculate the sum of only the even numbers in the Fibonacci series.
The sum of even numbers in the Fibonacci series is calculated.
Generate the Fibonacci series up to a given limit
Iterate through the series and check if each number is even
If the number is even, add it to the sum
Return the sum of the even numbers

Asked in Jio

Q. Write a program to print all the elements not present in an unsorted array and analyze the time and space complexity of the algorithm.
Print all elements not present in an unsorted array and give time and space complexity.
Iterate through array and use a hashset to keep track of seen elements.
Print elements not in hashset.
Time complexity: O(n), Space complexity: O(n)

Asked in RadiSys

Q. In a file that has been opened, how do you move the cursor 5 characters ahead of the current position?
To move the cursor 5 characters ahead of current position in an opened file.
Use fseek() function to move the cursor to the desired position.
Pass the current position and offset to fseek() function.
Use SEEK_CUR as the reference point for the offset.

Asked in Bombardier Transportation

Q. What is Agile methodology and what are its advantages over the waterfall model?
Agile is an iterative approach to software development that emphasizes flexibility and customer satisfaction.
Agile involves breaking down projects into smaller, more manageable chunks called sprints.
It prioritizes collaboration between developers, customers, and stakeholders.
It allows for changes and adjustments to be made throughout the development process.
It promotes continuous delivery and improvement.
Advantages over waterfall model include faster time to market, increased...read more

Asked in Walmart

Q. Why can't we use arrow functions in constructors?
Arrow functions do not have their own 'this' value, which is required in constructors.
Arrow functions do not have a 'this' binding, so 'this' will refer to the parent scope.
Constructors require 'this' to refer to the newly created object.
Using arrow functions in constructors can lead to unexpected behavior and errors.

Asked in Housing.com

Q. Given names of some places in a locality with longitude and latitude, how would you mark the boundary of the locality?
Identify the boundary of a locality using geographical coordinates from place names.
Use the given longitude and latitude to plot points on a map.
Apply algorithms like Convex Hull to determine the outer boundary.
Example: For points A(1,2), B(2,3), C(3,1), the boundary can be formed.
Consider using libraries like Geopy or Shapely in Python for calculations.
Visualize the boundary using tools like Matplotlib or GIS software.

Asked in Carwale

Q. Write a function to find all permutations of a given string. The order of permutations does not need to be lexicographic.
Find all permutations of a given string.
Use recursion to swap each character with every other character in the string.
Repeat the process for each substring.
Add the permutation to an array.

Asked in Amazon

Q. Write a program to calculate the sum of nodes at each level of a tree.
Program to calculate sum of level order tree
Traverse the tree level by level using BFS
Add the values of each level and return the sum
Use a queue to store the nodes at each level
Handle edge cases like empty tree or null root

Asked in Microsoft Corporation

Q. Given two linked lists, each representing a number, create a linked list that represents their sum.
Create a linked list that contains the sum of two given linked lists representing numbers.
Traverse both linked lists simultaneously and add the corresponding nodes' values. If the sum is greater than 9, carry over the 1 to the next node.
If one linked list is longer than the other, add the remaining nodes to the sum.
Create a new linked list with the sum in reverse order.

Asked in Jio

Q. Find the equilibrium index where the sum of all the values before the equilibrium index is equal to the sum of all the values after the equilibrium index.
Find the equilibrium index where the sum of all values before it is equal to the sum of all values after it.
Iterate through the array and calculate the total sum.
Then iterate again and keep track of the left sum and right sum.
If they are equal at any index, return that index as the equilibrium index.

Asked in Freo

Q. Describe how you would design a chess game, including the backend API and project structure in an IDE.
Design a chess game with backend API and project in IDE.
Create a chess board with 64 squares and pieces
Implement game logic for moves and captures
Develop a RESTful API for game actions and data storage
Use a database to store game state and player information
Build a user interface for playing the game
Test thoroughly to ensure functionality and security

Asked in Carwale

Q. Optimize the above solution to less than O(n). Think outside the box.
Explore unconventional methods to achieve sub-linear time complexity for the given problem.
Use hashing to store previously computed results, allowing O(1) lookups.
Implement a divide-and-conquer strategy to reduce problem size recursively.
Consider using a probabilistic approach, like Bloom filters, for approximate results.
Utilize parallel processing to handle multiple data segments simultaneously.

Asked in McAfee

Q. What is an initializer list in C++? Provide an example.
Initializer list is a syntax in C++ to initialize objects with a list of values.
Initializer list is enclosed in curly braces {}.
It can be used to initialize arrays, structs, and classes.
Example: int arr[] = {1, 2, 3};
Example: struct Point { int x, y; } p = {1, 2};
Example: class Person { public: string name; int age; } p = {"John", 30};
Interview Experiences of Popular Companies





Top Interview Questions for SDE (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

