Microsoft Interview Question for Software Developers

Country: India
Interview Type: In-Person

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

I don't know what he expects, but I would do following:
1) split 10GB file into 4 chunks (read row by row until I fill about 2.5 Gb of memory)
2) sort each chunk in memory using quicksort (because it does not consume additional memory)
3) write every chunk back to the disk
4) using mergesort algorithm to merge data back to single sorted array reading from chunks by pieces and writting it simultaneously to the disk into the destination file.

- Alexey March 25, 2020 | Flag Reply
Comment hidden because of low score. Click to expand.
of 0 votes

how you can split 10gb file we have only 4gb ram

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

1. Read file line by line and into a new file. Whenever new file size is greater than 2.5 GB create a new file and start adding into new file.

2. Now sort every file individually.

3. Using sorted merge algorithm, read line by line from all file and only add smaller data into new file and move to next line of that particular file.

- AKS May 08, 2020 | Flag Reply

Add a Comment

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


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


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