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

I forgot my password
Activity
Questions
Unanswered
Tags
Subjects
Users
Ask
Prev
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
+3
votes
8
answers
1
GATE201926
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 integer ... reverse order and terminate It will print the binary representation of $n$ but will not terminate It will not print anything and will not terminate
asked
Feb 7
in
Algorithms
by
Arjun
Veteran
(
413k
points)

3.8k
views
gate2019
algorithms
identifyfunction
0
votes
1
answer
2
GATEBOOK2019 Mock Test126
# include <stdio.h> main () { float total 0.0, q = 1.0, p = 2.0; while (p/q> 0.001) { q = q + q ; total = total + p/q ; print f ("% f\n", total) ; } } Which one of the following is the integer that best approximates the last number printed ? $0$ $1$ $2$ $3$
asked
Jan 19
in
Algorithms
by
GATEBOOK
Boss
(
11.4k
points)

167
views
gb2019mock1
identifyfunction
0
votes
1
answer
3
#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!
asked
Jun 28, 2018
in
Algorithms
by
iarnav
Loyal
(
7.9k
points)

72
views
algorithms
usergate2014
usermod
identifyfunction
0
votes
0
answers
4
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.5k
points)

142
views
identifyfunction
+24
votes
6
answers
5
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[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
(
413k
points)

4.6k
views
gate20172
programming
algorithms
numericalanswers
identifyfunction
0
votes
0
answers
6
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
(
2.9k
points)

77
views
virtualgate
programminginc
identifyfunction
+5
votes
1
answer
7
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 must ... $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
(
97k
points)

289
views
tifr2017
algorithms
identifyfunction
0
votes
2
answers
8
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 type string= ... $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
(
29.5k
points)

167
views
gate1989
descriptive
algorithms
identifyfunction
+3
votes
3
answers
9
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
(
29.5k
points)

297
views
gate1990
descriptive
algorithms
identifyfunction
+6
votes
1
answer
10
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
(
413k
points)

453
views
go2017programming1
programming
identifyfunction
+2
votes
2
answers
11
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
(
413k
points)

401
views
go2017programming1
programming
programminginc
identifyfunction
+3
votes
4
answers
12
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
(
97k
points)

1.6k
views
isro2011
algorithms
identifyfunction
+4
votes
1
answer
13
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
(
97k
points)

1.4k
views
isro2008
algorithms
recursion
identifyfunction
+4
votes
2
answers
14
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
(
97k
points)

1.5k
views
isro2007
algorithms
identifyfunction
0
votes
1
answer
15
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
(
97k
points)

113
views
iisccsaresearch2016
descriptive
algorithms
identifyfunction
iiscinterview
+1
vote
1
answer
16
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 pseudocode 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
(
97k
points)

117
views
descriptive
isi2014
algorithms
identifyfunction
+1
vote
1
answer
17
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
(
97k
points)

67
views
descriptive
cmi2011
algorithms
identifyfunction
+5
votes
1
answer
18
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
(
97k
points)

231
views
descriptive
cmi2010
algorithms
identifyfunction
+5
votes
1
answer
19
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
(
97k
points)

79
views
descriptive
cmi2015
algorithms
identifyfunction
+2
votes
1
answer
20
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
(
97k
points)

69
views
descriptive
cmi2015
algorithms
identifyfunction
+2
votes
0
answers
21
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
(
97k
points)

48
views
cmi2014
descriptive
algorithms
identifyfunction
+2
votes
1
answer
22
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
(
97k
points)

56
views
cmi2014
descriptive
algorithms
identifyfunction
+3
votes
1
answer
23
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
(
97k
points)

66
views
cmi2014
descriptive
algorithms
identifyfunction
+1
vote
1
answer
24
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
(
97k
points)

54
views
cmi2014
algorithms
identifyfunction
+8
votes
2
answers
25
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
(
97k
points)

263
views
cmi2013
algorithms
identifyfunction
+1
vote
1
answer
26
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 (eo(a,b) ... $ 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
(
97k
points)

64
views
cmi2012
algorithms
identifyfunction
timecomplexity
+1
vote
1
answer
27
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,b ... 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
(
97k
points)

65
views
cmi2012
algorithms
identifyfunction
+4
votes
4
answers
28
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
(
29.5k
points)

2.1k
views
isro2013
programminginc
identifyfunction
output
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
How to prepare for GATE with a fulltime job??
Interview Experience at IISc
All subject Gate notes from Standard Books!!
My journey from Wipro to an IISc student  GATE 2019
Interview Experience at IITPalakkad
Follow @csegate
Recent questions tagged identifyfunction
Recent Blog Comments
sir .I recvd a mail which states "Your...
https://drive.google.com/open?id=1lzQpNHE4Phvo9JFA...
Sir, I will say the "
THE PURPOSE OF...
Even though the pre booking is closed...if i go...
Can rely upon these notes?
49,808
questions
54,481
answers
188,244
comments
74,491
users