Microsoft Interview Question for Software Engineer / Developers






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

What's the question here? Is it to:
Design the random play (shuffle) feature?
Code a random selection?
Test the random play?
Pick a random playlist?
As you can see from my post, there's no 10 word limitation on a question (or answer). Please reduce the signal to noise ratio here by posting concise, coherent questions.

- confused March 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Use a random number generation algorithm


Where m -> number of songsā€¦.

- Nithesh March 26, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

X(n+1) = (a. X(n) + b )mod m

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

Q. Pick a random song from a playlist such that you dont repeat until you are done with all songs in the playlist.
A. I would use a List (due to constant time remove/insert). generate a random number less than size of list. pick song with that index and remove from list. re-initialize the list to start over.

- question_answer_dO March 31, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I would use a array(n) to hold the songs in a playlist.
Generate a random number with seed between 0 to n.
Play the song at that index.
Swap the played song with the last song in the array.
Now again generate a random number with seed between 0 to n-1.
Once played swap with n-1 element.The process continues.
Adavntage is you dont require to change the array structure apart from swapping values.

- Anonymous April 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

@Anonymous: Something similiar to constructing heap and then extracting from it by assigning random numbers to thE SONGS initially

- Anonymous September 03, 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