Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage
Programming in C.
Recursion.
Filter
Recent
Hot!
Most votes
Most answers
Most views
Previous GATE
Featured
Hot questions in Programming in C
27
votes
4
answers
81
GATE CSE 2001 | Question: 2.17 | UGCNET-AUG2016-III: 21
What is printed by the print statements in the program $P1$ assuming call by reference parameter passing? Program P1() { x = 10; y = 3; func1(y,x,x); print x; print y; } func1(x,y,z) { y = y + 4; z = x + y + z } $\text{10, 3}$ $\text{31, 3}$ $\text{27, 7}$ None of the above
What is printed by the print statements in the program $P1$ assuming call by reference parameter passing?Program P1() { x = 10; y = 3; func1(y,x,x); print x; print y; } f...
Kathleen
12.6k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2001
programming-in-c
parameter-passing
normal
ugcnetcse-aug2016-paper3
+
–
37
votes
3
answers
82
GATE CSE 1994 | Question: 21
Consider the following recursive function: function fib (n:integer);integer; begin if (n=0) or (n=1) then fib := 1 else fib := fib(n-1) + fib(n-2) end; The above function is run on a computer with a stack of $64$ bytes. Assuming ... an address takes $2$ bytes each, estimate the maximum value of $n$ for which the stack will not overflow. Give reasons for your answer.
Consider the following recursive function:function fib (n:integer);integer; begin if (n=0) or (n=1) then fib := 1 else fib := fib(n-1) + fib(n-2) end;The above function i...
Kathleen
25.8k
views
Kathleen
asked
Oct 5, 2014
Programming in C
gate1994
programming
recursion
normal
descriptive
+
–
54
votes
7
answers
83
GATE CSE 2015 Set 1 | Question: 33
Consider the following pseudo code, where $x$ and $y$ are positive integers. begin q := 0 r := x while r ≥ y do begin r := r - y q := q + 1 end end The post condition that needs to be satisfied after the program terminates is $\{ r = qx + y \wedge r < y\}$ ... $\{ y = qx + r \wedge 0 < r < y\}$ $\{ q + 1 < r - y \wedge y > 0\}$
Consider the following pseudo code, where $x$ and $y$ are positive integers.begin q := 0 r := x while r ≥ y do begin r := r - y q := q + 1 end endThe post condition tha...
makhdoom ghaya
16.0k
views
makhdoom ghaya
asked
Feb 13, 2015
Programming in C
gatecse-2015-set1
programming
loop-invariants
normal
+
–
2
votes
2
answers
84
find the output
include <stdio.h> int main() { int a[][3] = {1, 2, 3, 4, 5, 6}; int (*ptr)[3] = a; printf("%d %d ", (*ptr)[1], (*ptr)[2]); ++ptr; printf("%d %d\n", (*ptr)[1], (*ptr)[2]); return 0; } (a) 2 3 5 6 (b) 2 3 4 5 (c) 4 5 0 0 (d) none of the above
include <stdio.h int main() { int a[][3] = {1, 2, 3, 4, 5, 6}; int (*ptr)[3] = a; printf("%d %d ", (*ptr) , (*ptr) ); ++ptr; printf("%d %d\n", (*ptr) , (*ptr) ); return 0...
Akriti sood
6.1k
views
Akriti sood
asked
Jan 11, 2017
Programming in C
programming-in-c
+
–
41
votes
5
answers
85
GATE CSE 2000 | Question: 1.11
The following C declarations: struct node { int i: float j; }; struct node *s[10]; define s to be: An array, each element of which is a pointer to a structure of type node A structure of $2$ ... $3$ fields: an integer, a float, and an array of $10$ elements An array, each element of which is a structure of type node
The following C declarations:struct node { int i: float j; }; struct node *s[10];define s to be:An array, each element of which is a pointer to a structure of type nodeA ...
Kathleen
19.4k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2000
programming
programming-in-c
easy
structure
+
–
3
votes
3
answers
86
UGC NET CSE | December 2014 | Part 2 | Question: 24
Consider an array $A\left[20, 10\right]$, assume $4$ words per memory cell and the base address of array $A$ is $100$. What is the address of $A\left[11, 5\right]$ ? Assume row major storage. $560$ $565$ $570$ $575$
Consider an array $A\left[20, 10\right]$, assume $4$ words per memory cell and the base address of array $A$ is $100$. What is the address of $A\left[11, 5\right]$ ? Assu...
makhdoom ghaya
19.7k
views
makhdoom ghaya
asked
Jul 21, 2016
Programming in C
ugcnetcse-dec2014-paper2
array
row-major-address-calculation
+
–
31
votes
4
answers
87
GATE IT 2008 | Question: 49
What is the output printed by the following C code? # include <stdio.h> int main () { char a [6] = "world"; int i, j; for (i = 0, j = 5; i < j; a [i++] = a [j--]); printf ("%s\n", a); } dlrow Null string dlrld worow
What is the output printed by the following C code?# include <stdio.h int main () { char a [6] = "world"; int i, j; for (i = 0, j = 5; i < j; a [i++] = a [j ]); printf ("...
Ishrat Jahan
9.8k
views
Ishrat Jahan
asked
Oct 28, 2014
Programming in C
gateit-2008
programming
programming-in-c
normal
array
+
–
44
votes
11
answers
88
GATE CSE 2016 Set 1 | Question: 35
What will be the output of the following $C$ program? void count (int n) { static int d=1; printf ("%d",n); printf ("%d",d); d++; if (n>1) count (n-1); printf ("%d",d); } void main(){ count (3); } $3 \ 1 \ 2 \ 2 \ 1 \ 3 \ 4 \ 4 \ 4$ $3 \ 1 \ 2 \ 1 \ 1 \ 1 \ 2 \ 2 \ 2$ $3 \ 1 \ 2 \ 2 \ 1 \ 3 \ 4$ $3 \ 1 \ 2 \ 1 \ 1 \ 1 \ 2$
What will be the output of the following $C$ program?void count (int n) { static int d=1; printf ("%d",n); printf ("%d",d); d++; if (n>1) count (n-1); printf ("%d",d); } ...
Sandeep Singh
15.8k
views
Sandeep Singh
asked
Feb 12, 2016
Programming in C
gatecse-2016-set1
programming-in-c
recursion
normal
+
–
8
votes
7
answers
89
ISRO2014-32
What is the output of the following C program? #include<stdio.h> void main(void){ int shifty; shifty=0570; shifty=shifty>>4; shifty=shifty<<6; printf("The value of shifty is %o \n",shifty); } The value of shifty is 15c0 The value of shifty is 4300 The value of shifty is 5700 The value of shifty is 2700
What is the output of the following C program?#include<stdio.h void main(void){ int shifty; shifty=0570; shifty=shifty>>4; shifty=shifty<<6; printf("The value of shifty i...
ajit
8.2k
views
ajit
asked
Sep 2, 2015
Programming in C
programming-in-c
isro2014
output
+
–
26
votes
5
answers
90
GATE CSE 2004 | Question: 90
Choose the best matching between the programming styles in Group 1 and their characteristics in Group 2. ... $P-3\quad Q-4 \quad R-1\quad S-2$ $P-3\quad Q-4\quad R-2\quad S-1$
Choose the best matching between the programming styles in Group 1 and their characteristics in Group 2.$$\begin{array}{|ll|ll|}\hline \rlap{\textbf{Group 1}} & & \rlap{...
Kathleen
7.1k
views
Kathleen
asked
Sep 18, 2014
Programming in C
gatecse-2004
programming
normal
programming-paradigms
match-the-following
+
–
44
votes
2
answers
91
GATE CSE 2011 | Question: 22
What does the following fragment of C program print? char c[] = "GATE2011"; char *p = c; printf("%s", p + p[3] - p[1]); $\text{GATE2011}$ $\text{E2011}$ $2011$ $011$
What does the following fragment of C program print?char c[] = "GATE2011"; char *p = c; printf("%s", p + p[3] - p );$\text{GATE2011}$$\text{E2011}$$2011$$011$
go_editor
20.7k
views
go_editor
asked
Sep 29, 2014
Programming in C
gatecse-2011
programming
programming-in-c
normal
array
+
–
19
votes
5
answers
92
GATE CSE 1989 | Question: 3-i
An unrestricted use of the "go to" statement is harmful because of which of the following reason (s): It makes it more difficult to verify programs. It makes programs more inefficient. It makes it more difficult to modify existing programs. It results in the compiler generating longer machine code.
An unrestricted use of the "go to" statement is harmful because of which of the following reason (s):It makes it more difficult to verify programs.It makes programs more ...
makhdoom ghaya
4.4k
views
makhdoom ghaya
asked
Nov 27, 2016
Programming in C
gate1989
normal
programming
goto
+
–
40
votes
5
answers
93
GATE CSE 2003 | Question: 73
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions. global int i=100, j=5; void P(x) { int i=10; print(x+10); i=200; j=20; print (x); } main() {P(i ... by need parameter passing mechanism, the values printed by the above program are: $115, 220$ $25, 220$ $25, 15$ $115, 105$
The following program fragment is written in a programming language that allows global variables and does not allow nested declarations of functions.global int i=100, j=5...
Kathleen
9.4k
views
Kathleen
asked
Sep 17, 2014
Programming in C
gatecse-2003
compiler-design
normal
runtime-environment
parameter-passing
+
–
74
votes
6
answers
94
GATE IT 2006 | Question: 51
Which one of the choices given below would be printed when the following program is executed? #include <stdio.h> int a1[] = {6, 7, 8, 18, 34, 67}; int a2[] = {23, 56, 28, 29}; int a3[] = {-12, 27, -31}; int *x[] = {a1, a2, a3}; void print(int *a[]) { printf("%d," ... (x); } $8, -12, 7, 23, 8$ $8, 8, 7, 23, 7$ $-12, -12, 27, -31, 23$ $-12, -12, 27, -31, 56$
Which one of the choices given below would be printed when the following program is executed? #include <stdio.h int a1[] = {6, 7, 8, 18, 34, 67}; int a2[] = {23, 5...
Ishrat Jahan
13.2k
views
Ishrat Jahan
asked
Oct 31, 2014
Programming in C
gateit-2006
programming
programming-in-c
normal
+
–
6
votes
3
answers
95
ISRO2014-38
How many lines of output does the following C code produce? #include<stdio.h> float i=2.0; float j=1.0; float sum = 0.0; main() { while (i/j > 0.001) { j+=j; sum=sum+(i/j); printf("%f\n", sum); } } 8 9 10 11
How many lines of output does the following C code produce?#include<stdio.h float i=2.0; float j=1.0; float sum = 0.0; main() { while (i/j 0.001) { j+=j; sum=sum+(i/j); ...
Sourabh Kumar
5.8k
views
Sourabh Kumar
asked
Jun 22, 2016
Programming in C
isro2014
programming-in-c
loop
output
+
–
25
votes
7
answers
96
GATE CSE 2017 Set 2 | Question: 54
Consider the following C program. #include<stdio.h> int main () { int m=10; int n, n1; n=++m; n1=m++; n--; --n1; n-=n1; printf(“%d”, n); return 0; } The output of the program is ______
Consider the following C program.#include<stdio.h int main () { int m=10; int n, n1; n=++m; n1=m++; n ; n1; n-=n1; printf(“%d”, n); return 0; }The output of the prog...
Madhav
12.2k
views
Madhav
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming-in-c
numerical-answers
easy
+
–
2
votes
2
answers
97
let x be an array of integer which of the following can not be present in the LHS of an assignment statement
let x be an array of integer . which of the following can not be present in the left hand side of an assignment statementa)x b) x+i c) * (x+i) d) &x[i]
Sanjay Sharma
2.7k
views
Sanjay Sharma
asked
Feb 18, 2017
41
votes
4
answers
98
GATE CSE 2015 Set 2 | Question: 15
Consider the following function written in the C programming langauge : void foo(char *a) { if (*a && *a != ' ') { foo(a+1); putchar(*a); } } The output of the above function on input "$ABCD \ EFGH$" is $ABCD \ EFGH$ $ABCD$ $HGFE \ DCBA$ $DCBA$
Consider the following function written in the C programming langauge :void foo(char *a) { if (*a && *a != ' ') { foo(a+1); putchar(*a); } }The output of the above func...
go_editor
14.7k
views
go_editor
asked
Feb 12, 2015
Programming in C
gatecse-2015-set2
programming
programming-in-c
normal
recursion
+
–
36
votes
6
answers
99
GATE CSE 2017 Set 2 | Question: 37
Consider the C program fragment below which is meant to divide $x$ by $y$ using repeated subtractions. The variables $x$, $y$, $q$ and $r$ are all unsigned int. while (r >= y) { r=r-y; q=q+1; } Which of the following conditions on the variables $x, y, q$ and $r$ ... $(q==0) \ \&\& \ (y>0)$
Consider the C program fragment below which is meant to divide $x$ by $y$ using repeated subtractions. The variables $x$, $y$, $q$ and $r$ are all unsigned int.while (r >...
Arjun
14.9k
views
Arjun
asked
Feb 14, 2017
Programming in C
gatecse-2017-set2
programming
loop-invariants
+
–
35
votes
5
answers
100
GATE CSE 2005 | Question: 81b
double foo(int n) { int i; double sum; if(n == 0) { return 1.0; } else { sum = 0.0; for(i = 0; i < n; i++) { sum += foo(i); } return sum; } } Suppose we modify the above function $foo()$ ... time complexity for function $foo()$ is significantly reduced. The space complexity of the modified function would be: $O(1)$ $O(n)$ $O(n^2)$ $n!$
double foo(int n) { int i; double sum; if(n == 0) { return 1.0; } else { sum = 0.0; for(i = 0; i < n; i++) { sum += foo(i); } return sum; } }Suppose we modify the above f...
go_editor
11.1k
views
go_editor
asked
Nov 14, 2016
Programming in C
gatecse-2005
programming
recursion
normal
+
–
Page:
« prev
1
2
3
4
5
6
7
8
9
10
...
206
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register