Welcome Guest

Questions for Microsoft


Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/gpl4you/public_html/_config-rating.php on line 26
Rate the Questions

Rating: 3.1/5

Q. No. : 1
Question :Print all edge nodes of a complete binary tree anti-clockwise. In other words, print the boundary of the tree.
Solution Discuss
Q. No. : 2
Question :Given an n X n array with rows sorted and cols sorted, find the number of negative elements in most efficient way
Solution Discuss
Q. No. : 3
Question :Write an algorithm such that if an element in an MxN matrix is 0, its entire row and column is set to 0.
Solution Discuss
Q. No. : 4
Question :Given an unsigned integer 1345, the program constructs a linked list of 1->3->4->5.
Write the test cases for it.
Solution Discuss
Q. No. : 5
Question :Given two sorted arrays where the size of second array is large enough to hold the first array, write code to merge them (in sorted order). Write test cases
Solution Discuss
Q. No. : 6
Question :Write code to check if a string contains a substring.
Solution Discuss
Q. No. : 7
Question :how would you explain the "computer networks" to a Kindergarden child
Discuss
Q. No. : 8
Question :BFS a binary tree but print the last row in reverse order. Here last row means highest level leaf nodes.
Solution Discuss
Q. No. : 9
Question :Write a function that gets an integer and returns its string representation in Roman numbers.
Solution Discuss
Q. No. : 10
Question :How would you test an elevator?
Solution Discuss
Q. No. : 11
Question :There is a table on which a number of coins are placed. You also know that there are as many coins with Head up as many coins with Tail up. Now you have to divide the coins (number of coins is even) into two equal piles such that number of coins with Heads up and Tails up in either piles be the same. The catch is you are blind folded and you cannot determine the sides (for sure) if you are blinded .
Solution Discuss
Q. No. : 12
Question :Given a M*N matrix A in which all the elements in a row and all the elements in a column are strictly increasing. Find a path from the smallest element (ie A[0][0]) to the largest element (ie A[M-1][N-1]) such that the sum of the elements in the path is maximum. Time Complexity O(m+n). Use efficient space
Solution Discuss
Q. No. : 13
Question :Write a function to check if two strings are anagrams. Write a fuction to find all possible anagrams of a given string. You are given a method isWord() to check if the string is a valid word in a dictionary. Assuming that pre processing can be done what pre processing will u do inorder to speed up the process of finding anagrams.
Solution Discuss
Q. No. : 14
Question :Give examples of cases where you would prefer to pass objects/variables by reference instead of value?
Solution Discuss
Q. No. : 15
Question :Perform Sorted Insert on a link list and write test cases
Solution Discuss
Q. No. : 16
Question :Datastructure and algorithm for undo and redo of a wordprocessor?
Solution Discuss
Q. No. : 17
Question :Write a method that returns all subsets of a set.
Solution Discuss
Q. No. : 18
Question :Write a program to find the mirror image of a n-ary tree( may or may not binary)
Solution Discuss
Q. No. : 19
Question :Given a 2D array / matrix of integers. Write a program to print the elements in spiral order. Consider a matrix as show in the diagram to the right. The desired output of the program should be as: 1,2,3,4,8,12,16,20,19,18,17,13,9,5,6, 7,11,15,14,10.
Solution Discuss
Q. No. : 20
Question :Find an Item in a Sorted Array with Shifted Elements
Solution Discuss
Q. No. : 21
Question :There are two sorted arrays A1 and A2. Array A1 is full where as array A2 is partially empty and number of empty slots are just enough to accommodate all elements of A1. Write a program to merge the two sorted arrays to fill the array A2. You cannot use any additional memory and expected run time is O(n).
Solution Discuss
Q. No. : 22
Question :You are given an array containing positive integers. All the integers occur even number of times except one. Find this special integer.
Solution Discuss
Q. No. : 23
Question :Write a function to perform a binary search on a Sorted Array.
Solution Discuss
Q. No. : 24
Question :Given a singly linked list, find the node in the middle.
Solution Discuss
Q. No. : 25
Question :Given a singly linked list find the n-th node from the back.
Solution Discuss
Q. No. : 26
Question :How would you design the data structures for a very large social network (Facebook, LinkedIn, etc)? Describe how you would design an algorithm to show the connection,
or path, between two people
Solution Discuss
Q. No. : 27
Question :Write the code for producing/printing permutations of the characters in a string. For example: If "abc" is the input string, output permutations should be "abc", "bac", "bca", "acb", "cab", "cba".
Solution Discuss
Q. No. : 28
Question :Imagine you have ten trees to plant. You have to get an orchard
which must consist of five straight rows of trees and each row must
contain four trees. One straight line of ten trees cannot be used.
Thus the question is: what template could be used for the planting?
Solution Discuss
Q. No. : 29
Question :How will you implement pow(a,b) without using multiplication or division operators. You can use only add/substract operators.
Solution Discuss
Q. No. : 30
Question :Implement a queue using 2 stacks
Solution Discuss