Tag: testing

Questions Related to testing

A program validates a numeric field as follows: values less than 10 are rejected, values between 10 and 21 are accepted, values greater than or equal to 22 are rejected. Which of the following covers the MOST boundary values?

  1. 9,10,11,22

  2. 9,10,21,22

  3. 10,11,21,22

  4. 10,11,20,21


Correct Option: B

AI Explanation

To answer this question, we need to consider the given validation criteria and determine which option covers the most boundary values.

The validation criteria are as follows:

  • Values less than 10 are rejected.
  • Values between 10 and 21 (inclusive) are accepted.
  • Values greater than or equal to 22 are rejected.

Let's evaluate each option to see which one covers the most boundary values:

Option A) 9, 10, 11, 22

  • 9 is less than 10 and should be rejected.
  • 10 is between 10 and 21 and should be accepted.
  • 11 is between 10 and 21 and should be accepted.
  • 22 is greater than or equal to 22 and should be rejected.

This option covers 2 boundary values: 10 and 22.

Option B) 9, 10, 21, 22

  • 9 is less than 10 and should be rejected.
  • 10 is between 10 and 21 and should be accepted.
  • 21 is between 10 and 21 and should be accepted.
  • 22 is greater than or equal to 22 and should be rejected.

This option covers 2 boundary values: 10 and 21.

Option C) 10, 11, 21, 22

  • 10 is between 10 and 21 and should be accepted.
  • 11 is between 10 and 21 and should be accepted.
  • 21 is between 10 and 21 and should be accepted.
  • 22 is greater than or equal to 22 and should be rejected.

This option covers 3 boundary values: 10, 11, and 21.

Option D) 10, 11, 20, 21

  • 10 is between 10 and 21 and should be accepted.
  • 11 is between 10 and 21 and should be accepted.
  • 20 is between 10 and 21 and should be accepted.
  • 21 is between 10 and 21 and should be accepted.

This option covers 4 boundary values: 10, 11, 20, and 21.

Therefore, the option that covers the most boundary values is Option D) 10, 11, 20, 21.

  1. I, II & III

  2. II, III & IV

  3. I, II & IV

  4. I, III & IV


Correct Option: C
Explanation:

The correct answer is C. I, II & IV.

Explanation: I. It strives to ensure that quality is built into software: This statement is true as software verification and validation programs aim to ensure that quality is built into the software development process. II. It provides management with insights into the state of a software project: This statement is true as a software verification and validation program provides management with insights into the progress, quality, and state of a software project. III. It ensures that alpha, beta, and system tests are performed: This statement is not necessarily true for all software verification and validation programs. While these types of tests are commonly performed, it is not a requirement for all programs. IV. It is executed in parallel with software development activities: This statement is true as a software verification and validation program typically runs concurrently with software development activities to ensure that quality is maintained throughout the development process.

Therefore, the correct answer is C. I, II & IV.

Given the following code, which is true about the minimum number of test cases required for full statement and branch coverage: Read P Read Q IF P+Q > 100 THEN Print “Large” ENDIF If P > 50 THEN Print “P Large” ENDIF

  1. 1 test for statement coverage, 3 for branch coverage

  2. 1 test for statement coverage, 2 for branch coverage

  3. 1 test for statement coverage, 1 for branch coverage

  4. 2 tests for statement coverage, 3 for branch coverage

  5. 2 tests for statement coverage, 2 for branch coverage


Correct Option: B
Explanation:

To solve this question, the user needs to know the concepts of statement coverage and branch coverage in software testing.

Statement coverage means that each statement in the code is executed at least once during testing. Branch coverage means that each possible branch or decision point in the code is executed at least once during testing.

In the given code, there are two decision points:

  1. IF P+Q > 100
  2. If P > 50

Now, let's go through each option and explain why it is right or wrong:

A. 1 test for statement coverage, 3 for branch coverage: This option is incorrect because it requires 3 tests for branch coverage. However, there are only two decision points in the code, so it is not possible to have three branches. Therefore, option A is incorrect.

B. 1 test for statement coverage, 2 for branch coverage: This option is correct. To achieve statement coverage, only one test case is required where P = 50 and Q = 51. This will execute all statements in the code. To achieve branch coverage, two test cases are required: one where P = 50 and Q = 51 (to cover the first decision point) and another where P = 51 and Q = 50 (to cover the second decision point). Therefore, option B is the correct answer.

C. 1 test for statement coverage, 1 for branch coverage: This option is incorrect because there are two decision points in the code that require two test cases for branch coverage. Therefore, option C is incorrect.

D. 2 tests for statement coverage, 3 for branch coverage: This option is incorrect because there are only two decision points in the code that require two test cases for branch coverage. Therefore, option D is incorrect.

E. 2 tests for statement coverage, 2 for branch coverage: This option is incorrect because only one test case is required for statement coverage. Therefore, option E is incorrect.

The Answer is: B. 1 test for statement coverage, 2 for branch coverage.

  1. Requires knowledge on the bug fixes and how it affect the system

  2. Includes the area of frequent defects

  3. Includes the area which has undergone many/recent code changes

  4. All of the above


Correct Option: D
  1. That you have tested every statement in the program.

  2. That you have tested every statement and every branch in the program.

  3. That you have tested every IF statement in the program.

  4. That you have tested every combination of values of IF statements in the program


Correct Option: B
  1. An inspection is lead by the author, whilst a walkthrough is lead by a trained moderator

  2. An inspection has a trained leader, whilst a walkthrough has no leader

  3. Authors are not present during inspections, whilst they are during walkthroughs

  4. A walkthrough is lead by the author, whilst an inspection is lead by a trained moderator


Correct Option: D