Question 1
You are a Technical Test Analyst reviewing a C++ module for an industrial control system that manages a chemical mixing process. The system is rated at IEC 61508 SIL 2. You encounter the following code snippet:
void process_batch(float temperature, int pressure, bool valve_open) {
if ((temperature > 150.0f && pressure < 500) || valve_open) {
// Initiate emergency shutdown
}
// ... normal processing
}
Given the SIL 2 rating, what is the MOST appropriate white-box coverage target for this specific 'if' statement, and what is the minimum number of test cases required to achieve it?
Answer and explanation
Correct answer: B
According to the IEC 61508 standard, SIL 2 highly recommends Statement Coverage and recommends Decision Coverage. A professional Technical Test Analyst should aim for the recommended level. Decision Coverage requires testing both the TRUE and FALSE outcomes of the entire decision predicate. This can be achieved with a minimum of two test cases: one where the entire condition evaluates to TRUE (e.g., temperature=160, pressure=400, valve_open=false) and one where it evaluates to FALSE (e.g., temperature=100, pressure=400, valve_open=false).