Microsoft Interview Question for Software Engineer in Tests


Team: Azure
Country: United States




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

I think 4 cases...

1. One case to cover first if block (happy path for first IF)
2. One case to cover second if block (happy path for second IF)
3. Negative scenario which doesnt meet first IF block.
4. Negative scenario which doesnt meet second IF block.

- Basu February 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

not 4 but 3, as if we find cyclomatic complexity of the graph then it is 3.
so total 3 test cases for 2 simple if with simple conditions.......

- kathrotiyanimesh May 28, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Depends entirely on what kind of coverage they are looking for and what's in the if blocks.

If they are interested in node/block coverage (like most CC%-counting tools) and there are no "return" or "throw" statements inside the if blocks, it'll take just one test case that goes into both if blocks.

The 4 cases are necessary for path coverage (2^2 since each if block can either be "true" or "false").

- misha March 06, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think there are two cases only:
1. First IF is covered but not second
2. Second IF is covered but not first.

The other two cases:
3. Neither IF are traversed
4. Both IFs are traveresed

These two add no extra coverage from the first two cases.

- Sudhir September 16, 2012 | 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