Amazon Interview Question for Quality Assurance Engineers


Country: India
Interview Type: In-Person




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

1.First admin should check the availability of the systems. He or she can do in below manner:
a. Admin should role the dice once to select a host I.e if 1 then host 1 ,2 then host 2 and so on.
b. Admins should role the dice once again to allocate one of the machine from the selected host.i.e if he has already selected a host in step a then whatever the no comes on the dice the same numbered machine, admin can allocate.
c. Now moving ahead if admin is getting a no which is already allocated then he should repeat step a and b until and unless he gets an unallocated system.

- Prasenjeet September 13, 2014 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

import java.util.Random;
import java.util.Scanner;
public class ResourceAllocationWithDice
{

static int sum= 0;
static int[] rollRec = new int[6];
static Scanner sc=new Scanner(System.in);
public static void main(String[] args)
{
for (int i = 0; i < rollRec.length; i++)
{
sum=sum+rollRec[i];
}
Scanner sc = new Scanner(System.in);
char ch;
do
{ if(sum !=21)
{
System.out.print("To roll Dice press Y/y: ");
}
else
{
System.out.print("All reasource are allocated ");
System.exit(0);
}
ch =sc.nextLine().charAt(0); ;
Random r = new Random();
int Low = 1;
int High = 7;
int diceFaceValue = r.nextInt(High-Low) + Low;
System.out.println("Dice Face Value is : "+ diceFaceValue);
allocateResource(diceFaceValue);

}
while(ch=='Y' || ch=='y');

}
private static void allocateResource(int diceFaceValue)
{
if(rollRec[diceFaceValue-1]==0)
{
rollRec[diceFaceValue-1]=diceFaceValue;
sum =sum+diceFaceValue;
if(diceFaceValue==1)
{
System.out.println("Resource is assigned to 1st host");
}
else if(diceFaceValue==2)
{
System.out.println("Resource is assigned to 2nd host");
}
else if(diceFaceValue==3)
{
System.out.println("Resource is assigned to 3rd host");
}
else
{
System.out.println("Resource is assigned to "+ diceFaceValue+"th host");
}
}
else
{
if(diceFaceValue==1)
{
System.out.println("This Resource is Allready assigned to 1st host Please Roll dice again");
}
else if(diceFaceValue==2)
{
System.out.println("This Resource is Allready assigned to 2nd host Please Roll dice again");
}
else if(diceFaceValue==3)
{
System.out.println("This Resource is Allready assigned to 3rd host Please Roll dice again");
}
else
{
System.out.println("This Resource is Allready assigned to "+ diceFaceValue +"th host Please Roll dice again");
}
}

}
}

- JAI March 11, 2015 | 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