Skip to content

Beta · Data may be lost.Your data may be reset or lost.

GateBrew
← GATE CSE 2026 Set 2
Questions

Q51

NAT2 marks

Consider the following ANSI-C function.

int func(int start, int end){
    int length=end+1-start;
    if((length<1)||(start<0)||(end<0)){ return(0); }
    if(length%3==0){
        return(func(start+1, end));
    }else if(length%3==1){
        return(1+func(start, end-1));
    }else {
        return(func(start+2, end));
    }
}

The maximum possible value that can be returned from this function is ______\_\_\_\_\_\_. (answer in integer) Note: Ignore syntax errors (if any) in the function.

Sign in to save attempts.

The solution is hidden while you attempt this question. It opens once you check or show the answer.