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
Most answered questions in Programming in C
21
votes
3
answers
181
GATE CSE 1995 | Question: 3
Consider the following high level programming segment. Give the contents of the memory locations for variables $W, X, Y$ and $Z$ after the execution of the program segment. The values of the variables $A$ and $B$ are $5CH$ and $92H$, respectively. Also indicate error conditions if ... integer is represented by two bytes) begin X :=A+B Y :=abs(A-B); W :=A-B Z :=A*B end;
Consider the following high level programming segment. Give the contents of the memory locations for variables $W, X, Y$ and $Z$ after the execution of the program segmen...
Kathleen
5.5k
views
Kathleen
asked
Oct 8, 2014
Programming in C
gate1995
programming
identify-function
descriptive
+
–
37
votes
3
answers
182
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
+
–
37
votes
3
answers
183
GATE CSE 2010 | Question: 11
What does the following program print? #include<stdio.h> void f(int *p, int *q) { p=q; *p=2; } int i=0, j=1; int main() { f(&i, &j); printf("%d %d\n", i,j); return 0; } $2 \ 2$ $2 \ 1$ $0 \ 1$ $0 \ 2$
What does the following program print?#include<stdio.h void f(int *p, int *q) { p=q; *p=2; } int i=0, j=1; int main() { f(&i, &j); printf("%d %d\n", i,j); return 0; }$2 \...
go_editor
9.8k
views
go_editor
asked
Sep 29, 2014
Programming in C
gatecse-2010
programming
programming-in-c
easy
parameter-passing
+
–
25
votes
3
answers
184
GATE CSE 1998 | Question: 2.13
What is the result of the following program? program side-effect (input, output); var x, result: integer; function f (var x:integer):integer; begin x:x+1;f:=x; end begin x:=5; result:=f(x)*f(x); writeln(result); end $5$ $25$ $36$ $42$
What is the result of the following program?program side-effect (input, output); var x, result: integer; function f (var x:integer):integer; begin x:x+1;f:=x; end begin x...
Kathleen
7.2k
views
Kathleen
asked
Sep 25, 2014
Programming in C
gate1998
programming
normal
identify-function
+
–
13
votes
3
answers
185
GATE CSE 2005 | Question: 3, UGCNET-June2012-III: 15
A common property of logic programming languages and functional languages is: both are procedural languages both are based on $\lambda$-calculus both are declarative both use Horn-clauses
A common property of logic programming languages and functional languages is:both are procedural languages both are based on $\lambda$-calculusboth are declarativeboth us...
Kathleen
12.5k
views
Kathleen
asked
Sep 22, 2014
Programming in C
gatecse-2005
programming
normal
ugcnetcse-june2012-paper3
programming-paradigms
non-gate
+
–
28
votes
3
answers
186
GATE CSE 2004 | Question: 31, ISRO2008-40
Consider the following C function: int f(int n) { static int i = 1; if(n >= 5) return n; n = n+i; i++; return f(n); } The value returned by $f(1)$ is: $5$ $6$ $7$ $8$
Consider the following C function:int f(int n) { static int i = 1; if(n >= 5) return n; n = n+i; i++; return f(n); }The value returned by $f(1)$ is:$5$$6$$7$$8$
Kathleen
14.8k
views
Kathleen
asked
Sep 18, 2014
Programming in C
gatecse-2004
programming
programming-in-c
recursion
easy
isro2008
+
–
35
votes
3
answers
187
GATE CSE 2002 | Question: 2.18
The C language is: A context free language A context sensitive language A regular language Parsable fully only by a Turing machine
The C language is:A context free languageA context sensitive languageA regular languageParsable fully only by a Turing machine
Kathleen
10.4k
views
Kathleen
asked
Sep 15, 2014
Programming in C
gatecse-2002
programming
programming-in-c
normal
+
–
62
votes
3
answers
188
GATE CSE 2001 | Question: 2.18
Consider the following three C functions: $[P1]$ int *g(void) { int x = 10; return (&x); } $[P2]$ int *g(void) { int *px; *px = 10; return px; } $[P3]$ int *g(void) { int *px; px = (int*) malloc (sizeof(int)); *px = 10; ... of the above three functions are likely to cause problems with pointers? Only $P3$ Only $P1$ and $P3$ Only $P1$ and $P2$ $P1, P2$ and $P3$
Consider the following three C functions:$[P1]$ int *g(void) { int x = 10; return (&x); }$[P2]$ int *g(void) { int *px; *px = 10; return px; }$[P3]$ int *g(void) { int *p...
Kathleen
24.7k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2001
programming
programming-in-c
normal
pointers
+
–
26
votes
3
answers
189
GATE CSE 2000 | Question: 16
A recursive program to compute Fibonacci numbers is shown below. Assume you are also given an array $f [ 0\ldots m]$ with all elements initialized to $0.$ fib(n) { if (n > M) error (); if (n == 0) return 1; if (n = ... Write the box number and the corresponding contents in your answer book. What is the time complexity of the resulting program when computing $fib(n)?$
A recursive program to compute Fibonacci numbers is shown below. Assume you are also given an array $f [ 0\ldots m]$ with all elements initialized to $0.$fib(n) { if (n ...
Kathleen
4.9k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2000
algorithms
normal
descriptive
recursion
+
–
52
votes
3
answers
190
GATE CSE 2000 | Question: 1.12
The most appropriate matching for the following pairs ... $X - 3 \ \ Y - 2 \ \ Z - 1$ $X - 3 \ \ Y - 1 \ \ Z - 2$
The most appropriate matching for the following pairs$$\begin{array}{|ll|ll|}\hline X: & \text{m = malloc(5); m = NULL;} & 1: & \text{using dangling pointers} \\\hline Y...
Kathleen
12.1k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2000
programming
programming-in-c
easy
match-the-following
pointers
+
–
24
votes
3
answers
191
GATE CSE 1991 | Question: 1,vi
Consider the following PASCAL program segment: if i mod 2 = 0 then while i >= 0 do begin i := i div 2; if i mod 2 < > 0 then i := i - 1; else i := i – 2; end; An appropriate loop-invariant for the while-loop is ________
Consider the following PASCAL program segment:if i mod 2 = 0 then while i >= 0 do begin i := i div 2; if i mod 2 < 0 then i := i - 1; else i := i – 2; end;An appropria...
Kathleen
4.6k
views
Kathleen
asked
Sep 12, 2014
Programming in C
gate1991
programming
loop-invariants
normal
fill-in-the-blanks
+
–
26
votes
3
answers
192
GATE CSE 2008 | Question: 18
Which combination of the integer variables $x, y,$ and $z$ makes the variable $a$ get the value $4$ in the following expression? $a=(x > y)?((x > z) ?x:z): ((y > z) ?y:z)$ $x=3, y=4, z=2$ $x=6, y=5, z=3$ $x=6, y=3, z=5$ $x=5, y=4, z=5$
Which combination of the integer variables $x, y,$ and $z$ makes the variable $a$ get the value $4$ in the following expression?$$a=(x y)?((x z) ?x:z): ((y z) ?y:z)$$$...
Kathleen
12.7k
views
Kathleen
asked
Sep 11, 2014
Programming in C
gatecse-2008
programming
programming-in-c
easy
+
–
1
votes
2
answers
193
Test series question of ace academy
#include<stdio.h> #define ADD(a,b)(a+b) #define SQUARE(x)(x*x) int main() { int x=2; int y=3; int z = ADD(SQUARE(x++),y); printf("%d\n",z); return 0; } What is the output of the above code snippet?
#include<stdio.h>#define ADD(a,b)(a+b)#define SQUARE(x)(x*x)int main(){int x=2;int y=3;int z = ADD(SQUARE(x++),y);printf("%d\n",z);return 0;}What is the output of the abo...
Ayush_Pal
201
views
Ayush_Pal
asked
Apr 26
Programming in C
ace-test-series
+
–
0
votes
2
answers
194
C Programming - Arrays & Pointer (NAT)
#include <stdio.h> int main() { int a[3][2] = {1, 3, 5, 7, 9, 11}; int *ptr = a[0]; ptr += sizeof(int); printf("%d", *ptr); return 0; } (Assume size of int to be $2$ bytes.) The output is __________.
#include <stdio.h int main() { int a[3] = {1, 3, 5, 7, 9, 11}; int *ptr = a[0]; ptr += sizeof(int); printf("%d", *ptr); return 0; }(Assume size of int to be $2$ bytes.)T...
Debargha Mitra Roy
174
views
Debargha Mitra Roy
asked
Apr 16
Programming in C
array
data-structures
programming-in-c
+
–
0
votes
2
answers
195
C Programming - Recursion
What is the output of the below code? #include <stdio.h> void main() { static int var = 5; printf("%d ", var--); if (var) main(); } a. 1 2 3 4 5 b. 1 c. 5 4 3 2 1 d. Error
What is the output of the below code?#include <stdio.h void main() { static int var = 5; printf("%d ", var ); if (var) main(); }a. 1 2 3 4 5b. 1c. 5 4 3 2 1d. Error
Debargha Mitra Roy
192
views
Debargha Mitra Roy
asked
Apr 10
Programming in C
recursion
programming-in-c
programming
+
–
5
votes
2
answers
196
GATE CSE 2024 | Set 2 | Question: 3
Consider the following $\text{C}$ program. Assume parameters to a function are evaluated from right to left. #include <stdio.h> int g( int p) { printf("%d", p); return p; } int h(i nt q) { printf("%d", q) ... one of the following options is the CORRECT output of the above $\text{C}$ program? $20101020$ $10202010$ $20102010$ $10201020$
Consider the following $\text{C}$ program. Assume parameters to a function are evaluated from right to left.#include <stdio.h int g( int p) { printf("%d", p); return p; }...
Arjun
4.3k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
functions
+
–
7
votes
2
answers
197
GATE CSE 2024 | Set 2 | Question: 23
Consider the following $\mathrm{C}$ function definition. int f X(char * a) { char * b = a; while (*b) b ++; return b - a; } Which of the following statements is/are TRUE? The function call $\text{f X("a b c d''}$) will ... ${ }^{*} \mathrm{C}=$ "abcd" in main (), the function call $\mathrm{fX}(\mathrm{c})$ will always return a value
Consider the following $\mathrm{C}$ function definition.int f X(char * a) { char * b = a; while (*b) b ++; return b - a; }Which of the following statements is/ar...
Arjun
2.7k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set2
programming
programming-in-c
multiple-selects
output
+
–
2
votes
2
answers
198
GATE CSE 2024 | Set 1 | Question: 38
Consider the following $\mathrm{C}$ ... the return value is less than $2^{10}$ If the inputs are $x=10, y=20$, then the return value is greater than $2^{20}$
Consider the following $\mathrm{C}$ function definition.int f (int x, int y){ for (int i=0 ; i<y ; i++ ) { x= x + x + y; } return x; }Which of the following stateme...
Arjun
2.5k
views
Arjun
asked
Feb 16
Programming in C
gatecse2024-set1
multiple-selects
programming
programming-in-c
+
–
6
votes
2
answers
199
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 27
What is a statically allocated variable in C programming? A variable allocated at an absolute address in a program’s data space A variable allocated on the stack A variable allocated on the heap A variable which can NOT be defined as local variable
What is a statically allocated variable in C programming? A variable allocated at an absolute address in a program’s data spaceA variable allocated on the stackA variab...
GO Classes
430
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
storage-classes-in-c
1-mark
+
–
7
votes
2
answers
200
GO Classes Test Series 2024 | Mock GATE | Test 14 | Question: 33
On a $64$-bit system, which of the following C expressions is equivalent to the C expression $(x[2]+4)[3]?$ Assume $\mathrm{x}$ is declared as $\textsf{int}\ast \ast \textsf{x}$ $\ast((*(x+16))+28)$ $\ast((*(x+2))+7)$ $\ast(((* x)+2)+7)$ $(* \ast(x+2)+7)$
On a $64$-bit system, which of the following C expressions is equivalent to the C expression $(x +4)[3]?$ Assume $\mathrm{x}$ is declared as $\textsf{int}\ast \ast \text...
GO Classes
484
views
GO Classes
asked
Feb 5
Programming in C
goclasses2024-mockgate-14
programming
programming-in-c
pointers
1-mark
+
–
Page:
« prev
1
...
5
6
7
8
9
10
11
12
13
14
15
...
206
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register