CS FundamentalsVery hardGATE CS · product placement
How many of these statements about cyclomatic complexity are correct? 1. Adding a straight-line statement to a function never changes V(G). 2. Converting nested if-else chains into a lookup table can lower V(G) without changing behaviour. 3. V(G) gives the minimum number of tests for 100% statement coverage. 4. Two functions with the same V(G) can have very different numbers of feasible paths.
- A. 4
- B. 3
- C. 2
- D. 1
Correct answer: B. 3
1, 2 and 4 are correct. V(G) is an upper bound on the tests needed for branch coverage (and the size of a basis set), not the minimum for statement coverage, which is often much smaller.
Practise more Software Engineering, Git and Cloud Basics questionsSoftware Engineering, Git and Cloud Basics: notes and key points
More Software Engineering, Git and Cloud Basics questions
- A team applies the Open/Closed principle so aggressively that every class has an interface, a factory and plug-in points 'in case'…
- Two functions contain the same three lines of code, but one computes a GST rate and the other a delivery charge that happens to use the…
- A class Report depends on ReportFormatter, and ReportFormatter depends on Report to read its data, creating a cyclic dependency between…
- A unit test calls a service that reads the current time with datetime.now() and fails every day after 6 pm. What is the cleanest fix?
- How many of these situations can produce a merge conflict when merging branch B into A from their common ancestor O? 1. A and B changed…
- Feature X takes the 'happy path' through 5 screens. An alternate flow can occur at screen 2 (2 variants) and an exception flow at screen 4…