GATE CS 2015, set 1 · Question 38 · Software Engineering · Not in the GATE 2027 syllabus · Numerical answer (NAT) · 2 marks · no negative marks

Consider the following C program segment.
while(first <= last) { if (array[middle] < search) first = middle + 1; else if (array[middle] == search) found = TRUE; else last = middle - 1; middle = (first + last)/2; } if (first > last) notPresent = TRUE;
The cyclomatic complexity of the program segment is ______.

Answer

Answer 5

Answer from the official GATE CS 2015 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes