This set of JUnit Online Quiz focuses on “Stubbing a Web Server’s Resources”.
1. ______________ requires that only the first and second conditions of the RIP model are satisfied.
a) Weak mutation testing
b) Strong mutation testing
c) Weak test data
d) Strong test data
View Answer
Explanation: Weak mutation testing is satisfied if only the reach and inspect stages of the RIP model is met.
2. Weak mutation is closely related to ____________ methods.
a) Code Conduct
b) Code Coverage
c) Mutation Coverage
d) Mutation Redundancy
View Answer
Explanation: Weak mutation checks for only two steps, searching for faults similar to those found by Code coverage methods.
3. ________________ is a measure used to describe the degree to which the source code of a program is executed when a particular test suite runs.
a) Code Conduct
b) Code Coverage
c) Mutation Coverage
d) Mutation Redundancy
View Answer
Explanation: Code coverage checks the percentage of the source code that is executed during testing by test data.
4. _______________ is usually defined as a rule or requirement, which test suite needs to satisfy.
a) Code Conduct
b) Code Coverage
c) Coverage Criteria
d) Mutation Redundancy
View Answer
Explanation: Coverage Criteria defines the rules or criteria which the test suites need to pass.
5. For the statement if( a || b) , which is not a mutant?
a) if(a && b)
b) if(a & b)
c) if( a | b)
d) if( a || b)
View Answer
Explanation: The other three statements alter the original by changing the logical operator, hence introducing mutants.
6. Mutants which result in programs which are behaviourally equivalent to the original one are called ________________-
a) Statement coverage
b) Condition coverage
c) Equivalent Mutants
d) Dead Mutants
View Answer
Explanation: An equivalent mutant for the expression a=b+c would be a= b-(-c).
7. For the following function,
int example (int x, int y)
{
int z = 0;
if ((x>0) && (y>0))
{
z = x;
}
return z;
}
Which function call ensure statement coverage for this function?
a) example(0,0)
b) example(1,0)
c) example(0,1)
d) example(1,1)
View Answer
Explanation: The function call example(1,1) results in each statement of the function being executed leading to statement coverage.
8. For the following function,
int example (int x, int y)
{
int z = 0;
if ((x>0) && (y>0))
{
z = x;
}
return z;
}
Which function call ensure function coverage for this function?
a) ex(1,2)
b) example(3,4)
c) example1(1,2)
d) etra(2,3)
View Answer
Explanation: If during execution function ‘example’ is called at least once, then function coverage for this function is satisfied.
int example (int x, int y)
{
int z = 0;
if ((x>0) && (y>0))
{
z = x;
}
return z;
}
Which function call ensure branch coverage for this function?
a) example(1,1)
b) example(0,1)
c) example(1,1) and example(0,1)
d) example(1,1) and example(1,1)
View Answer
Explanation: In the first case, the two if conditions are met and z = x; is executed, while in the second case, the first condition (x>0) is not satisfied, which prevents executing z = x;
10. For the following function,
int example (int x, int y)
{
int z = 0;
if ((x>0) && (y>0))
{
z = x;
}
return z;
}
Which function call ensures condition coverage for this function?
a) example(1,1)
b) example(0,1)
c) example(1,1) and example(0,1)
d) example(1,0) and example(0,1)
View Answer
Explanation: These are necessary because in the first cases, (x>0) evaluates to true whereas in the second, it evaluates false. At the same time, the first case makes (y>0) false, whereas the second makes it true.
Sanfoundry Global Education & Learning Series – JUnit.
To practice all areas of JUnit for Online Quizzes, here is complete set of 1000+ Multiple Choice Questions and Answers.
If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]
- Practice Programming MCQs
- Check Programming Books
- Check JUnit Books
- Apply for Computer Science Internship