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
Recent questions tagged identifyfunction
+4
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
(
423k
points)

4.2k
views
gate2019
algorithms
identifyfunction
0
votes
1
answer
2
#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
(
8.2k
points)

85
views
algorithms
usergate2014
usermod
identifyfunction
+1
vote
0
answers
3
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.6k
points)

164
views
identifyfunction
+25
votes
7
answers
4
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
(
423k
points)

5k
views
gate20172
programming
algorithms
numericalanswers
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 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
(
104k
points)

312
views
tifr2017
algorithms
identifyfunction
0
votes
2
answers
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 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.9k
points)

203
views
gate1989
descriptive
algorithms
identifyfunction
+4
votes
3
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
(
29.9k
points)

365
views
gate1990
descriptive
algorithms
identifyfunction
+6
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
(
423k
points)

483
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
(
423k
points)

434
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
(
104k
points)

1.6k
views
isro2011
algorithms
identifyfunction
+5
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
(
104k
points)

1.4k
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
(
104k
points)

1.6k
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
(
104k
points)

121
views
iisccsaresearch2016
descriptive
algorithms
identifyfunction
iiscinterview
+1
vote
1
answer
14
ISI2014PCBA1b
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$ ... 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
(
104k
points)

117
views
descriptive
isi2014
algorithms
identifyfunction
+1
vote
1
answer
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, \text{ 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
(
104k
points)

76
views
descriptive
cmi2011
algorithms
identifyfunction
+7
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], \dots [ \: ]$ denotes the empty list, and $[b]$ is the list consisting of one bit $b$. The function $\text{length}(l)$ ... mystery1(mystery2(s,tail(t)),mystery2(s,tail(t)))) endif Suppose $s=t=110100100$. What are the first two bits of $\text{mystery2(s,t)}$?
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
104k
points)

281
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
(
104k
points)

81
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
(
104k
points)

72
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
(
104k
points)

50
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
(
104k
points)

57
views
cmi2014
descriptive
algorithms
identifyfunction
+3
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
(
104k
points)

67
views
cmi2014
descriptive
algorithms
identifyfunction
+3
votes
2
answers
22
CMI2014A03
In the code fragment on the right, start and end are integer values and $\text{prime}(x)$ is a function that returns true if $x$ is a prime number and $\text{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 ... + m; }else{ j := j + m; } } $k < i+j$ $k = i+j$ $k > i+j$ Depends on $\text{start}$ and $\text{end}$
asked
May 27, 2016
in
Algorithms
by
jothee
Veteran
(
104k
points)

67
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
(
104k
points)

290
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 (eo(a ... $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
(
104k
points)

69
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); ... = a and (b/2)*2 < b) return 2; end; return 3; } $\text{mystery}(75,210)$ returns $2$ $6$ $10$ $15$
asked
May 23, 2016
in
Algorithms
by
jothee
Veteran
(
104k
points)

68
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
(
29.9k
points)

2.2k
views
isro2013
programminginc
identifyfunction
output
+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
(
104k
points)

1.1k
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
(
3k
points)

102
views
functions
identifyfunction
+30
votes
3
answers
29
TIFR2014B20
Consider the following game. There is a list of distinct numbers. At any round, a player arbitrarily chooses two numbers $a, b$ from the list and generates a new number $c$ by subtracting the smaller number from the larger one. The numbers $a$ and $b$ are put back in the list. If ... $273$. What is the score of the best player for this game? $40$ $16$ $33$ $91$ $123$
asked
Nov 20, 2015
in
Algorithms
by
makhdoom ghaya
Boss
(
29.9k
points)

874
views
tifr2014
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
OFFICIAL GATE MOCK TEST RELEASED
IIITH: Winter Research Admissions 2019 (For Spring 2020)
TIFR and JEST exam
Minimal Deterministic Finite Automata
To be aware of fake GATE test series
Follow @csegate
Recent questions tagged identifyfunction
Recent Blog Comments
Please anyone can provide me engineering...
No.....it means your application accepted i.e...
It says: "Candidates who meet the eligibility...
@ankitgupta.1729 Thanks a lot ... :)
@Debapaul yeah, for part 1) gate...
50,650
questions
56,242
answers
194,286
comments
95,934
users