Which of the following statements is true regarding API and GUI testing?
Answer : A
API testing tends to focus on individual inputs more than combinations of inputs. This is because APIs, as the intermediary layers of software, often handle specific types of data input and output rather than user interaction sequences. GUI testing, on the other hand, involves testing the interface with which the user interacts, which frequently includes testing various combinations of user inputs and sequences to simulate actual user scenarios. Thus, GUI testing typically requires checking the integration and behavior of elements in combination to ensure they work together as expected in a user environment .
Consider the following section of pseudo code and associated test Input data:
If withdrawal-amount <= amount-on-deposit then Set authorize-transaction = true
Else
If withdrawal-amount <= S100 AND preferred-customer = true then Set authorize-transaction = true
Else
Set authorize-transaction = false
Endif
Endif
Input data set #1
withdrawal-amount = 160
amount-on-deposit = 100
preferred-customer = true
Input data set #2
withdrawal-amount = 500
amount-on-deposit = 500
preferred-customer = false
Input data set #3
withdrawal-amount = 50
amount-on-deposit = 500
preferred-customer = false
What would be the decision coverage achieved if each of these test input data sets were run once?
Answer : A
To achieve decision coverage, each branch of the decision structure in the code must be executed at least once. The code snippet has three branches:
withdrawal-amount <= amount-on-deposit
withdrawal-amount <= $100 AND preferred-customer = true
Default case where the transaction is not authorized
Data set #1 triggers the second branch because the withdrawal amount is not less than the amount on deposit, but it is less than $100, and the user is a preferred customer.
Data set #2 triggers the first branch where the withdrawal amount is equal to the amount on deposit.
Data set #3 tests the condition where the withdrawal amount is less than the deposit amount, but the user is not a preferred customer, triggering the default case.
All decision branches are covered by these test cases, achieving 100% decision coverage.
What is the earliest stage in the application's SDLC at which performance efficiency testing can be performed?
Answer : A
The earliest stage in the application's SDLC at which performance efficiency testing can be performed is during requirements analysis. At this stage, performance requirements and goals are established, providing a baseline for what needs to be tested and verified throughout the later stages of development.
Which of the following best describes the reason why poorly written code is usually more difficult to maintain than well written code?
Answer : C
Poorly written code often lacks clarity, consistency, and may not follow best practices, making it harder to understand and maintain. When code is not well-structured or logically organized, identifying the source of bugs or understanding how changes might affect system behavior becomes more difficult. This issue is compounded when developers other than the original author need to work on the code, as they may struggle to interpret the intended functionality and interdependencies without clear, readable code.
A new system is being built to handle the message handling of financial transactions - this system is critical to the organization's finances. The code includes loops and decisions with several multiple conditions. The nature of the system means that tests are quite time-consuming to execute. Which of the following would be the BEST white box testing option for the new software?
Answer : B
In a critical system that handles financial transactions with complex logic, ensuring thorough testing coverage is crucial. Here's an analysis of the options:
A . Multiple Condition coverage: This provides the highest level of coverage by testing all possible combinations of conditions. However, it can be very time-consuming and is often impractical for complex systems due to the sheer number of test cases required.
B . MC/DC coverage: Modified Condition/Decision Coverage is a compromise between multiple condition coverage and decision coverage. It ensures that each condition within a decision has been shown to independently affect the outcome of that decision. This level of coverage is often required in safety-critical systems because it provides thorough testing without the excessive test case count of multiple condition coverage.
C . Decision coverage: This ensures that every decision (if statement) has been executed in both true and false directions. While useful, it may not be sufficient for complex systems where the interactions between conditions are critical.
D . Statement coverage: This ensures that every executable statement in the code has been executed. It is the most basic level of coverage and is generally not sufficient for complex systems, especially those that are critical to an organization's finances.
Given the critical nature of the system and the need for a balance between thoroughness and practicality, the best option is B. MC/DC coverage. This ensures a high level of coverage that is more practical than multiple condition coverage while providing more assurance than decision or statement coverage.
Given the following decision: IF X < 5 OR Y > 10 THEN
Which of the following sets of test inputs will achieve full MC/DC coverage?
Answer : B
To achieve full Modified Condition/Decision Coverage (MC/DC), each condition within a decision must be shown to independently affect the outcome of the decision. For the decision IF X < 5 OR Y > 10 THEN, the conditions are:
Condition 1: X < 5
Condition 2: Y > 10
We need to test these conditions in such a way that each condition independently influences the decision outcome. Let's analyze the options:
Option A:
X=4 and Y=7 (X < 5 is true, Y > 10 is false; overall decision true)
X=6 and Y=12 (X < 5 is false, Y > 10 is true; overall decision true)
X=5 and Y=10 (X < 5 is false, Y > 10 is false; overall decision false)
This set achieves full MC/DC coverage because each condition is shown to independently affect the outcome.
Option B:
X=4 and Y=11 (X < 5 is true, Y > 10 is true; overall decision true)
X=7 and Y=10 (X < 5 is false, Y > 10 is false; overall decision false)
This set achieves full MC/DC coverage because it demonstrates both conditions independently affecting the outcome.
Option C:
X=5 and Y=8 (X < 5 is false, Y > 10 is false; overall decision false)
X=2 and Y=12 (X < 5 is true, Y > 10 is true; overall decision true)
X=4 and Y=4 (X < 5 is true, Y > 10 is false; overall decision true)
This set does not fully achieve MC/DC coverage as it does not demonstrate the impact of Y > 10 being false while X < 5 is false.
Option D:
X=3 and Y=10 (X < 5 is true, Y > 10 is false; overall decision true)
X=5 and Y=15 (X < 5 is false, Y > 10 is true; overall decision true)
X=0 and Y=15 (X < 5 is true, Y > 10 is true; overall decision true)
This set does not achieve MC/DC coverage because it does not show the decision outcome when both conditions are false.
Therefore, the correct answer is B. X=4 and Y=11, X=7 and Y=10.
Why could test cases need to be refactored in an Agile project?
SELECT ONE OPTION
Answer : C
In Agile projects, test cases may need to be refactored to make them simpler and less costly to modify. This is crucial because Agile methodologies prioritize adaptability and frequent changes to the codebase and documentation. Refactoring test cases in this context ensures that they remain aligned with the continuously evolving project requirements, are easier for teams to manage, and can be quickly adjusted to accommodate new or changed functionality without significant rework costs .