First page Next page

Q13: Implement a multiple-reader-single-writer lock given a compare-and-swap instruction. Readers cannot overtake waiting writers.
tags: microsoft sw programming

Q14: Given a makefile, design the data structure that a parser would create and then write code that iterates over that data structure executing commands as needed.
tags: microsoft sw programming

Q19: (from Tara Hovel) A helicopter drops two trains, each on a parachute, onto a straight infinite railway line. There is an undefined distance between the two trains. Each faces the same direction, and upon landing, the parachute attached to each train falls to the ground next to the train and detaches. Each train has a microchip that controls its motion. The chips are identical. There is no way for the trains to know where they are. You need to write the code in the chip to make the trains bump into each other. Each line of code takes a single clock cycle to execute. You can use the following commands (and only these); MF - moves the train forward MB - moves the train backward IF (P) - conditional that is satisfied if the train is next to a parachute. There is no "then" to this IF statement. GOTO
tags: microsoft sw programming puzzle

Q30: You are given an array containing both positive and negative integers and required to find the sub-array with the largest sum (O(N) a la KBL). Write a routine in C for the above.
tags: microsoft sw programming c

Q31: Given an array of size N in which every number is between 1 and N, determine if there are any duplicates in it. You are allowed to destroy the array if you like. [ I ended up giving about 4 or 5 different solutions for this, each supposedly better than the others ].
tags: microsoft sw programming

Q32: Write a routine to draw a circle (x ** 2 + y ** 2 = r ** 2) without making use of any floating point computations at all. [ This one had me stuck for quite some time and I first gave a solution that did have floating point computations ].
tags: microsoft sw programming

Q33: Given only putchar (no sprintf, itoa, etc.) write a routine putlong that prints out an unsigned long in decimal.
tags: microsoft sw programming

Q34: Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it is a simple test.]
tags: microsoft sw programming

Q35: Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.
tags: microsoft sw programming

Q37: Give a very good method to count the number of ones in a "n" (e.g. 32) bit number.
tags: microsoft sw programming

Q38: What are the different ways to implement a condition where the value of x can be either a 0 or a 1. Apparently the if then else solution has a jump when written out in assembly. if (x == 0) y=a else y=b There is a logical, arithmetic and a data structure solution to the above problem.
tags: microsoft sw programming hw

Q39: Reverse a linked list.
tags: microsoft sw programming

Q40: Insert in a sorted list
tags: microsoft sw programming

Q41: In a Xs and 0s game (i.e. TIC TAC TOE) if you write a program for this give a fast way to generate the moves by the computer. I mean this should be the fastest way possible.
tags: microsoft sw programming

Q42: I was given two lines of assembly code which found the absolute value of a number stored in twos complement form. I had to recognize what the code was doing. Pretty simple if you know some assembly and some fundamentals on number representation.
tags: microsoft sw programming hw

Q43: Give a fast way to multiply a number by 7.
tags: microsoft sw programming

Q44: How would go about finding out where to find a book in a library. (You do not know how exactly the books are organized beforehand).
tags: microsoft sw programming puzzle

Q45: Linked list manipulation.
tags: microsoft sw programming

Q48: First some definitions for this problem: a) An ASCII character is one byte long and the most significant bit in the byte is always 0. b) A Kanji character is two bytes long. The only characteristic of a Kanji character is that in its first byte the most significant bit is 1. Now you are given an array of a characters (both ASCII and Kanji) and, an index into the array. The index points to the start of some character. Now you need to write a function to do a backspace (i.e. delete the character before the given index).
tags: microsoft sw programming

Q49: Delete an element from a doubly linked list.
tags: microsoft sw programming

Q50: Write a function to find the depth of a binary tree.
tags: microsoft sw programming

Q51: Given two strings S1 and S2. Delete from S2 all those characters which occur in S1 also and finally create a clean S2 with the relevant characters deleted.
tags: microsoft sw programming

Q52: Assuming that locks are the only reason due to which deadlocks can occur in a system. What would be a foolproof method of avoiding deadlocks in the system.
tags: microsoft sw programming os

Q53: Reverse a linked list.
tags: microsoft sw programming

Q54: Write a small lexical analyzer - interviewer gave tokens. expressions like "a*b" etc.
tags: microsoft sw programming

Q55: Besides communication cost, what is the other source of inefficiency in RPC? How can you optimize the communication?
tags: microsoft sw programming os

Q56: Write a routine that prints out a 2-D array in spiral order!
tags: microsoft sw programming

Q57: How is the readers-writers problem solved? - using semaphores/ada .. etc.
tags: microsoft sw programming os

Q58: Ways of optimizing symbol table storage in compilers.
tags: microsoft sw programming

Q59: A walk-through through the symbol table functions, lookup() implementation etc. - The interviewer was on the Microsoft Compiler team.
tags: microsoft sw programming

Next page


b(ond)log