CS FundamentalsHardProduct-company placement · GATE CS
A function has three if-else statements in sequence, followed by a loop that runs either 0 or 1 time (decided by the input) and whose body is one if-else. How many distinct entry-to-exit paths does it have, and what is its cyclomatic complexity?
- A. 24 paths; V(G) = 6
- B. 32 paths; V(G) = 6
- C. 16 paths; V(G) = 5
- D. 24 paths; V(G) = 5
Correct answer: A. 24 paths; V(G) = 6
The three if-elses give 2³ = 8 combinations; the loop contributes 1 path for zero iterations plus 2 for one iteration, so 8 × 3 = 24 paths. Decisions are 3 ifs + loop + inner if = 5, so V(G) = 6. 32 treats the loop as a plain two-way branch with an independent if.
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
- For a function of two independent bounded inputs, match each boundary-value technique with the number of test cases it needs. P. Normal…
- A decision table has three yes/no conditions and four rules: R1: C1 = N (C2, C3 don't care) → A; R2: C1 = Y, C2 = N (C3 don't care) → B…
- A state machine has transitions a: S1→S2, b: S2→S3, c: S3→S1 and d: S2→S1. How many test items does 0-switch (every transition) coverage…
- How many of these statements about data-flow coverage criteria are correct? 1. All-uses subsumes all-defs (when every definition reaches…
- The condition x > 5 and x >= 0 (x an integer) is mutated four ways. Which mutant is equivalent, so that no test can kill it?
- Under basic COCOMO organic mode (Effort = 2.4 × KLOC^1.05 person-months), how does productivity in LOC per person-month for a 100 KLOC…