Sr Software Engineer Interview Questions

67,372 sr software engineer interview questions shared by candidates

Imagine you are given 10,000 files each containing 1 Million integers. I would you sum all of them and give the final result? ---> Interviewer wanted to test scalability, distributed concepts. He has written the basic code and wanted to improve upon that. Here's the basic code. public getSum(String[] file_names) { int sum = 0; for(String f: file_names) { sum = sum + sumOfFile(f); } return sum; } Questions: What's wrong with above code? Ans: Integer overflow How would you implement sumOfFile? What if 'sumOfFile' takes lot of time to finish computing? How do you fasten the program?
avatar

Senior Software Engineer

Interviewed at Google

4.4
Mar 30, 2017

Imagine you are given 10,000 files each containing 1 Million integers. I would you sum all of them and give the final result? ---> Interviewer wanted to test scalability, distributed concepts. He has written the basic code and wanted to improve upon that. Here's the basic code. public getSum(String[] file_names) { int sum = 0; for(String f: file_names) { sum = sum + sumOfFile(f); } return sum; } Questions: What's wrong with above code? Ans: Integer overflow How would you implement sumOfFile? What if 'sumOfFile' takes lot of time to finish computing? How do you fasten the program?

Write a function in C that takes a string, and in-place xors the first char with the last, second with second last, etc., and after the middle part sets the char to 0. Do this efficiently. Is strlen after the function always equal to (strlen before +1)/2? When is it not?
avatar

Senior Software Engineer

Interviewed at Google

4.4
Jan 22, 2014

Write a function in C that takes a string, and in-place xors the first char with the last, second with second last, etc., and after the middle part sets the char to 0. Do this efficiently. Is strlen after the function always equal to (strlen before +1)/2? When is it not?

Viewing 2091 - 2100 interview questions

Glassdoor has 67,372 interview questions and reports from Sr software engineer interviews. Prepare for your interview. Get hired. Love your job.