Software Development Engineer II
100+ Software Development Engineer II Interview Questions and Answers
Q1. Given 2 large numeric comma seperated strings. You need to calculate their sum along with maintaining the correct position of commas. Example Test Case - s1 - "123,456,788" s2 - "1" output - "123,456,789" const...
read moreCalculate sum of large numeric comma separated strings without converting to integers.
Split the strings by comma to get individual numbers
Iterate from right to left and add digits, carrying over if necessary
Maintain correct position of commas in the output string
Q2. How many microservices do I own & at what scale they handle the traffic?
I own 5 microservices that handle traffic at a scale of 10,000 requests per minute.
I own 5 microservices
They handle traffic at a scale of 10,000 requests per minute
Software Development Engineer II Interview Questions and Answers for Freshers
Q3. 1. Given an array find a subset that sums to a given sum K 2. Given an array with duplicate elements, print all triplets that sum to K. Each element at any index i can only be used once.
Given an array, find a subset that sums to a given sum K and print all triplets that sum to K.
Use a recursive approach to find subsets that sum to K
Use a nested loop to find triplets that sum to K
Avoid using duplicate elements in triplets
Q4. design a LLD of portfolio management system where you can add any stock to your portfolio sell any stock. calculate % return on your port folio. list your portfolio which is stocks with current prices and retur...
read moreDesign a portfolio management system to add and sell stocks, calculate returns, and display current prices and returns.
Create a class for the portfolio with methods to add and sell stocks
Implement a method to calculate the percentage return on the portfolio
Maintain a list of stocks in the portfolio with their current prices and returns
Use arrays or lists to store the portfolio data
Ensure proper error handling for invalid inputs or insufficient data
Q5. Difference between truncate and delete and when we prefer what operation?
Truncate removes all rows from a table, while delete removes specific rows. Truncate is faster but cannot be rolled back.
Truncate is a DDL operation while delete is a DML operation
Truncate resets the identity seed of the table, delete does not
Truncate is faster as it does not log individual row deletions, delete logs each row deletion
Truncate cannot be used on tables referenced by a foreign key constraint, delete can be used
Truncate operation cannot be rolled back, delete ope...read more
Q6. find a missing number in unsorted array which is having elements in the range[1,n]
Find a missing number in an unsorted array with elements in the range [1,n].
Use a hash set to store the elements and check for missing numbers.
Calculate the sum of all elements and subtract it from the sum of the range [1,n].
Use XOR operation to find the missing number.
Share interview questions and help millions of jobseekers 🌟
Q7. 1. To check if word 1 is an anagram of word 2. 2. Questions around Springboot basics 3. SOLID design principles.
To check if two words are anagrams, compare the sorted characters of each word.
Sort the characters of both words
Compare the sorted characters to check if they are equal
Handle edge cases like different lengths or special characters
Q8. Write a goroutine code which is synced to to another goroutine and waits till the 1st one passes some data to the next one.
Use channels in Go to sync two goroutines passing data between them.
Create a channel to pass data between the goroutines
Use a select statement to wait for data to be passed
Ensure proper synchronization to avoid race conditions
Software Development Engineer II Jobs
Q9. You are given a student table having columns as id, name, and score. find the top 20 percentile of student's details based on their score.
Calculate top 20 percentile of student details based on score in a student table.
Calculate the 80th percentile score using formula: 80th_percentile = 0.8 * total_students
Sort the scores in descending order and find the score at 80th percentile position
Retrieve student details with scores greater than or equal to the 80th percentile score
Q10. Design the database structure for the e-commerce service where you have to showcase which products have been ordered in an order.
Design a database structure for an e-commerce service to showcase ordered products.
Create a 'products' table with columns like product_id, name, price, etc.
Create an 'orders' table with columns like order_id, customer_id, order_date, etc.
Create a 'order_details' table to link products with orders, with columns like order_id, product_id, quantity, etc.
Use foreign keys to establish relationships between tables.
Consider indexing columns for faster retrieval of data.
Q11. Design google sheet. How will you handle concurrent editing in google sheets?
To handle concurrent editing in Google Sheets, use operational transformation to synchronize changes and resolve conflicts.
Implement operational transformation to track and merge concurrent edits
Use version control to manage different versions of the sheet
Apply locking mechanisms to prevent conflicts during editing
Utilize real-time collaboration features to notify users of changes
Implement conflict resolution strategies, such as last writer wins or manual resolution
Q12. Can you describe how a hashmap works?
A hashmap is a data structure that stores key-value pairs and allows for constant time lookup and insertion.
Hashmaps use a hash function to map keys to indices in an array.
Collisions can occur when multiple keys hash to the same index, which can be resolved using techniques like chaining or open addressing.
Example: HashMap
map = new HashMap<>(); map.put("key", 123); int value = map.get("key");
Q13. How many users did your system have?
The system had over 1 million users worldwide.
The system had a global user base.
The user count exceeded 1 million.
Users were from various countries and regions.
Q14. Implement a simplified Video Codex using data structures
Implement a simplified Video Codex using data structures
Use a hash table to store key-value pairs of video frames and their corresponding codecs
Implement a priority queue to efficiently retrieve the most frequently accessed video frames
Consider using a linked list to maintain the order of video frames in the codex
Q15. Machine coding round: Create a console application to show flights between two cities in min no of hops
Create a console application to show flights between two cities in min no of hops
Use graph traversal algorithms like BFS to find the shortest path between two cities
Represent cities and flights as nodes and edges in a graph data structure
Implement a console interface for users to input two cities and display the shortest path between them
Q16. Find the maximum distance between any two leaf nodes of a binary tree.
Find the maximum distance between any two leaf nodes of a binary tree.
Traverse the tree to find the maximum depth of left and right subtrees
Calculate the maximum distance by adding the depths of left and right subtrees
Q17. Why we use views, can we create indexes on that?
Views are virtual tables that simplify complex queries. Indexes can be created on views to improve performance.
Views are virtual tables created by querying one or more tables.
They simplify complex queries by storing the query logic in the view.
Indexes can be created on views to improve query performance.
Indexes on views can speed up data retrieval by allowing the database to quickly locate the relevant data.
Q18. Given sorted array count the number of occurrences of given element.
Count occurrences of given element in a sorted array.
Use binary search to find the first and last occurrence of the element.
Subtract the indices to get the count of occurrences.
Handle edge cases like element not present in array.
Q19. When to use horizontal scaling and vertical scaling
Horizontal scaling is adding more machines to your pool of resources, while vertical scaling is adding more power (CPU, RAM) to an existing machine.
Use horizontal scaling when you need to increase capacity by adding more machines to distribute the load.
Use vertical scaling when you need to handle increased load on a single machine by adding more resources like CPU or RAM.
Horizontal scaling is more cost-effective and provides better fault tolerance.
Vertical scaling is easier t...read more
Q20. How to plan ETL for various data sources?
Plan ETL for various data sources by identifying sources, defining data extraction methods, transforming data, and loading into target systems.
Identify all data sources and understand their structure and format
Define data extraction methods based on the source systems (e.g. APIs, databases, files)
Transform data as needed to match the target system's schema and requirements
Consider data quality issues and implement data cleansing processes
Load the transformed data into the tar...read more
Q21. maximum length of the subarray which has almost 2 distinct elements
Find the maximum length of a subarray with almost 2 distinct elements.
Use a sliding window approach to keep track of the count of distinct elements in the subarray.
Update the window size based on the number of distinct elements in the subarray.
Keep track of the maximum length encountered so far.
Q22. Why use a library and if not then why use a polyfill
Libraries provide pre-written code for common tasks, while polyfills fill in missing browser functionality.
Libraries save time by providing pre-written code for common tasks
Polyfills fill in missing browser functionality for older browsers
Libraries can improve code readability and maintainability
Polyfills can help ensure consistent behavior across different browsers
Using libraries and polyfills can help developers focus on higher-level logic rather than low-level implementati...read more
Q23. Design SkipTracker() for amazon prime music.
Design SkipTracker() for Amazon Prime Music
SkipTracker() should keep track of skipped songs in Amazon Prime Music
It should maintain a list of skipped songs as an array of strings
The list should be updated whenever a song is skipped
SkipTracker() should provide methods to add, remove, and retrieve skipped songs
Q24. Difference between clustered, unclustered, and unique index?
Clustered index physically reorders the data in the table, unclustered index does not, unique index enforces uniqueness of values.
Clustered index physically reorders the data in the table based on the index key. Only one clustered index per table.
Unclustered index does not reorder the data in the table. Can have multiple unclustered indexes per table.
Unique index enforces uniqueness of values in the indexed column(s). Can be clustered or unclustered.
Q25. Design chat room where users can chat with each other and also able to join chat room
Design a chat room system where users can chat with each other and join chat rooms.
Implement user authentication and authorization to ensure secure access to chat rooms.
Create a database to store chat messages, user information, and chat room details.
Develop a real-time messaging system using websockets for instant communication.
Allow users to create new chat rooms and join existing ones.
Include features like message history, notifications, and user profiles.
Q26. Four back-to-back 1 hour sessions with 1 hour lunch break. system design with the manager, LC medium-hard questions with the rest of the interviewers.
The interview consists of four back-to-back 1 hour sessions with 1 hour lunch break, including system design with the manager and LC medium-hard questions with the rest of the interviewers.
Prepare for system design questions with the manager by understanding scalability, reliability, and performance considerations.
Practice solving LC medium-hard questions to showcase problem-solving skills and algorithmic knowledge.
Take advantage of the lunch break to relax and recharge for t...read more
Q27. Difference between temp table, global table and variable table?
Temp table is local to a session, global table is accessible across sessions, variable table is a table variable declared in a function or stored procedure.
Temp table is created and dropped automatically when the session ends.
Global table is created using a double hash (##) prefix and is accessible across sessions.
Variable table is a table variable declared in a function or stored procedure and is only accessible within that scope.
Q28. decode the string. if integer is present, expand it those many times. ab2[b3[ac]]de --> abbacacacbacacacde
Decode a string by expanding integers to repeat characters within brackets.
Iterate through the string character by character
If a digit is encountered, keep track of the number
When encountering '[', push the current result and number onto the stack
When encountering ']', repeat the substring inside brackets based on the number on top of the stack
Continue until the entire string is decoded
Q29. A number x is given, two operation are allowed. Decrement by 1 and multiply by 2. find min operation to convert x to y.
Given a number x, find the minimum number of operations (decrement by 1 or multiply by 2) to convert it to y.
Use a breadth-first search (BFS) approach to explore all possible operations and find the minimum number of steps.
Start with x and generate all possible next numbers by decrementing or multiplying by 2.
Keep track of the number of steps taken to reach each number and stop when y is found.
Use a queue to implement the BFS algorithm.
Example: x = 10, y = 30. Possible steps:...read more
Q30. What advantage does streams in Java8 has over for loops.
Streams in Java8 offer concise and readable code for processing collections compared to traditional for loops.
Streams provide functional-style operations like map, filter, and reduce for easy data processing.
Streams allow for parallel processing of data, potentially improving performance.
Streams promote immutability and encourage writing more declarative code.
Streams reduce boilerplate code and make the code more readable and maintainable.
Example: Using streams to filter a li...read more
Q31. What is the difference between interface & abstract class
Interface is a contract with no implementation, while abstract class can have some implementation.
Interface can only have abstract methods, while abstract class can have both abstract and non-abstract methods.
A class can implement multiple interfaces but can inherit only one abstract class.
Interfaces are used to achieve multiple inheritance in Java.
Abstract classes can have constructors, while interfaces cannot.
Example: Interface - Runnable, Abstract class - Animal with abstr...read more
Q32. Given Binary tree print the path having largest sum
Given a binary tree, find the path with the largest sum of node values.
Use depth-first search to traverse the tree and keep track of the current path sum.
At each node, compare the current path sum with the maximum path sum seen so far.
Return the path with the maximum sum.
If the tree is empty, return an empty path.
Q33. write an in memory backend for a social media app in 90 mins
Implement an in-memory backend for a social media app in 90 mins
Use a HashMap to store user profiles and posts
Implement methods for CRUD operations on user profiles and posts
Consider implementing data structures like LinkedList or PriorityQueue for managing posts in chronological order
Q34. Implement merge sort from scratch for sorting array of objects based on given key
Implement merge sort algorithm to sort array of strings based on a given key
Divide the array into two halves recursively
Merge the two sorted halves based on the given key
Repeat until the entire array is sorted
Example: ['apple', 'banana', 'cherry'] sorted based on length: ['apple', 'cherry', 'banana']
Q35. Write a code to find the number in a sorted array in with lowest code complexity
Implement binary search to find the number in a sorted array with lowest code complexity.
Use binary search algorithm to efficiently find the number in the sorted array.
Compare the target number with the middle element of the array and adjust the search range accordingly.
Repeat the process until the target number is found or the search range is exhausted.
Q36. Given a binary string,find out the max length of substring having equal number of 1 and 0
Find max length of substring with equal 1s and 0s in a binary string.
Use a hash table to store the difference between the count of 1s and 0s seen so far.
If the difference is 0, update the max length seen so far.
If the difference is already in the hash table, update the max length using the current index and the index where the difference was first seen.
Return the max length.
Example: '1100010110' -> 8
Q37. determine the order of scheduling of jobs given jobs and its dependency
Determining job scheduling order based on dependencies
Create a directed graph with jobs as nodes and dependencies as edges
Use topological sorting to determine the order of scheduling
If there is a cycle in the graph, it is not possible to schedule the jobs
Consider using depth-first search to traverse the graph
Q38. Reverse a linked list, number of character in string
Reverse a linked list and find number of characters in a string.
To reverse a linked list, we can iterate through the list and change the pointers to reverse the order.
To find the number of characters in a string, we can use the length property or iterate through the string and count the characters.
For example, to reverse a linked list:
Node* prev = NULL; Node* current = head; Node* next = NULL; while (current != NULL) { next = current->next; current->next = prev; prev = curre...read more
Q39. Implement timer in React, useTimeout and disbale the timer after unmounting
Implement timer in React using useTimeout and disable it after unmounting
Use useState to store the timer ID
Use useEffect to start the timer on component mount and clear it on unmount
Use clearTimeout to disable the timer when the component unmounts
Q40. Low level design for a product including designing classes and database
Designing classes and database for a product
Identify the entities and relationships in the system
Create a class diagram with attributes and methods
Design the database schema with tables and relationships
Consider performance, scalability, and security
Use appropriate design patterns and principles
Q41. Given a pointer to middle of Linked List remove the node.
Remove the given node from the middle of a Linked List.
Use two pointers, one moving at double the speed of the other to find the middle node.
Update the pointers to remove the middle node by skipping it in the list.
Q42. From the given list of strings, find the first k most occurring strings
Find the first k most occurring strings from a given list
Use a hashmap to store the frequency of each string
Sort the hashmap based on frequency in descending order
Return the first k keys from the sorted hashmap
Q43. create few basic routes for specific requirements, create schema diagram for a requirement.
Create basic routes and schema diagram for specific requirements.
Identify the specific requirements for the routes and schema
Design the routes based on the HTTP methods (GET, POST, PUT, DELETE)
Create the necessary endpoints and handlers for each route
Define the schema for the data to be used in the routes
Create a diagram to visualize the relationships between the schema entities
Q44. Given a Matrix of character[][]. Write a program to search a string in that matrix efficiently.
Search for a string efficiently in a character matrix.
Use depth-first search (DFS) or breadth-first search (BFS) to traverse the matrix and search for the string.
Optimize by pruning search paths if a mismatch is encountered.
Consider using a Trie data structure for faster string matching.
Handle edge cases like empty matrix or string, out of bounds indices, etc.
Q45. 1. Sudoku solver. 2. Find the repetitive element in the list.
Implement a Sudoku solver and find the repetitive element in a list.
For the Sudoku solver, implement a backtracking algorithm to fill in the empty cells while ensuring each row, column, and 3x3 subgrid contains unique numbers.
For finding the repetitive element in a list, iterate through the list and keep track of the frequency of each element using a hashmap. Return the element with frequency greater than 1.
Example for Sudoku solver: [[5,3,0,0,7,0,0,0,0],[6,0,0,1,9,5,0,0,0],....read more
Q46. Find number of employees under every manager, coding
Use a hierarchical query to find the number of employees under each manager.
Use a recursive query to traverse the organizational hierarchy
Count the number of employees under each manager
Group the results by manager
Q47. HashSet Internal Implementation and sort the elements in a hashset
HashSet is implemented using a hash table. Elements are not sorted in a HashSet.
HashSet is implemented using a hash table data structure.
Elements in a HashSet are not sorted, as they are stored based on their hash code.
To sort elements in a HashSet, you can convert it to a List and then sort the List.
Q48. Simple DSA question- cycle in linked list, sorting algos
Detect cycle in a linked list and sorting algorithms
To detect a cycle in a linked list, you can use Floyd's Tortoise and Hare algorithm
Common sorting algorithms include Bubble Sort, Selection Sort, Insertion Sort, Merge Sort, Quick Sort, etc.
Q49. What is different states in Activity lifecycle
Different states in Activity lifecycle include onCreate, onStart, onResume, onPause, onStop, onDestroy.
onCreate - Activity is being created
onStart - Activity is becoming visible to the user
onResume - Activity is in the foreground and has focus
onPause - Activity is partially visible but still running
onStop - Activity is no longer visible to the user
onDestroy - Activity is being destroyed
Q50. What is CDC in sql service?
CDC stands for Change Data Capture in SQL Server.
CDC is a feature in SQL Server that captures changes made to data in a table.
It allows you to track insert, update, and delete operations on the table.
CDC uses a separate table to store the changes made to the tracked table.
It is useful for auditing, data replication, and data warehousing purposes.
Interview Questions of Similar Designations
Top Interview Questions for Software Development Engineer II Related Skills
Interview experiences of popular companies
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/Month