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.
Recent questions tagged identifyfunction
0
votes
0
answers
1
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
Loyal
(
3.1k
points)

76
views
identifyfunction
+18
votes
6
answers
2
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; ... 1]) { 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
(
346k
points)

2.7k
views
gate20172
programming
algorithms
numericalanswers
identifyfunction
0
votes
0
answers
3
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 ... 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
Loyal
(
4.3k
points)

63
views
virtualgate
programminginc
identifyfunction
+4
votes
1
answer
4
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 ... 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
(
108k
points)

194
views
tifr2017
algorithms
identifyfunction
0
votes
1
answer
5
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]) ... {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
Veteran
(
47.8k
points)

81
views
gate1989
descriptive
algorithms
identifyfunction
+1
vote
2
answers
6
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 26, 2016
in
Algorithms
by
makhdoom ghaya
Veteran
(
47.8k
points)

115
views
gate1990
descriptive
algorithms
identifyfunction
+5
votes
1
answer
7
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 ... 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
(
346k
points)

311
views
go2017programming1
programming
identifyfunction
+2
votes
1
answer
8
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; ... 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
(
346k
points)

247
views
go2017programming1
programming
programminginc
identifyfunction
+3
votes
4
answers
9
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
(
108k
points)

1.2k
views
isro2011
algorithms
identifyfunction
+3
votes
1
answer
10
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
(
108k
points)

916
views
isro2008
algorithms
recursion
identifyfunction
+3
votes
2
answers
11
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
(
108k
points)

990
views
isro2007
algorithms
identifyfunction
0
votes
1
answer
12
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
(
108k
points)

81
views
iisccsaresearch2016
descriptive
algorithms
identifyfunction
iiscinterview
+1
vote
1
answer
13
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 \ ... 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
(
108k
points)

68
views
descriptive
isi2014
algorithms
identifyfunction
+1
vote
0
answers
14
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 ... (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
(
108k
points)

43
views
descriptive
cmi2011
algorithms
identifyfunction
+1
vote
0
answers
15
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 ... (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
(
108k
points)

44
views
descriptive
cmi2010
algorithms
identifyfunction
+5
votes
1
answer
16
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
(
108k
points)

50
views
descriptive
cmi2015
algorithms
identifyfunction
+2
votes
1
answer
17
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
(
108k
points)

47
views
descriptive
cmi2015
algorithms
identifyfunction
+2
votes
0
answers
18
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
(
108k
points)

29
views
cmi2014
descriptive
algorithms
identifyfunction
+2
votes
1
answer
19
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
(
108k
points)

40
views
cmi2014
descriptive
algorithms
identifyfunction
+2
votes
1
answer
20
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
(
108k
points)

48
views
cmi2014
descriptive
algorithms
identifyfunction
+1
vote
0
answers
21
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 ... 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
(
108k
points)

22
views
cmi2014
algorithms
identifyfunction
+7
votes
2
answers
22
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[ ... ] := 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
(
108k
points)

120
views
cmi2013
algorithms
identifyfunction
+1
vote
0
answers
23
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 ... 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
(
108k
points)

37
views
cmi2012
algorithms
identifyfunction
timecomplexity
+1
vote
1
answer
24
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 ... 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
(
108k
points)

38
views
cmi2012
algorithms
identifyfunction
+3
votes
3
answers
25
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 6, 2016
in
Programming
by
makhdoom ghaya
Veteran
(
47.8k
points)

1.5k
views
isro2013
programminginc
identifyfunction
programoutput
+10
votes
2
answers
26
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
(
108k
points)

662
views
gate2011
algorithms
recursion
identifyfunction
normal
0
votes
2
answers
27
What will be the output of right shift?
asked
Jan 23, 2016
in
Programming
by
Purple
Loyal
(
4.3k
points)

78
views
functions
identifyfunction
+5
votes
3
answers
28
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 ... $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
Veteran
(
47.8k
points)

261
views
tifr2014
algorithms
identifyfunction
+6
votes
2
answers
29
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 ... 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 7, 2015
in
Algorithms
by
makhdoom ghaya
Veteran
(
47.8k
points)

285
views
tifr2010
algorithms
identifyfunction
+21
votes
5
answers
30
GATE20153_49
Suppose $c = \langle c[0], \dots, c[k1]\rangle$ is an array of length $k$, where all the entries are from the set $\{0, 1\}$. For any positive integers $a \text{ and } n$, consider the following pseudocode. DOSOMETHING (c, a, n) $z \leftarrow 1$ for $i ... 1, 0, 1, 1 \rangle , a = 2, \text{ and } n=8$, then the output of DOSOMETHING(c, a, n) is _______.
asked
Feb 16, 2015
in
Algorithms
by
jothee
Veteran
(
108k
points)

1.3k
views
gate20153
algorithms
identifyfunction
normal
numericalanswers
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
isro sc 2017 2nd paper
Which college to expect?
Interview Guidance
CDAC CoursesAugust session
Counselling...
Follow @csegate
Gatecse
Recent questions tagged identifyfunction
Recent Blog Comments
Okay Thanks
i think they call everyone ith a score higher ...
@raviyogi Do you know what was the cutoff ot IIT ...
I think the exam has not yet been created.
Then why it's not appearing as a separate exam in ...
33,707
questions
40,253
answers
114,361
comments
38,874
users