MCQ · 2 marks · Optimization and Data Flow

GATE CS 2015 CS-3 — Q58

Consider three software items: Program-X, Control Flow Diagram of Program-Y and Control Flow Diagram of Program-Z as shown below

Program-X:
sumcal(int maxint, int value)
{
    int result=0, i=0;
    if (value < 0)
    {
        value = -value;
    }
    while((i<value) AND (result <= maxint))
    {
        i=i+1;
        result = result + 1;
    }
    if (result <= maxint)
    {
        printf(result);
    }
    else
    {
        printf("large");
    }
    printf("end of program");
}
Control Flow Diagram of Program-Y: shown in the figure.

Control Flow Diagram of Program-Z: the Control Flow Diagram of Program-X followed by (with an arrow into) the Control Flow Diagram of Program-Y.

The values of McCabe's Cyclomatic complexity of Program-X, Program-Y, and Program-Z respectively are
Question figure
Select one option