## Amazon Interview Question

Quality Assurance Engineers**Country:**United States

**Interview Type:**Phone Interview

public class XpowerOfY

{

public static void main(String args[])

{

int x,y, pow=1;

Scanner in = new Scanner(System.in);

System.out.println("enter the value of x");

x = in.nextInt();

System.out.println("enter the value of y");

y = in.nextInt();

for(int i=0;i<y;i++)

{

pow = pow * x;

}

System.out.println("x power of y= "+pow);

}

}

As an Automation Tester, concentrate more on data :

1. A Function will be build where this function will supply the input values x & y to the API / Program and captures the response from the API / Program.

2. once the response is captured. compare the expected outcome with the actual outcome, by calling the respective API / Program, say Test data is residued in Spread sheet .

3. Frame all Positive, Negative, Boundary, Exceptional conditions are covered as input in the Spreadsheet.

Here are few scenarios:

Positive

1. x = positive integer , y = negative integer, outcome = valid response

...

Negative

2. x = non numeric number, y = postive integer, outcome = invalid response (Error message)

Exceptional;

3. x = 0, y =0 , Outcome = invalid response (Error message)

Boundary / Memory Leak;

4. x= Big positive integer, y = Big Positive integer, outcome = invalid response (Error message)

Rounding the outcome

5. x= postive integer, y = Big Negative integer, outcome = Response with rounding the decimal value

and many more scenarios like:

1. if x, y are irrational like, i = sqrt(-1).

2. x = character, y = integer...............

function signature please

- LookSkywalker October 09, 2013precondition and postconditions please

then can be answered