• recategorized by
2,843 views
3 3 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$

1 Answer

Best answer
3 3 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:
Position:
Show:

Related questions

4 4 votes
2 answers 2 answers
4.5k
4.5k views
gatecse asked Dec 17, 2017
4,461 views
//Consider the program void function(int n) { int i,j,count=0; for(i=n/2;i<=n;i++) for(j=1;j<=n;j=j*2) count++; }The complexity of the program is$O(\log n)$$O(n^2)$$O(n^2...
9 9 votes
2 answers 2 answers
4.7k
4.7k views
gatecse asked Dec 17, 2017
4,684 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 3 votes
2 answers 2 answers
2.4k
2.4k views
gatecse asked Dec 17, 2017
2,410 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 5 votes
1 answers 1 answer
2.0k
2.0k views
gatecse asked Dec 17, 2017
2,014 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...