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?
Sr Software Engineer Interview Questions
67,372 sr software engineer interview questions shared by candidates
4. Randomly Pick n elements from a given array of m elements.
Did you write an application using our api?
Design, coding and behavior
How Spring Boot use in application and benefits.
balloon popping algorithm implementation for high scalability
Explain the difference between Factory and Abstract factory pattern
What is your favorite language and why?
Design a database schema for specific use case (DB design)
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