The Gateway to Computer Science Excellence
For all GATE CSE Questions
Toggle navigation
GATE Overflow
Facebook Login
Google Login
or
Email or Username
Password
Remember
Login
Register

I forgot my password
All Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
Previous
Blogs
New Blog
Exams
First time here? Checkout the
FAQ
!
x
×
Close
Use the google search bar on side panel. It searches through all previous GATE/other questions. For hardcopy of previous year questions please see
here
Recent questions tagged identifyfunction
0
votes
1
answer
1
#IdentifyFunctions #Algorithms User Gate 2014 Self Doubt
asked
Jun 28
in
Algorithms
by
iarnav
Loyal
(
7.9k
points)

35
views
algorithms
usergate2014
usermod
identifyfunction
0
votes
0
answers
2
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
asked
Jun 14, 2017
in
Programming
by
Rameez Raza
Active
(
2.4k
points)

94
views
identifyfunction
+20
votes
6
answers
3
GATE2017243
Consider the following snippet of a C program. Assume that swap $(\&x, \&y)$ exchanges the content of $x$ and $y$: int main () { int array[] = {3, 5, 1, 4, 6, 2}; int done =0; int i; while (done==0) { done =1; for (i=0; i<=4; i++) { if (array ... > array[i1]) { swap(&array[i], array[i1]); done =0; } } } printf( %d , array[3]); } The output of the program is _______
asked
Feb 14, 2017
in
Programming
by
Arjun
Veteran
(
355k
points)

3.3k
views
gate20172
programming
algorithms
numericalanswers
identifyfunction
0
votes
0
answers
4
virtualgate2017
Consider the following code. def brian(n): count = 0 while ( n != 0 ) n = n & ( n1 ) count = count + 1 return count Here n is meant to be an unsigned integer. The operator & considers its arguments in binary and computes their bit wise ... representation of n. (C) The number of ones in the binary representation of n. (D) The code might go into an infinite loop for some n
asked
Jan 19, 2017
in
Programming
by
Purple
Active
(
3.5k
points)

68
views
virtualgate
programminginc
identifyfunction
+5
votes
1
answer
5
TIFR2017A12
Consider the following program modifying an $n \times n$ square matrix $A$: for i=1 to n: for j=1 to n: temp=A[i][j]+10 A[i][j]=A[j][i] A[j][i]=temp10 end for end for Which of the following statements about the contents of matrix $A$ at the end of this program ... by $10$ the new matrix $A$ is symmetric, that is, $A[i][j]=A[j][i]$ for all $1 \leq i, j \leq n$ $A$ remains unchanged
asked
Dec 22, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

218
views
tifr2017
algorithms
identifyfunction
0
votes
1
answer
6
GATE19898a
What is the output produced by the following program, when the input is "HTGATE" Function what (s:string): string; var n:integer; begin n=s, length if n <=1 then what :=s else what :=contact (what (substring (s, 2, n)), s.c [1]) end; Note (i) ... of length $s_{1}$ length + $s_{2}$  length obtained by concatenating $s_{1}$ with $s_{2}$ such that $s_{1}$ precedes $s_{2}$.
asked
Dec 3, 2016
in
Algorithms
by
makhdoom ghaya
Boss
(
40.1k
points)

112
views
gate1989
descriptive
algorithms
identifyfunction
+1
vote
2
answers
7
GATE199011b
The following program computes values of a mathematical function $f(x)$. Determine the form of $f(x)$. main () { int m, n; float x, y, t; scanf ("%f%d", &x, &n); t = 1; y = 0; m = 1; do { t *= (x/m); y += t; } while (m++ < n); printf ("The value of y is %f", y); }
asked
Nov 25, 2016
in
Algorithms
by
makhdoom ghaya
Boss
(
40.1k
points)

142
views
gate1990
descriptive
algorithms
identifyfunction
+5
votes
1
answer
8
GO2017Programming113
What is the following function doing? unsigned int foo(unsigned int x) { unsigned int c = sizeof x; c <<= 3; if(x == 0) return c; c; while(x = x & x1) c; return c; } Counting the number of bits in the ... x Counting the number of set bits in the binary representation of x Counting the number of unset bits in the binary representation of x None of the above
asked
Oct 19, 2016
in
Programming
by
Arjun
Veteran
(
355k
points)

367
views
go2017programming1
programming
identifyfunction
+2
votes
2
answers
9
GO2017Programming14
Consider the following C functions: int f1(int a, int b) { while (a != b) { if(a > b) a = a  b; else b = b  a; } return a; } int f2(int a, int b) { while (b != 0) { int t = b; b = a % b; a ... return same value for all positive inputs but not f3 For some positive input all 3 functions return different values f2 and f3 return same value for all positive inputs but not f1
asked
Oct 19, 2016
in
Programming
by
Arjun
Veteran
(
355k
points)

317
views
go2017programming1
programming
programminginc
identifyfunction
+3
votes
4
answers
10
ISRO201140
Consider the following pseudocode x:=1; i:=1; while ( x $\leq$ 500) begin x:=2$^x$; i:=i+1; end What is the value of i at the end of the pseudocode? 4 5 6 7
asked
Jun 22, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

1.5k
views
isro2011
algorithms
identifyfunction
+3
votes
1
answer
11
ISRO200869
What is the value of F(4) using the following procedure: function F(K : integer) integer; begin if (k<3) then F:=k else F:=F(k1)*F(k2)+F(k3) end; 5 6 7 8
asked
Jun 13, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

1.3k
views
isro2008
algorithms
recursion
identifyfunction
+4
votes
2
answers
12
ISRO200723
Study the following program //precondition: x>=0 public void demo(int x) { System.out.print(x % 10); if (x % 10 != 0) { demo(x/10); } System.out.print(x%10); } Which of the following is printed as a result of the call demo(1234)? 1441 3443 12344321 43211234
asked
Jun 10, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

1.4k
views
isro2007
algorithms
identifyfunction
0
votes
1
answer
13
IISCCSAResearchTest4
What is the output of the following program? int main() { int i=0; do { if (i >=5) { i+=2; printf("%d \n", i); break; } else { printf("%d \n", ++i); continue; } } while (i<7); }
asked
Jun 8, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

94
views
iisccsaresearch2016
descriptive
algorithms
identifyfunction
iiscinterview
+1
vote
1
answer
14
ISI2014A1b
Let $x, y$ be two nonnegative integers $< 2^{32}$. By $x \wedge y$ we mean the integer represented by the bitwise logical $AND$ of the 32 bit binary representations of $x$ and $y$. For example, if $x = 13$ and $y = 6$, then $x \wedge y$ is the bitwise ... code for the input $x = 13$? What will be the output of the pseudocode for an arbitrary nonnegative integer $x < 2^{32}$?
asked
May 30, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

93
views
descriptive
isi2014
algorithms
identifyfunction
+1
vote
0
answers
15
CMI2011B07b
A finite sequence of bits is represented as a list with values from the set $\{0,1\}$—for example, $[0,1,0], [1,0,1,1], \dots$ $[]$ denotes the empty list, and $[b]$ is the list consisting of one bit $b$. For a nonempty list $l, \: head(l)$ returns the first ... g2(n) if (n == 0) then return(0) else return f2(g2(n1),g1(n)) endif What is the value of $g2(256)$ and $g2(257)$?
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

52
views
descriptive
cmi2011
algorithms
identifyfunction
+2
votes
1
answer
16
CMI2010B07b
A finite sequence of bits is represented as a list with values from the set $\{0,1\}$. For example, $[0,1,0]$, $[1,0,1,1]$, . . . . [ ] denotes the empty list, and $[b]$ is the list consisting of one bit $b$. The function $length(l)$ ... else return( mystery1(mystery2(s,tail(t)),mystery2(s,tail(t)))) endif Suppose $s=t=110100100$. What are the first two bits of $mystery2(s,t)$?
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

101
views
descriptive
cmi2010
algorithms
identifyfunction
+5
votes
1
answer
17
CMI2015B06b
Consider the code below, defining the functions $f$ and $g$: f(m, n) { if (m == 0) return n; else { q = m div 10; r = m mod 10; return f(q, 10*n + r); } } g(m, n) { if (n == 0) return m; else { q = m div 10; r = m mod 10; return g(f(f(q, 0), r), n1); } } What does $g(m, n)$ compute, for nonnegative numbers $m$ and $n$?
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

60
views
descriptive
cmi2015
algorithms
identifyfunction
+2
votes
1
answer
18
CMI2015B06a
Consider the code below, defining the functions $f$ and $g$: f(m, n) { if (m == 0) return n; else { q = m div 10; r = m mod 10; return f(q, 10*n + r); } } g(m, n) { if (n == 0) return m; else { q = m div 10; r = m mod 10; return g(f(f(q, 0), r), n1); } } Compute $g(3, 7), \: g(345, 1), \: g(345, 4) \text{ and } \: g(345, 0)$.
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

55
views
descriptive
cmi2015
algorithms
identifyfunction
+2
votes
0
answers
19
CMI2014B07c
Consider the code below, defining the function $A$: A(m, n, p) { if (p == 0) return m+n; else if (n == 0 && p == 1) return 0; else if (n == 0 && p == 2) return 1; else if (n == 0) return m; else return A(m, A(m,n1,p), p1); } Compute $A(2, 2, 3)$ and $A(2, 3, 3)$.
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

37
views
cmi2014
descriptive
algorithms
identifyfunction
+2
votes
1
answer
20
CMI2014B07b
Consider the code below, defining the function $A$: A(m, n, p) { if (p == 0) return m+n; else if (n == 0 && p == 1) return 0; else if (n == 0 && p == 2) return 1; else if (n == 0) return m; else return A(m, A(m,n1,p), p1); } Express $A(m, n, 2)$ as a function of $m$ and $n$.
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

45
views
cmi2014
descriptive
algorithms
identifyfunction
+2
votes
1
answer
21
CMI2014B07a
Consider the code below, defining the function $A$: A(m, n, p) { if (p == 0) return m+n; else if (n == 0 && p == 1) return 0; else if (n == 0 && p == 2) return 1; else if (n == 0) return m; else return A(m, A(m,n1,p), p1); } Express $A(m, n, 1)$ as a function of $m$ and $n$.
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

55
views
cmi2014
descriptive
algorithms
identifyfunction
+1
vote
1
answer
22
CMI2014A03
In the code fragment on the right, start and end are integer values and $prime(x)$ is a function that returns true if $x$ is a prime number and $false$ otherwise. At the end of the loop: i := 0; j := 0; k := 0; for (m := start; m <= end; m := m+1){ k := k + m; if (prime(m)){ i := i + m; }else{ j := j + m; } } $k < i+j$ $k = i+j$ $k > i+j$ Depends on $start$ and $end$
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

45
views
cmi2014
algorithms
identifyfunction
+8
votes
2
answers
23
CMI2013A09
The below question is based on the following program. procedure mystery (A : array [1..100] of int) int i,j,position,tmp; begin for j := 1 to 100 do position := j; for i := j to 100 do if (A[i] > A[position]) then ... A[position] := tmp; endfor end When the procedure terminates, the array A has been: Reversed Sorted in descending order Left unaltered Sorted in ascending order
asked
May 23, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

168
views
cmi2013
algorithms
identifyfunction
+1
vote
1
answer
24
CMI2012A04
The below question is based on the following program. In the program, we assume that integer division returns only the quotient. For example 7/3 returns 2 since 2 is the quotient and 1 is the remainder. mystery(a,b){ if (b == 0) return a; if (a < b) return mystery(b,a); if ... of recursive calls to $mystery$ on input $a,\: b$ is $O(n)$ $O(log log n)$ $O(log n) $O(n^{\frac{1}{2})$
asked
May 23, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

54
views
cmi2012
algorithms
identifyfunction
timecomplexity
+1
vote
1
answer
25
CMI2012A03
The below question is based on the following program. In the program, we assume that integer division returns only the quotient. For example 7/3 returns 2 since 2 is the quotient and 1 is the remainder. mystery(a,b){ if (b == 0) return a; if (a < b) return mystery(b,a); if (eo(a, ... if ((a/2)*2 == a and (b/2)*2 < b) return 2; end; return 3; } $mystery(75,210)$ returns 2 6 10 15
asked
May 23, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

59
views
cmi2012
algorithms
identifyfunction
+4
votes
4
answers
26
ISRO201363
Consider the following $C$ code. #include <stdio.h> #include <math.h> void main () { double pi = 3.1415926535; int a = 1; int i; for (i=0; i < 3; i++) if (a = cos(pi * i/2)) printf("% d", 1); else printf("%d", 0); } What would the program print? $000$ $010$ $101$ $111$
asked
May 5, 2016
in
Programming
by
makhdoom ghaya
Boss
(
40.1k
points)

2.1k
views
isro2013
programminginc
identifyfunction
programoutput
+10
votes
2
answers
27
GATE201149
Consider the following recursive C function that takes two arguments. unsigned int foo(unsigned int n, unsigned int r) { if (n>0) return ((n%r) + foo(n/r, r)); else return 0; } What is the return value of the function $\text{foo}$ when it is called as $\text{foo(513, 2)}$? $9$ $8$ $5$ $2$
asked
Apr 21, 2016
in
Algorithms
by
jothee
Veteran
(
99.8k
points)

795
views
gate2011
algorithms
recursion
identifyfunction
normal
0
votes
2
answers
28
What will be the output of right shift?
Consider the C function func shown below: int func(int num) { int count = 0; while (num) { count++; num>>= 1; } return (count); } The value returned by func(0235) is ________
asked
Jan 23, 2016
in
Programming
by
Purple
Active
(
3.5k
points)

86
views
functions
identifyfunction
+5
votes
3
answers
29
TIFR2014B2
Consider the following code. def brian(n): count = 0 while ( n ! = 0 ) n = n & ( n1 ) count = count + 1 return count Here $n$ is meant to be an unsigned integer. The operator & considers its arguments in binary and computes their bit ... of $n$. The code might go into an infinite loop for some $n$. The result depends on the number of bits used to store unsigned integers.
asked
Nov 19, 2015
in
Algorithms
by
makhdoom ghaya
Boss
(
40.1k
points)

292
views
tifr2014
algorithms
identifyfunction
+6
votes
2
answers
30
TIFR2010B24
Consider the following program operating on four variables $u, v, x, y$, and two constants $X$ and $Y$. x, y, u, v:= X, Y, Y, X; While (x ā y) do if (x > y) then x, v := x  y, v + u; else if (y > x) then y, u:= y  x, u + v; od; ... , Y)$. The program prints $\frac1 2 \times \text{gcd}(X, Y)$ followed by $\frac1 2 \times \text{lcm}(X, Y)$. The program does none of the above.
asked
Oct 6, 2015
in
Algorithms
by
makhdoom ghaya
Boss
(
40.1k
points)

334
views
tifr2010
algorithms
identifyfunction
Page:
1
2
3
next »
Quick search syntax
tags
tag:apple
author
user:martin
title
title:apple
content
content:apple
exclude
tag:apple
force match
+apple
views
views:100
score
score:10
answers
answers:2
is accepted
isaccepted:true
is closed
isclosed:true
Recent Posts
Anxiety
Nielit 2018
Donation (Kerala Flood)
Schedule for GATE 2019
GATE 2019 official website
Follow @csegate
Gatecse
Recent questions tagged identifyfunction
Recent Blog Comments
Thanx man ... i really appreciate it ...
Hey bro, Firstly if you can't solve a ...
I am not able to update my credentials on the ...
Sir I have ordered GO PDF on 16 Aug 2018 still ...
gate overflow books are awesome; every one should ...
38,170
questions
45,671
answers
132,581
comments
49,528
users