Microsoft Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

Gray Code --- Binary Code -- decimal equivalent
0000 0000 0
0001 0001 1
0011 0010 2
0010 0011 3
0110 0100 4
0111 0101 5
0101 0110 6
0100 0111 7
1100 1000 8
1101 1001 9
1111 1010 10
1110 1011 11
1010 1100 12
1011 1101 13
1001 1110 14
1000 1111 15

- Sunaina May 29, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The reflected binary code, also known as Gray code after Frank Gray, is a binary
for example gray code for 14 is 1001 and for 15 is 1000 they differ in only one digit i.e. for successive numbers 14 and 15 gray codes 1001 and 1000 differ by just 1 digit..similar is situation for any other two successive numbers

- Sunaina May 29, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

given binary code for a number say for 2 binary code is 0010. to find its gray code. start XORing from MSB(Most Significant Bit) with 0.
0 0 1 0
|
XOR
|
0
-----------
0 <-----Result = 0
XOR this resulting 0 with next bit of binary number
Result bit XOR Binary Code's bit=
i.e. 0 XOR 0 = 0 Result 0
Then 0 XOR 1 = 1 Result 1
Then 1 XOR 0 = 1 Result 1
So gray code becomes 0011

- Sunaina May 29, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

G = B XOR (SHR B)

- dan June 01, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

g = b ^ (b >> 1);

- Vamsi December 05, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

For each bit--- B to G
G[i] = XOR(B[i+1], B[i])

For each bit --- G to B
B[i] = XOR(B[i+1],G[i])

- Vamsi December 05, 2007 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More