GATE CSE Cyclomatic Complexity PYQs
In GATE CS, Control Flow and Cyclomatic Complexity questions evaluate the student's ability to compute McCabe's Cyclomatic Complexity across multiple representa… Read the guide
- Questions
- 1
- Asked
- 2015
- Total marks
- 2
- Marks / paper
- 0.3
1 GATE CSE Cyclomatic Complexity PYQs with solutions, from Software Engineering. Browse all GATE CSE PYQs.
Questions
Every official paper that asked this topic, newest first.
What GATE tests in Cyclomatic Complexity
Concepts, patterns, formulas and traps distilled from past papers.
In GATE CS, Control Flow and Cyclomatic Complexity questions evaluate the student's ability to compute McCabe's Cyclomatic Complexity across multiple representations (C code snippets, explicit Control Flow Graphs, and composite/sequential modules). The core focus is on applying graph-theoretic and predicate-based definitions of cyclomatic complexity to measure code complexity.
Core concepts
- McCabe's Cyclomatic Complexity metric
- Control Flow Graph (CFG) construction (Nodes, Edges, Decision/Predicate nodes)
- Planar regions in Control Flow Graphs
- Sequential composition of Control Flow Diagrams (SESE structures)
- Mapping conditional statements (if-else, while loops, compound conditions) to CFG nodes and edges
Recurring question patterns
Multi-Representation Cyclomatic Complexity Calculation
RareMCQ2 marks2015Given a mix of code snippets, a control flow graph diagram, and a composite module connected sequentially, determine the respective cyclomatic complexities.
Formulas GATE uses
McCabe's Cyclomatic Complexity (Graph formula)
Used when the number of edges , nodes , and connected components (usually for a single program) of a Control Flow Graph are known.
McCabe's Cyclomatic Complexity (Predicate formula)
Used directly on source code where is the count of simple predicate/decision nodes (e.g., if, while, for).
McCabe's Cyclomatic Complexity (Planar Region formula)
Used when counting bounded enclosed regions plus one unbounded (external) region in a planar control flow graph.
Sequential Composition of Single-Entry Single-Exit (SESE) Modules
Used when two independent modules and are concatenated sequentially with a single transition edge from exit of to entry of .
Examiner traps in Cyclomatic Complexity
- Adding cyclomatic complexities directly during sequential composition (V(X) + V(Y) instead of V(X) + V(Y) - 1).
- Forgetting the external/unbounded region when using the region-counting method V(G) = R.
- Treating compound logical conditions (e.g., `(A && B)`) incorrectly without decomposing them into atomic predicate nodes when analyzing detailed flow graphs.
- Off-by-one errors in node vs edge counting on directed cyclic graphs (loops).
How questions are asked
- Multi-part matching or tuple-selection of cyclomatic complexity for given code snippets and CFG diagrams
- NAT calculating cyclomatic complexity for a given function or graph structure
Paper trends
Appears as a 2-mark comprehensive question testing cyclomatic complexity across code, graph representation, and serial composition of modules.
2015
Difficulty notes
Medium difficulty arises from combining multiple steps: deriving from textual source code, reading a visual graph diagram to count and , and applying composition rules for connected modules without making arithmetic or boundary errors.