Amazon Interview Question for Software Engineer in Tests






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

i have written a method that returns the third largest integer in a given array.

public int thirdLargest(int arr[n]){
int j=0;
int max=arr[0];
int temp[n];

if(n<3)
return null;
for(i=0;i<=n;i++) {
if(arr[i]>max){
max=arr[i];
temp[j]=max;
j++;
}
}
return temp[j-2];
}

- mdrigalos May 31, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

They have asked for black box testing. Nowhere have they asked to write the program.

- Adi June 12, 2011 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

your program will fail when the input array has third highest value occurs after second or first
for ex array goes {22,3,4,1,24}.

- Royal October 13, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Null array
Two element array
Three element array with following cases:
All three same inputs
Two inputs same and the third one is largest or smallest(test for all three positions)
All three different elements with right answer in each of the slots
Test one case with all negative numbers and a mix of negative, positive and zero
Test array greater than 3 and keep the last number as the third largest.
Similar to above case but keep the first element as the largest
Try non numeric array like an array of strings

- Adi June 12, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

its good to test the numbers at their boundary conditions. for example, try with the max/min limit of integer (which may lead to overflow in the program). because the program may use i++ or i-- operators.

- sathishp123 June 15, 2011 | 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