in IS&Software Engineering recategorized by
729 views
1 vote
1 vote

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

The cyclomatic complexity of the program segment is _____________.

  1. $3$
  2. $4$
  3. $5$
  4. $6$
in IS&Software Engineering recategorized by
by
729 views

1 Answer

1 vote
1 vote

Cyclomatic complexity= number of predicates+1

here 4 predicates(while,if,else-if,if) presents 1 while loop and 3 if conditions.Total=4+1=5

option $C$ is correct.

  1. gate 2015
  2. ISRO 2014
  3. ISRO 2011
Answer:

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true