1.
Given the following code, which is true:
IF A > B THEN
C = A – B
ELSE
C = A + B
ENDIF
Read D
IF C = D Then
Print “Error”
ENDIF
Correct Answer
B. 2 tests for statement coverage, 2 for branch coverage
Explanation
The given code contains two branches: one for the "IF" statement and one for the "ELSE" statement. To achieve branch coverage, we need to test both branches. Since there are only two branches, we need two tests for branch coverage. Additionally, the code contains four statements: the "IF" statement, the "ELSE" statement, the "Read D" statement, and the "Print 'Error'" statement. To achieve statement coverage, we need to test all four statements. Therefore, we need two tests for statement coverage and two tests for branch coverage.
2.
You have designed test cases to provide 100% statement and 100% decision
coverage for the following fragment of code.
if width > length
then
biggest_dimension = width
else
biggest_dimension = length
end_if
The following has been added to the bottom of the code fragment above.
print "Biggest dimension is " & biggest_dimension
print "Width: " & width
print "Length: " & length
How many more test cases are required?
Correct Answer
C. None, existing test cases can be used.
Explanation
The existing test cases already provide 100% statement and 100% decision coverage for the given code fragment. Therefore, no additional test cases are required.
3.
What is the MAIN benefit of designing tests early in the life cycle?
Correct Answer
B. It helps prevent defects from being introduced into the code.
Explanation
Designing tests early in the life cycle helps prevent defects from being introduced into the code. By identifying and addressing potential issues at an early stage, the development team can ensure that the code is more robust and reliable. This can save time and resources that would otherwise be spent on fixing and debugging later on. Additionally, early testing allows for better understanding of the requirements and specifications, leading to more effective test design and coverage.
4.
What is the KEY difference between preventative and reactive approaches to
testing?
Correct Answer
B. Preventative tests are designed early; reactive tests are designed after the software has
been produced.
Explanation
The key difference between preventative and reactive approaches to testing is the timing of when the tests are designed. Preventative tests are designed early, before the software has been produced, with the aim of preventing defects and issues from occurring. On the other hand, reactive tests are designed after the software has been produced, in response to identified defects or issues. This difference in timing allows preventative testing to be proactive and proactive, while reactive testing is more responsive and reactive to problems that have already occurred.
5.
Given the following fragment of code, how many tests are required for 100%
decision coverage?
if width > length
then
biggest_dimension = width
if height > width
then
biggest_dimension = height
end_if
else
biggest_dimension = length
if height > length
then
biggest_dimension = height
end_if
end_if
Correct Answer
B. 4
Explanation
The given code fragment contains two decision points: the first decision point is the condition "width > length" and the second decision point is the condition "height > width". To achieve 100% decision coverage, we need to test both possible outcomes of each decision point. Therefore, we need to test the following combinations:
1. width > length and height > width
2. width > length and height
6.
A thermometer measures temperature in whole degrees only. If the temperature
falls below 18 degrees, the heating is switched off. It is switched on again when the
temperature reaches 21 degrees. What are the best values in degrees to cover all
equivalence partitions?
Correct Answer
A. 15, 19 and 25.
Explanation
The best values in degrees to cover all equivalence partitions are 15, 19, and 25. This is because the thermometer measures temperature in whole degrees only, and the heating is switched off when the temperature falls below 18 degrees and switched on again when it reaches 21 degrees. Therefore, the values of 15 and 25 cover the range outside of the heating limits, and the value of 19 covers the range between the heating limits.
7.
With which of the following categories is a test comparator tool USUALLY
associated?
Correct Answer
C. Tool support for test execution and logging.
Explanation
A test comparator tool is usually associated with tool support for test execution and logging. This type of tool is used to compare the actual results of a test with the expected results and log any discrepancies. It helps in identifying and tracking issues during test execution and provides detailed logs for analysis and debugging.
8.
Which of the following is a purpose of the review planning phase?
Correct Answer
D. Allocate the individual roles.
Explanation
The purpose of the review planning phase is to allocate individual roles. This means that during this phase, the team members are assigned specific responsibilities and tasks for the review process. This helps to ensure that each person knows their role and what is expected of them, leading to a more organized and efficient review.
9.
Which is the best definition of complete testing:
Correct Answer
A. You have discovered every bug in the program.
Explanation
Complete testing refers to the process of thoroughly examining a program to identify and address all possible bugs or defects. It involves the systematic execution of test cases and scenarios to ensure that all aspects of the program have been evaluated. By discovering every bug in the program, it implies that all potential issues have been identified and resolved, making it the most comprehensive definition of complete testing.
10.
Complete statement and branch coverage means:
Correct Answer
B. B. That you have tested every statement and every branch in the program.
Explanation
Complete statement and branch coverage means that you have tested every statement and every branch in the program. This includes testing each individual statement to ensure they execute correctly, as well as testing every possible branch or decision point in the program to verify that all possible paths are covered. This approach helps to ensure that the program is thoroughly tested and that all potential scenarios and outcomes are considered.
11.
Reviews, static analysis and dynamic testing have the same objective
Correct Answer
A. Identifying defects.
Explanation
Reviews, static analysis, and dynamic testing all aim to identify defects in a system or software. Reviews involve examining the code or documentation to find any potential issues. Static analysis involves analyzing the code without executing it to identify defects. Dynamic testing involves executing the code to uncover defects during runtime. Therefore, all three approaches have the common objective of identifying defects.
12.
Contract and regulation testing is a part of
Correct Answer
B. Acceptance testing
Explanation
Contract and regulation testing is a part of acceptance testing. Acceptance testing is performed to determine whether a system meets the requirements and expectations of the end-users or stakeholders. Contract and regulation testing specifically focuses on ensuring that the system complies with any contractual agreements, legal regulations, or industry standards that may be applicable. This type of testing helps to verify that the system is in compliance with all the necessary rules and regulations, ensuring its suitability for acceptance by the end-users or stakeholders.