Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged identify-function
5
votes
1
answer
1
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 17
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 $\log _2\left(\log _2 n\right)$ $\log _2 n$ $n \log _2 n$ $2^n$
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$...
GO Classes
508
views
GO Classes
asked
Feb 5
Algorithms
goclasses2024-mockgate-14
algorithms
identify-function
time-complexity
1-mark
+
–
5
votes
1
answer
2
GO Classes Test Series 2024 | Mock GATE | Test 12 | Question: 30
Consider the following pseudocode for a function that operates on an $\textsf{N}$ element array $\textsf{A[1],A[2]},\dots,\textsf{A[N]}$ of integers. function mystery (A[1...N]) { int i,j,position,tmp; for i=1 to N { position= ... ; } } If $\textsf{N = 100,}$ how many times is the comparison $\textsf{A[j] < A[position]}$ checked?
Consider the following pseudocode for a function that operates on an $\textsf{N}$ element array $\textsf{A ,A },\dots,\textsf{A[N]}$ of integers.function mystery (A[1...N...
GO Classes
528
views
GO Classes
asked
Jan 21
Algorithms
goclasses2024-mockgate-12
goclasses
numerical-answers
algorithms
identify-function
time-complexity
2-marks
+
–
0
votes
1
answer
3
function call
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 the function is called as foo(foo(5)). What is the value of m - n ?
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 val...
24aaaa23
285
views
24aaaa23
asked
Oct 1, 2023
Algorithms
algorithms
identify-function
normal
+
–
5
votes
2
answers
4
GATE CSE 2014 Set 2 | Question: 10 | Modified
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: 6 9 Will loop forever Depends on computer architecture
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 ...
Souvik33
1.2k
views
Souvik33
asked
Jan 15, 2023
Programming in C
algorithms
identify-function
numerical-answers
easy
+
–
0
votes
1
answer
5
Algo
damz1499
293
views
damz1499
asked
Nov 11, 2022
Algorithms
algorithms
identify-function
+
–
1
votes
1
answer
6
TIFR CSE 2022 | Part B | Question: 4
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 prod Assume that the number of bit operations required to multiply a $k$-bit positive integer with an $\ell$ ... $\omega(n \log n)$ $O\left(n^3\right)$ but $\omega\left(n^2\right) $ None of the above
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 prodAss...
admin
684
views
admin
asked
Sep 1, 2022
Algorithms
tifr2022
algorithms
identify-function
time-complexity
+
–
1
votes
3
answers
7
ISI2020-PCB-CS: 1.3
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+1)/x; } }
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+...
admin
557
views
admin
asked
Aug 18, 2022
Programming in C
isi2020-pcb-cs
identify-function
descriptive
+
–
11
votes
4
answers
8
GATE CSE 2021 Set 2 | Question: 23
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); if (y > x) return SomeFunction (x, y-x); } The value returned by $\textrm{SomeFunction(15, 255)}$ is __________
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...
Arjun
5.1k
views
Arjun
asked
Feb 18, 2021
Algorithms
gatecse-2021-set2
numerical-answers
algorithms
identify-function
output
1-mark
+
–
8
votes
4
answers
9
GATE CSE 2021 Set 1 | Question: 48
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++) total=x*total +Y[loopIndex]; return total; } Let $\textsf{Z}$ be an array ... $i$ such that $0 \leq i \leq 9$. The value returned by $\textsf{SimpleFunction(Z},10,2)$ is __________
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...
Arjun
6.3k
views
Arjun
asked
Feb 18, 2021
Algorithms
gatecse-2021-set1
algorithms
numerical-answers
identify-function
2-marks
+
–
1
votes
2
answers
10
CMI-2020-DataScience-A: 1
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$
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$
soujanyareddy13
607
views
soujanyareddy13
asked
Jan 29, 2021
Algorithms
cmi2020-datascience
algorithms
recursion
identify-function
+
–
1
votes
1
answer
11
CMI-2020-DataScience-B: 1
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 $\text{trim(str)}$ removes any spaces that exist at the end of the string $\text{str}$ ... { if(str[i] is ' ') { reverse(str, j, i-1); j = i + 1; } } trim(str); return str; }
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 $...
soujanyareddy13
309
views
soujanyareddy13
asked
Jan 29, 2021
Algorithms
cmi2020-datascience
algorithms
identify-function
+
–
18
votes
4
answers
12
GATE CSE 2020 | Question: 48
Consider the following C functions. int tob (int b, int* arr) { int i; for (i = 0; b>0; i++) { if (b%2) arr [i] = 1; else arr[i] = 0; b = b/2; } return (i); } int pp(int a, int b) { int arr[20]; int i, tot = 1, ex, len; ex = a; len = tob(b ... ; i<len ; i++) { if (arr[i] ==1) tot = tot * ex; ex= ex*ex; } return (tot) ; } The value returned by $pp(3,4)$ is _______.
Consider the following C functions.int tob (int b, int* arr) { int i; for (i = 0; b>0; i++) { if (b%2) arr [i] = 1; else arr[i] = 0; b = b/2; } ret...
Arjun
11.5k
views
Arjun
asked
Feb 12, 2020
Algorithms
gatecse-2020
numerical-answers
identify-function
2-marks
+
–
0
votes
0
answers
13
TIFR CSE 2020 | Part B | Question: 7
Consider the following algorithm (Note: For positive integers, $p,q,p/q$ denotes the floor of the rational number $\dfrac{p}{q}$, assume that given $p,q,p/q$ can be computed in one step): $\textbf{Input:}$ Two positive integers $a,b,a\geq b.$ $\textbf{Output:}$ A positive ... $\Theta(\log K)$ $\Theta({K})$ $\Theta({K\log K})$ $\Theta({K^{2}})$ $\Theta({2^{K}})$
Consider the following algorithm (Note: For positive integers, $p,q,p/q$ denotes the floor of the rational number $\dfrac{p}{q}$, assume that given $p,q,p/q$ can be compu...
admin
664
views
admin
asked
Feb 10, 2020
Algorithms
tifr2020
algorithms
identify-function
time-complexity
+
–
4
votes
3
answers
14
CMI2019-A-9
The next two questions refer to the following program. In the code below reverse$(A,i,j)$ takes an array $A,$ indices $i$ and $j$ with $i\leq j,$ and reverses the segment $A[i],A[i+1],\cdots,A[j].$ ... } reverse(A,i,m); } return; } When the procedure terminates, the array A has been: Sorted in descending order Sorted in ascending order Reversed Left unaltered
The next two questions refer to the following program.In the code below reverse$(A,i,j)$ takes an array $A,$ indices $i$ and $j$ with $i\leq j,$ and reverses the segment ...
gatecse
936
views
gatecse
asked
Sep 13, 2019
Programming in C
cmi2019
identify-function
+
–
1
votes
3
answers
15
CMI2019-A-10
The next two questions refer to the following program. In the code below reverse$(A,i,j)$ takes an array $A,$ indices $i$ and $j$ with $i\leq j,$ and reverses the segment $A[i],A[i+1],\cdots,A[j].$ For instance if $A=[0,1,2,3,4,5,6,7]$ then, after we ... return; } The number of times the test $A[ j ] > A[ m ]$ is executed is: $4950$ $5050$ $10000$ Depends on the contents of $A$
The next two questions refer to the following program.In the code below reverse$(A,i,j)$ takes an array $A,$ indices $i$ and $j$ with $i\leq j,$ and reverses the segment ...
gatecse
645
views
gatecse
asked
Sep 13, 2019
Programming in C
cmi2019
identify-function
+
–
4
votes
3
answers
16
CMI2018-A-10
What does the following function compute in terms of $n$ and $d$, for integer value of $n$ and $d,d>1?$ Note that $a//b$ denotes the quotient(integer part) of $a \div b,$ for integers $a$ and $b$. For instance $7//3$ is $2.$ function foo(n,d) ... $n.$ The number of digits in the base $d$ representation of $n.$ The number of ways of partitioning $n$ elements into groups of size $d.$
What does the following function compute in terms of $n$ and $d$, for integer value of $n$ and $d,d>1?$ Note that $a//b$ denotes the quotient(integer part) of $a \div b,$...
gatecse
886
views
gatecse
asked
Sep 13, 2019
Programming in C
cmi2018
identify-function
+
–
13
votes
4
answers
17
GATE CSE 2019 | Question: 18
Consider the following C program : #include<stdio.h> int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n",x); return 0; } The value printed by the program is ______________.
Consider the following C program :#include<stdio.h int jumble(int x, int y){ x = 2*x+y; return x; } int main(){ int x=2, y=5; y=jumble(y,x); x=jumble(y,x); printf("%d \n"...
Arjun
9.7k
views
Arjun
asked
Feb 7, 2019
Programming in C
gatecse-2019
programming-in-c
numerical-answers
identify-function
1-mark
+
–
23
votes
8
answers
18
GATE CSE 2019 | Question: 26
Consider the following C function. void convert (int n ) { if (n<0) printf{ %d , n); else { convert(n/2); printf( %d , n%2); } } Which one of the following will happen when the function convert is called with any positive ... order and terminate It will print the binary representation of $n$ but will not terminate It will not print anything and will not terminate
Consider the following C function.void convert (int n ) { if (n<0) printf{“%d”, n); else { convert(n/2); printf(“%d”, n%2); } }Which one of the following will hap...
Arjun
16.7k
views
Arjun
asked
Feb 7, 2019
Algorithms
gatecse-2019
algorithms
identify-function
2-marks
+
–
0
votes
2
answers
19
GATE Overflow | Mock GATE | Test 1 | Question: 26
Consider the two given functions: int fun1(int x, int y) { if (y==0) return 0; return (x+fun2(x, y-1)); } int fun2(int x, int y) { if (x==0) return y; return fun2(x-1, x+y); } What will be the value returned by $\text{fun1}(4, 4)$ ____
Consider the two given functions:int fun1(int x, int y) { if (y==0) return 0; return (x+fun2(x, y-1)); } int fun2(int x, int y) { if (x==0) return y; return fun2(x-1, x+y...
Ruturaj Mohanty
1.1k
views
Ruturaj Mohanty
asked
Dec 27, 2018
Algorithms
go-mockgate-1
numerical-answers
identify-function
recursion
algorithms
+
–
3
votes
1
answer
20
GATE Overflow | Mock GATE | Test 1 | Question: 29
Consider the following piece of code: int function(int a[], int n, int x) { int i; for (i=0; i<n && a[i]!=x;i++); if (i==n) return -1; else return i; } A function call is made with the arguments as follows: $a[]=\{5, 32, 1, 9, 7, 2\}$ $n=6$ $x=8$ What will be the value returned by the above code?
Consider the following piece of code:int function(int a[], int n, int x) { int i; for (i=0; i<n && a[i]!=x;i++); if (i==n) return -1; else return i; }A function call is m...
Ruturaj Mohanty
919
views
Ruturaj Mohanty
asked
Dec 27, 2018
Algorithms
go-mockgate-1
numerical-answers
identify-function
algorithms
+
–
1
votes
1
answer
21
Test algo
Deepalitrapti
840
views
Deepalitrapti
asked
Sep 20, 2018
Algorithms
identify-function
output
test-series
+
–
0
votes
1
answer
22
#IdentifyFunctions #Algorithms User Gate 2014 Self Doubt
Original Question - here Consider the following C function in which size is the number of elements in the array E: int MyX(int *E, unsigned int size) { int Y = 0; int Z; int i, j, k; for(i = 0; i< size; i++) Y = Y + ... ============= Can someone trace the code by taking some arbitrary values in the array and show how to do this? Thank you!
Original Question - here Consider the following C function in which size is the number of elements in the array E: int MyX(int *E, unsigned int size) { int Y = 0; int Z;...
iarnav
525
views
iarnav
asked
Jun 28, 2018
Algorithms
algorithms
usergate2014
usermod
identify-function
+
–
1
votes
2
answers
23
ISRO2018-7
Assume $A$ and $B$ are non-zero positive integers. The following code segment: while(A!=B){ if*(A> B) A -= B; else B -= A; } cout<<A; // printing the value of A Computes the $LCM$ of two numbers Divides the larger number by the smaller number Computes the $GCD$ of two numbers Finds the smaller of two numbers
Assume $A$ and $B$ are non-zero positive integers. The following code segment:while(A!=B){ if*(A B) A -= B; else B -= A; } cout<<A; // printing the value of AComputes the...
Arjun
4.2k
views
Arjun
asked
Apr 22, 2018
Algorithms
isro2018
algorithms
identify-function
+
–
1
votes
1
answer
24
ISRO2018-12
An array $A$ consists of $n$ integers in locations $A[0], A[1], \ldots A[n-1]$. It is required to shift the elements of the array cyclically to the left by $k$ places, where $1<=k<=(n-1)$. An incomplete algorithm for doing this in linear time, without using another array is given ...
An array $A$ consists of $n$ integers in locations $A[0], A , \ldots A[n-1]$. It is required to shift the elements of the array cyclically to the left by $k$ places, wher...
Arjun
5.2k
views
Arjun
asked
Apr 22, 2018
Algorithms
isro2018
algorithms
identify-function
+
–
5
votes
2
answers
25
ISRO2018-72
Consider the following C code segment int f(int x) { if(x<1) return 1; else return (if(x-1)+g(x)); } int g(int x) { if(x<2) return 2; else return (if(x-1)+g(x/2)); } Of the following, which best describes the growth of $f(x)$ as a function of $x$ ? Linear Exponential Quadratic Cubic
Consider the following C code segmentint f(int x) { if(x<1) return 1; else return (if(x-1)+g(x)); } int g(int x) { if(x<2) return 2; else return (if(x-1)+g(x/2)); }Of the...
Arjun
4.7k
views
Arjun
asked
Apr 22, 2018
Algorithms
isro2018
algorithms
identify-function
time-complexity
+
–
1
votes
0
answers
26
gate 1994
Function what(x, n:integer): integer: Var value : integer begin value := 1 if n > 0 then begin if n mod 2 =1 then value := value * x; value := value * what(x*x, n div 2); end; what := value; end; convert the code in c
Function what(x, n:integer): integer:Varvalue : integerbeginvalue := 1if n 0 thenbeginif n mod 2 =1 thenvalue := value * x;value := value * what(x*x, n div 2);end;what :...
Rameez Raza
630
views
Rameez Raza
asked
Jun 14, 2017
Programming in C
identify-function
+
–
Page:
1
2
3
4
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register