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 numeral system where two successive values differ in only one digit.

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

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

www.faqs.org/faqs/ai-faq/genetic/part6/section-1.html

- dan June 01, 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
Comment hidden because of low score. Click to expand.
0
of 0 votes

the idea is that applying n-1 times gray code function to an n-bit integer gives the inverse gray code,
note also that: applying gray code 2 times is: x ^ (x >> 2), this can be easily verified: y = x ^ (x >> 1), z = y ^ (y >> 1) = (x ^ (x >> 1)) ^ ((x ^ (x >> 1)) >> 1) = x ^ (x >> 1) ^ (x >> 1) ^ (x >> 2) = x ^ (x >> 2).
That is, to apply gray code n-1 times we do the following (for 32-bit ints):

inverse_gray_code(int x) {
x ^= (x >> 1);
x ^= (x >> 2);
x ^= (x >> 4);
x ^= (x >> 8);
x ^= (x >> 16);
return x;
}

- pavel.em June 15, 2008 | Flag


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