Amazon Interview Question for Quality Assurance Engineers


Country: India
Interview Type: In-Person




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

There are multiple pieces at work here. At least:
1. URL to open HTML page
2. TAG finding algorithm
3. Sorting algorithm

You'd want to test each of these areas with some combination of input. Below gives an idea of where to start.

Normal cases:
- Open URL to HTML page has a mixture of desired tag and random other tags

Edge cases:
- HTML page has nothing but one of the desired tag with one number
- HTML page has only undesired tags
- Tags contain max/min number allowed
- Tags contain negative numbers

Weird cases:
- Make tag data already sorted, or sorted in reverse
- Tags all contain the same number

Extreme cases:
- A massive HTML file with enough of the desired tag to cause some overflow
- Tags contain numbers too big for datatype being used (ex. 32-bit integer)

Invalid input:
- Provide invalid URL
- Provide desired tag in HTML but with no number inside it
- Provide empty HTML page

- JW March 20, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Below piece of code is written in c# but not tested.
///Code for get response from the given url
private HtmlDocument HttpClient()
{
	HtmlDocument docuemnt = new HtmlDocument();
	var httprequest = (HttpWebRequest)webrequest.create(url));
	using(streamReader reader = new streamReader(httprequest.GetResponse().GetResponseStream()))
	{
		doucment.LoadHtml(reader.ReadToEnd());
		reader.close();
	}

	return docuement;
}

public void SortIntegerInAscendingOrder()
{
	HtmlDocuement document = HttpClient();
	int[] number = new int[];
	HtmlNodeCollection nodeCollection = docuement.docuementNode.SelectNodes("xpath for specific TAG");
	if (nodeCollection != null)
	{
		foreach(HtmlNode node in nodeCollection)
		{
			number.Add(node.value);
		}
		//selection sort technique;
		Sorting(number);
	}
}

private void Sorting(int[] number)
{
	//Here use selection sort technique
}

- Aarti April 07, 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