## Amazon Interview Question Software Engineer in Tests

• 0

There is a Command line program which gives the length of the Triangle sides.
Now write the possible test cases to trace if the triangle is Scalene , Isosceles or Equilateral ?

Country: India
Interview Type: Phone Interview

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

following are the test cases.. in case ny missing please point out
1.length zero not acceptable for ny of the side
2.should return scalene if a!=b!=c.
3.should return equilateral if a=b=c
4.should return isosceles if any two are equal.
5.negative edges not allowed.

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

and sum of two edges should be greater than third one.

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

1. Length of sides are 0,0, 0 : No triangle Should be made
2. Length of sides are -1, -1, -1 : No triangle Should be made with -ve values
3. Length of sides are 1, 0,X : no triangle can be made . only
numbers and no alphabets are accepted
4. Do not enter any values : Prompt to enter valid values
5. By entering the low and high end values 0.00001 , 100000,1000000 : Triangle should be made (Boundary value analysis)
6. The Summation of 2 sides should always greater than third value. Ex: 1,2,4 are the lenghths then - 1+2<4 . So

7. Length of all sides are equal : Equilateral triangle
8. Two sides length are equal : Isoscelous triangle
9. All lengths are unequal: Scalene triangle
10. Test with very small values , very large values and
combinations of both.

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

``````if(a<=0 || b<=0 || c<=0 || a+b<=c || a+c<=b || b+c<=a)
cout << "Error";
else if(a==b && b==c)
cout << "Equilateral";
else if(a==b || b==c || a==c)
cout << "Isosceles";
else
cout << "Scalene";``````

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

if(a==null || b==null || c==null)
cout<<"any of sides must not be null";

else if(a<=0 || b<=0 || c<=0 || a+b<=c || b+c<=a || c+a<=0)
cout<<"sides must be +ve numbers and sum of two sides must be greater than the third one";

else if(a==b && b!=c)
cout<<"isosceles triangle";

else if(a==b && b==c)
cout<<"equilateral triangle";

else if(a!=b && a!=c && c!=a)
cout<<"scalene";

else
cout<<"sides must not be alphabates, special chars";

Name:

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

### Books

is a comprehensive book walking you through every aspect of getting a job at a top tech company, while focuses on software engineering interviews.

### 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.