The Wayback Machine - https://web.archive.org/web/20250304113635/https://www.geeksforgeeks.org/questions/consider-the-following-c-program-segment-c-while-first/

GATE | GATE-CS-2015 (Set 1) | Question 65

Last Updated :
Discuss
Comments

Consider the following C program segment.

C
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) not Present = True;

The cyclomatic complexity of the program segment is __________.

3

4

5

6

Dreaming of M.Tech in IIT? Get AIR under 100 with our GATE 2026 CSE & DA courses! Get flexible weekday/weekend options, live mentorship, and mock tests. Access exclusive features like All India Mock Tests, and Doubt Solving—your GATE success starts now!

Share your thoughts in the comments