hamburger menu
All Coursesall course arrow
adda247
reward-icon
adda247
    arrow
    arrow
    arrow
    The cyclomatic complexity of the following flow graph is: 
    Question



    The cyclomatic complexity of the following flow graph is: 

    A.

    3

    B.

    4

    C.

    10

    D.

    2

    Correct option is B


    Cyclomatic complexity is calculated using the formula: Cyclomatic Complexity (V(G)) = E – N + 2P Where,
    · E is the number of edges in the graph.
    · N is the number of nodes in the graph.
    · P is the number of connected components (typically 1 for a single program).
    Let's count the number of nodes (N) and edges (E) in the given flow graph:
    Nodes (N): There are 9 nodes in the graph.
    Edges (E): Count the edges by following each line connecting the nodes. The given graph has the following edges:


    Connected Components (P): The graph represents a single connected component of the program, so P = 1.
    Using the formula:

    Therefore, the cyclomatic complexity for the given flow graph is: (b) 4

    Free Tests

    Free
    Must Attempt

    Basics of Education: Pedagogy, Andragogy, and Hutagogy

    languageIcon English
    • pdpQsnIcon10 Questions
    • pdpsheetsIcon20 Marks
    • timerIcon12 Mins
    languageIcon English
    Free
    Must Attempt

    UGC NET Paper 1 Mock Test 1

    languageIcon English
    • pdpQsnIcon50 Questions
    • pdpsheetsIcon100 Marks
    • timerIcon60 Mins
    languageIcon English
    Free
    Must Attempt

    Basics of Education: Pedagogy, Andragogy, and Hutagogy

    languageIcon English
    • pdpQsnIcon10 Questions
    • pdpsheetsIcon20 Marks
    • timerIcon12 Mins
    languageIcon English
    test-prime-package

    Access ‘UGC NET Computer Science’ Mock Tests with

    • 60000+ Mocks and Previous Year Papers
    • Unlimited Re-Attempts
    • Personalised Report Card
    • 500% Refund on Final Selection
    • Largest Community
    students-icon
    416k+ students have already unlocked exclusive benefits with Test Prime!
    Our Plans
    Monthsup-arrow