Microsoft Corporation
10+ AdamsBridge Global Interview Questions and Answers
Q1. 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
Q2. How would you find 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
Q3. 4. What is normalization? Explain 2NF, 3NF, BCNF. (I didn’t know BCNF).
Normalization is the process of organizing data in a database to reduce redundancy and dependency.
2NF eliminates partial dependencies by ensuring that non-key attributes depend on the entire primary key.
3NF eliminates transitive dependencies by ensuring that non-key attributes depend only on the primary key.
BCNF eliminates overlapping candidate keys by ensuring that each determinant is a candidate key.
Q4. What are indexes, clustered and non-clustered indexes?
Indexes are used to improve database performance by allowing faster data retrieval. Clustered indexes determine the physical order of data, while non-clustered indexes are separate structures.
Indexes are used to speed up data retrieval in databases
Clustered indexes determine the physical order of data in a table
Non-clustered indexes are separate structures that point to the data in a table
A table can have only one clustered index, but multiple non-clustered indexes
Indexes can...read more
Q5. 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
Q6. Given a binary tree, return 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.
Q7. 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.
Q8. 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
Q9. Write code for the subtitle syncing application you talked about, not the entire thing, just the crux of it.
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
Q10. 2. Print first 200 Fibonacci numbers in reverse order. (I did it but it was not efficient).
Print first 200 Fibonacci numbers in reverse order.
Use an array to store the Fibonacci numbers
Start with 0 and 1, then add the previous two numbers to get the next one
Loop through the array in reverse order to print the numbers
Q11. Find a string in a 2D character matrix in any order(horizontal/vertical/diagonal)
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
Q12. 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
Q13. 3. Check whether a string is palindrome or not
Check if a string is a palindrome or not.
A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward.
To check if a string is a palindrome, compare the first and last characters, then the second and second-to-last characters, and so on.
If all pairs match, the string is a palindrome. If any pair does not match, the string is not a palindrome.
Ignore spaces, punctuation, and capitalization when checking for palindromes.
Q14. Design File upload and download service
Design a file upload and download service for efficient and secure file management.
Use a secure authentication mechanism to ensure only authorized users can upload and download files.
Implement file size restrictions and validation to prevent large or malicious files from being uploaded.
Utilize cloud storage solutions for scalability and reliability.
Include version control to track changes and updates to files.
Consider implementing file encryption for added security.
Provide a ...read more
More about working at Microsoft Corporation
Top HR Questions asked in AdamsBridge Global
Interview Process at AdamsBridge Global
Top Software Development Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month