Microsoft Interview Question for Software Engineer / Developers






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

{
int pixelPos = getScreenWidth() * y + x;
pixelArray[pixelPos] = true;
}

- Anonymous January 03, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

int pixelPos = getScreenWidth() * y + x;
  pixelArray[pixelPos] = true;

- Anonymous January 03, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

if you are measuring width along x axis dont you think it should be
getScreenWidth() * x + y e.g. (1,2) would be stored in the 73rd position if width is 70 (lets say). Correct me if i am wrong or reading it incorrectly.)

- hary February 19, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

int pixelPos = (getScreenWidth() - 1) * y + x;
  pixelArray[pixelPos] = true;

- pixelator March 20, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

you guys sure abt the expression you have used for pixelPos?
IMO, it should be something like this:
pixelPos=no_of_cols*(x-1)+y

- Anonymous January 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

No you are wrong. (x,y) here does not denote a matrix element. It denotes a coordinate of a point.

- spsneo January 25, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

you guys sure abt the expression you have used for pixelPos?
IMO, it should be something like this:
pixelPos=no_of_cols*(x-1)+y

- aadith January 04, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Doesnt setpixel(x,y) simply work?

- helloworld January 05, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

No it wont work.

- Anonymous January 06, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Say resolutio is :640x480

GetPos(1,1) should return 0
GetPos(2,1) should return 1
GetPos(3,1) should return 2
GetPos(640,480) should return 306081

so the formula should be
GetPos(x,y)
{
return Width*(y-1) + (x-1)
}

- Crime_master_gogo August 01, 2010 | 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