Recent questions tagged identify-function

0 0 votes
1 1 answer
223
223 views
Consider the following function:int unknown(int n){ int i, j, k=0; for (i=n/2; i<=n; i++) for (j=2; j<=n; j=j*2) k = k + n/2; return (k); }The return value of the functio...
19 19 votes
10 10 answers
7.4k
7.4k views
$A=\{0,1,2,3, \ldots\}$ is the set of non-negative integers. Let $F$ be the set of functions from $A$ to itself. For any two functions, $f_{1}, f_{2} \in \mathrm{~F}$, we...
6 6 votes
1 1 answer
975
975 views
Consider the following function.If $n$ and $\mathrm{k}$ are positive integers, then the least value of $\mathrm{k}$ such that $\mathrm{f}(\mathrm{k})>n$ is approximately$...
0 0 votes
1 1 answer
555
555 views
int foo(int n){if(n<3)return 1;else return (foo(n-1) + foo(n-3) + 1);}Let ‘m’ denote the number of invocations of function foo and ‘n’ denote the return value when ...
6 6 votes
3 3 answers
2.4k
2.4k views
Consider the function func shown below: int func(int num) { int count = 0; while (num) { count++; num>>= 1; } return (count); }The value returned by func(-435) is:69Will ...
0 0 votes
1 1 answer
666
666 views
3 3 votes
2 2 answers
1.2k
1.2k views
Consider the following algorithm for computing the factorial of a positive integer $n$, specified in binary:prod ← 1 for i from 1 to n prod ← prod × i output prodAssume t...
1 1 vote
4 answers 4 answers
1.1k
1.1k views
What does the following function compute for $x \neq 0?$float isi1(float x, int y) { if (y==0) { return 1; } else if (y>0) { return isi1(x,-y); } else { return isi1(x, y+...
0 0 votes
1 1 answer
285
285 views
Let $f$ be a real valued function on $\mathbb{R}$. If for all real $x$, $$ f(x)+3 f(1-x)=5 $$ holds, then show that $f$ is a constant function.
24 24 votes
7 answers 7 answers
10.4k
10.4k views
Consider the following $\text{ANSI C}$ function:int SomeFunction (int x, int y) { if ((x==1) || (y==1)) return 1; if (x==y) return x; if (x y) return SomeFunction(x-y, y...
20 20 votes
6 answers 6 answers
12.8k
12.8k views
Consider the following $\text{ANSI C}$ function:int SimpleFunction(int Y[], int n, int x) { int total = Y[0], loopIndex; for (loopIndex=1; loopIndex<=n-1; loopIndex++) to...
1 1 vote
2 2 answers
1.0k
1.0k views
Consider the following program. Assume that $x$ and $y$ are integers.f(x, y) { if (y != 0) return (x * f(x,y-1)); else return 1; }What is $f(6,3)?$$243$$729$$125$$216$
1 1 vote
1 1 answer
597
597 views
For any string $\text{str, length(str)}$ returns the length of the string, $\text{append(str1, str2)}$ concatenates $\text{str1}$ with another string $\text{str2}$, and $...