Introduction to software testing: Week 2 Quiz Answer

Dependability Quiz

1) What is the time ordering (in terms of when a mistake is made or occurs in the running system) of the following: (1) an error, (2) a fault, and (3) a failure?

a) 1 2 3 b) 1 3 2 c) 2 1 3 d) 2 3 1 e) 3 1 2 f) 3 2 1

ANS - 2 3 1

2) Testing helps with which kind of dependability criteria?

a) fault avoidance
b) fault tolerance
c) error removal
d) fault forecasting

ANS - error removal

3) Availability is the same as the reliability

a) True b) False

ANS - False

4) A correct system (with respect to its requirements) will be safe.

a) True b) False

ANS - False

5) A correct system will be reliable.

a) True b) False

ANS - True

6) Robust systems are reliable.

a) True b) False

ANS - False

7) Safe systems are robust.

a) True b) False

ANS - False

Testing Principles: Where Quiz

1) Why do floating point numbers sometimes lead to erroneous code?

a) Arithmetic on floating point numbers is often approximate, so it can introduce error
b) Floating point numbers have values that are not actually numbers, such as infinity and NaN (Not a number) that can cause computations to behave strangely.
c) In Java floating point numbers cannot represent numbers as large as ints and longs.
d) As floating point computations are approximate, equality comparisons fail after computations that would succeed when using real numbers.

ANS
a) Arithmetic on floating point numbers is often approximate, so it can introduce error
b) Floating point numbers have values that are not actually numbers, such as infinity and NaN (Not a number) that can cause computations to behave strangely.
d) As floating point computations are approximate, equality comparisons fail after computations that would succeed when using real numbers.

2) Why do relational boundaries sometimes lead to erroneous code?

a) Programmers often make 'off-by-one' errors
b) Determining strict limits on ranges is difficult in requirements engineering
c) Relational boundaries define points of discontinuity for programs.
d) The Java compiler sometimes optimizes these expressions incorrectly.

ANS -
a) Programmers often make 'off-by-one' errors
b) Determining strict limits on ranges is difficult in requirements engineering
c) Relational boundaries define points of discontinuity for programs.

3) Why do casts sometimes lead to erroneous code?

a) When converting an integer to a smaller bit length(e.g. long to int), the value may be truncated.
b) When converting to a larger bit length(e.g. int to long) the value may change from positive to negative
c) When converting from signed to unsigned types(e.g. int to byte), negative numbers can't be represented.
d) When converting from double to int, the value is truncated to a whole number.
e) When converting from an int to double, the integer value may not be exactly representable. 

ANS
a) When converting an integer to a smaller bit length(e.g. long to int), the value may be truncated.
b) When converting to a larger bit length(e.g. int to long) the value may change from positive to negative
c) When converting from signed to unsigned types(e.g. int to byte), negative numbers can't be represented.
d) When converting from double to int, the value is truncated to a whole number.


Testing Principles: How

1) Why are we often able to test more rigorously at the unit level rather than the system level? 

a) The tests tend to return faster, so we can run more of them.
b) We can usually see more of the internal state at the unit level so we can build stronger oracles.
c) There are always fewer dependencies for unit tests than there are for system tests.

ANS
a) The tests tend to return faster, so we can run more of them.
b) We can usually see more of the internal state at the unit level so we can build stronger oracles.

2) When we say that we want redundant verification, what do we mean?

a) We want several different verification techniques checking the same program or subsystem.
b) We want lots of similar or same tests.
c) We want to re-run proofs of multiple subsystems to make sure we get the same answer.

ANS
a) We want several different verification techniques checking the same program or subsystem.

3) Which of the following are good ways to work with developers to reduce systematic errors?

a) E-mail developers lists of bugs that have been found over the last few months.
b) Create tools to test/verify specific kinds of common errors.
c) Create libraries or utility functions to encapsulate operation that developers tend to get wrong.
d) Use languages/ IDEs that eliminate certain classes of errors by compile-time checks.
e) Create checklists for developers based on the most common errors seen in test.

ANS -
b) Create tools to test/verify specific kinds of common errors.
c) Create libraries or utility functions to encapsulate operation that developers tend to get wrong.
d) Use languages/ IDEs that eliminate certain classes of errors by compile-time checks.
e) Create checklists for developers based on the most common errors seen in test.

4) We state that programs, as well as tests, can be flakey.  What does it mean for a program to be flakey?

a) Given the same inputs, sometimes the program fails a test and other times it does not.
b) Sometimes the program ends up in different internal states for the same inputs.
c) Sometimes the program creates different output for the same input.

ANS -
a) Given the same inputs, sometimes the program fails a test and other times it does not.

5) Why is observability an important issue in testing?

a) If a program error is transient (it happens and is masked out by other code), you might not be able to "see" it and test may pass.
b) Developers often want to hide important information related to their code because they think it leads to job security.
c) Often programs are stateful- that is a test may trigger an error, but it only visible as an output if a long sequence of steps are executed, whereas it might be immediately visible by examining internal state.
d) because developers like to use the "observer" pattern and this can often lead to errors because it decouples the domain object and GUI presentation

ANS -
a) If a program error is transient (it happens and is masked out by other code), you might not be able to "see" it and test may pass.
c) Often programs are stateful- that is a test may trigger an error, but it only visible as an output if a long sequence of steps are executed, whereas it might be immediately visible by examining internal state.


The V-Model Quiz

1) The V-Model is:

a) A testing framework for running tests at each step during software development.
b) A software development model that pairs different stages of software development with the appropriate testing procedure. These tests are later used when checking the verification of each phase of the software.
c) All of the above.

ANS - c) All of the above

2) The system design is tested using:

a) Unit testing.
b) Module testing.
c) Validation testing.
d) Verification testing.

ANS - b) Module testing.

3) The specification of the system is tested using:

a) Unit testing.
b) Validation testing.
c) Verification testing.
d) System integration system.

ANS - Verification system

Validation and Verification in the "V-Model" Quiz

1) The difference between validation and verification is:

a) Validation confirms that we are building the right product while verification confirms that we are building the product right.
b) Validation in planned during the user requirement stage in the V-model while verification is planned during the user specification stage.
c) None of the above.
d) A and B

ANS - d) A and B

2) With respect to the V-model, a system that has passed verification testing means:

a) The system is done and no further testing is needed.
b) The system has passed all tests from unit testing through verification testing and is now ready for validation testing.
c) The system needs to be tested all the way from unit testing up through verification testing, before being claimed correct.

ANS - b) The system has passed all tests from unit testing through verification testing and is now ready for validation testing.

3) With respect to the V-model, a valid system implies a verified system:

a) True b) False

ANS - a) True

Structural Testing

1) Structural testing is:

a) Black-box testing b) White box testing c) Blue box testing

ANS - White box testing

2) What is not true about structural testing?

a) The goal of testing is to achieve 100% structural coverage to ensure the absence of bugs.
b) Structural testing is white-box testing.
c) Structural coverage criteria use the structure of the code to measure the adequacy of tests.
d) In most cases, it is infeasible to reach 100% structural coverage.

ANS -  
a) The goal of testing is to achieve 100% structural coverage to ensure the absence of bugs.

Mutation Testing

1) Which of the following is not true about mutation testing?

a) With mutation testing, you can know how much of the code structure you covered.
b) The mutation adequacy score tells you the quality of tests; the higher the score, the better the quality of the test.
c) A mutant is killed when there exists one or more tests that can differentiate between the output of the mutant and the output of the original team.

ANS
a) With mutation testing, you can know how much of the code structure you covered.

2) Which of the following are not true about mutation testing?

a) You only create one mutant for mutation testing.
b) The mutation operator introduces a syntactic change to program so that the mutant cannot be compiled.
c) A mutant and the original program are syntactical different.

ANS - a) You only create one mutant for mutation testing.
b) The mutation operator introduces a syntactic change to program so that the mutant cannot be compiled.

3) Jenny wrote a program and created 10 test cases. She also created 50 mutants from the original program to measure the adequacy of her test inputs using mutation testing. After running all of the test cases against each of the mutants, Jenny found that all of the test cases had passed on all of the mutants. In this situation, what is the most appropriate step she should take next?

a) She can stop testing because all the tests have passed.
b) She should create more mutant.
c) She should write more tests.

On Basic Testing Terminology, Dependability, and Testing Principles

1) Why is testing considered an 'optimistic' verification technology?

a) Any test that fail may not actually matter from the user's perspective
b) Some tests may fail, but the program may be correct.
c) The tests may all pass but the program may still be incorrect.
d) You can use testing on any kind of software, whereas you can only run static analysis or proofs on small systems.

ANS - c) The tests may all pass but the program may still be incorrect.

2) If a test fails, it could mean:

a) There is no problem
b) The test itself is incorrect
c) Program is incorrect

ANS - b) The test itself is incorrect
c) Program is incorrect

3) Suppose we have two systems A and B, and A is more rigorously tested than B.  Does System A better meet its quality goals than System B?

a) No b) Yes

ANS - a) No

4) Unit test is used to test: (choose best answer)

a) User initial requirement
b) Design of the software
c) All of the above
d) Implementation of the software

ANS - d) Implementation of the software

5) 'Service' is the system behavior as defined by the software requirements.

a) True b) False

ANS - b) False

6) A latent error becomes an effective error when

a) the error causes the program to return something unexpected to the user.
b) the program executes the lines of code containing the latent error.
c) the program starts executing.
d) the program reaches a state where the error manifests.
e) the user types it into the code

ANS - d) the program reaches a state where the error manifests.

7) Does a program terminating with an error always indicate a failure?

a) No b) Yes

ANS- a) No

8) Adaptive cruise control software that continues to run in the presence of multiple hardware and service failures but regularly misjudges the distance between cars by a substantial amount is an example of a ______ system.

a) certainly incorrect
b) certainly reliable
c) certainly safe
d) certainly robust
e) certainly correct

ANS - a) certainly incorrect   d) certainly robust

9) Mutation testing is a _______ metric

a) White-box
b) gray-box
c) Black-box

ANS- a) White-box

10) Which of the following are true about testing? Check all that apply

a) It checks the whole system, including software that you didn't write.
b) It can sometimes find errors that are not actively looked for, when (for example) a program crashes during execution of a test case.
c) It can conclusively determine whether the software is correct.
d) It documents system behavior.
e) It is difficult to do rigorously.

ANS - a) It checks the whole system, including software that you didn't write.
b) It can sometimes find errors that are not actively looked for, when (for example) a program crashes during execution of a test case.
d) It documents system behavior.
e) It is difficult to do rigorously.

11) Tasks that can be part of the Tear Down phase are (choose two answers):

a) Initialize test case values.
b) Remove data you added after testing is done.
c) Open connection for testing.
d) Close connection after testing is done.

ANS - b) Remove data you added after testing is done.
d) Close connection after testing is done.

12) In the JUnit test framework, we write test cases (choose the best answer):

a) inside the executed method and we annotate that this part is for testing.
b) inside the class to be tested we annotate that this part is for testing.
c) in a separate class, and for each method in the program we associated test cases(s) to the correctness of the method.
d) All of the above.

ANS - c) in a separate class, and for each method in the program we associated test cases(s) to the correctness of the method.

13) Concurrent systems are quite difficult to test because (choose the best answer):

a) the different potential interleavings of threads leads to 'race conditions' where the program may behave differently between executions
b) to ensure that only one thread uses a variable at a time, Java 'synchronized' code can lead to deadlocks where each thread is blocked waiting for another thread.
c) All of the above
d) the different potential interleavings of threads means that there are many more possible system states

ANS -c) All of the above
Question 
Question 3Availability is the same as reliability.

Comments

  1. 1) What is the time ordering (in terms of when a mistake is made or occurs in the running system) of the following: (1) an error, (2) a fault, and (3) a failure?

    Right answer is: a fault --> an error --> a failure.

    ReplyDelete
  2. Lesson 2 : Practice Question - Question 1
    The V-Model is:
    A software development model that pairs different stages of software development with the appropriate testing procedure. These tests are later used when checking the verification of each phase of the software.

    ReplyDelete
  3. 3) Jenny wrote a program and created 10 test cases. She also created 50 mutants from the original program to measure the adequacy of her test inputs using mutation testing. After running all of the test cases against each of the mutants, Jenny found that all of the test cases had passed on all of the mutants. In this situation, what is the most appropriate step she should take next?

    c) She should write more tests.

    ReplyDelete

Post a Comment

Popular Posts