Introduction to Software Testing: Week 1 Quiz answers

 Overview Quiz

1) Design and prototype walk-throughs with users are example of:
validation
Verification
ANS- Validation

2)Unit tests mapping requirements (or User Stories in Agile development) to class behaviors are examples of:
validation
Verification
ANS- Verification

3) User interviews to see if requirements/User Stories match the user's expectations of how the system will perform are examples of:
validation
Verification
ANS- Validation

4) Refactoring is a technique that modifies the structure of software to improve the design (or some non-functional attribute such as performance) without changing the functionality of the software.  
Regression testing after refactoring the system to determine whether it behaves the same as the non-refactored version is an example of:

validation
Verification
ANS- Verification

5) Which of the following are strengths of testing? (Check all that apply)
It Checks the whole system, including software you didn't write.
It can conclusively determine whether the software is correct.
It documents system behavior.
ANS
It Checks the whole system, including software you didn't write.
It documents system behavior.

Quiz on the difficulty of software testing:

1) We said that software testing is different than testing in many disciplines because software is discontinuous.  In mathematics, continuity means that if you know the value of a function at one point, you can make claims about its value at points nearby.  Why does this matter for testing?
Continuous systems are simpler to test because you can often extrapolate test results from one point to points 'nearby'
Computer systems are easier to test than continuous systems have an infinite number of points to test while software is finite.
There is no way to test software throughly.
ANS- Continuous systems are simpler to test because you can often extrapolate test results from one point to points 'nearby'

2) We said that the Zune needed tests for boundary conditions. These are values that check that the boundaries of arithmetic or relational expressions (like ==, !=, <, >, <=, >=) are tested.  What are examples of boundary condition tests for the following function? 

int flipSome(int A , int N, int X) 
  int i=0; 
  while (i<N) 
  { 
    if (A<X) 
      A = -A; 
    i++; 
  } 
  return(1); 
}

A=1, N=5,X=5
A=1, N=10,X=1
A=5, N=5,X=5
ANS - 
A=1, N=10,X=1
A=5, N=5,X=5
3) Is testing a (primarily) optimistic or pessimistic verification technique?
optimistic
Pessimistic
ANS - Optimistic

4) Is it always possible to prove whether any program meets its requirements in all cases, given enough effort?
No
Yes
ANS- No

Quiz on "What is Test":

1) An automated oracle is:
A program that automatically generates test-cases
A program that automatically matches the actual program output to the expected output of the test case.
A program that automatically generates input test data.
All of the above.
ANS - A program that automatically generates test-cases

2) The setup step for a test case is important to establish a specific state for the program to run the test.
True
False
ANS - True

3) Tasks that can be part of the tear down phase are (choose two answers): 
Initialize test case value.
Remove data you added after testing is done.
Open connection for testing.
Close connection after testing is done.
ANS
Remove data you added after testing is done.
Close connection after testing is done.

4) Assessment is the phase where:
Software output is checked by an oracle.
Test cases are run.
Test data is initialized.
ANS -  Software output is checked by an oracle.

Automation: Using a Test Framework

1) Testing execution frameworks (e.g., JUnit) are important because:
They allowed automated checks against an oracle(e.g. Do the outputs of the program match expectations?) to determine whether or not a test passes.
They run all test cases and provide feedback on which test cases passed and which failed.
They generate tests for you.
They allow programmer to unit test each method.
ANS
They allowed automated checks against an oracle(e.g. Do the outputs of the program match expectations?) to determine whether or not a test passes.
They run all test cases and provide feedback on which test cases passed and which failed.
They allow programmer to unit test each method.

2) To test a main method you need to:
Redirect input to be entered by the test case.
Redirect output to be generated by the test case.
Invoke the main method with the right parameters.
ANS
Redirect input to be entered by the test case.
Redirect output to be generated by the test case.
Invoke the main method with the right parameters.

3) In a test framework,  we write test cases:
Inside the executed method and we annotate that this part is for testing.
Inside the class to be tested.
In a separate class---usually, with one or more test classes per class under test.
All of the above.
ANS - In a separate class---usually, with one or more test classes per class under test.

Automation: Writing JUnit Tests

1) Given a program that calculates the surface area of sphere A using the equation below where r is the radius of the sphere and is provided by the user, which of the following are valid test cases?
$$A = 4 \pi r^2$$
input r=1/2, expected output=3.14
input r=-1/2, expected output=invalid input
input r=0, expected output=invalid input
input r=30, expected output=11309.73
ANS
input r=1/2, expected output=3.14
input r=-1/2, expected output=invalid input
input r=0, expected output=invalid input
input r=30, expected output=11309.73

2) Redirection of system input and output for the Coffee Maker example is done in order to test:
The main method.
Any method for a domain class(Coffeemaker, Recipe, etc.)
All the domain classes in the system.
ANS -  The main method.

3) Testing is all about corner cases.
True
False.
ANS - False

4) The strategy of writing test cases before implementation is:
A bad idea. Implementation needs to be there to know which test cases you should include.
A good idea. Test cases should be built based on the expected output and should not be influenced by the implementation.
ANS -  A good idea. Test cases should be built based on the expected output and should not be influenced by the implementation.

5) When you have a new test case:
You need to run it alone to check that it has passed. There is no need to run other, older test cases since they previously passed and they may take a while to return.
All test cases needs to be run including the new one.
ANS -  All test cases needs to be run including the new one.
Question 1
Question 
Question 1Design and prototype walk-throughs with users are examples of:

Comments

Post a Comment

Popular Posts