ISTQB-CTFL · Question #73
The following requirement is given "Set X to be the sum of Y and Z". All the following four implementations have bugs. Which one of the following bugs can be caught by Static Analysis?
The correct answer is A. int x = 1. Static analysis is a technique that analyzes the source code or other software artifacts without executing them. Static analysis can detect defects such as syntax errors, coding standards violations, potential security vulnerabilities, or logical flaws. Static analysis can…
Question
The following requirement is given "Set X to be the sum of Y and Z". All the following four implementations have bugs. Which one of the following bugs can be caught by Static Analysis?
Options
- Aint x = 1.
- Bint x = 1.
- Cint x = 1.
- Dint y = 2
How the community answered
(47 responses)- A77% (36)
- B6% (3)
- C4% (2)
- D13% (6)
Explanation
Static analysis is a technique that analyzes the source code or other software artifacts without executing them. Static analysis can detect defects such as syntax errors, coding standards violations, potential security vulnerabilities, or logical flaws. Static analysis can catch the bug in the first implementation, as it contains two syntax errors: the variable y is declared twice, and the assignment statement X = y=z is invalid. Static analysis cannot catch the bugs in the other three implementations, as they are logical errors that do not violate any syntax rules, but produce incorrect results.
Topics
Community Discussion
No community discussion yet for this question.