reopened by
2,145 views
2 votes
2 votes

Consider the function

int fun(x: integer)
{
    If x>100 then fun=x-10;
    else
    fun=fun(fun(x+11));
}

For the input $x=95$, the function will return

  1. $89$
  2. $90$
  3. $91$
  4. $92$
reopened by

1 Answer

Best answer
2 votes
2 votes
value return by fun(95)=fun(fun(106))=fun(96)=fun(fun(107))=fun(97)=fun(fun(108))=fun(98)=fun(fun(109))=fun(99)=fun(fun(110))=fun(100)=fun(fun(111))=fun(101)=91.
selected by
Answer:

Related questions

9 votes
9 votes
2 answers
1
gatecse asked Dec 17, 2017
3,757 views
Consider the following $C$ function#include<stdio.h int main(void) { char c[]="ICRBCSIT17" char *p=c; printf("%s",c+2[p]-6[p]-1); return 0; }The output of the program is ...
3 votes
3 votes
2 answers
2
gatecse asked Dec 17, 2017
1,675 views
Consider the functionint func(int num) { int count=0; while(num) { count++; num>>=1; } return(count); }For $func(435)$ the value returned is$9$$8$$0$$10$
5 votes
5 votes
1 answer
3
gatecse asked Dec 17, 2017
1,456 views
Which one of the following are essential features of object-oriented language? A.Abstraction and encapsulation B.Strictly-typed C.Type-safe property coupled with sub-type...
9 votes
9 votes
1 answer
4