Webpage

Programming in C. Recursion.

$$\scriptsize{\overset{{\large{\textbf{Mark Distribution in Previous GATE}}}}{\begin{array}{|c|c|c|c|c|c|c|c|}\hline
\textbf{Year} &\textbf{2024-1}&\textbf{2024-2}&\textbf{2023}& \textbf{2022}&\textbf{2021-1}&\textbf{2021-2}&\textbf{Minimum}&\textbf{Average}&\textbf{Maximum}
\\\hline\textbf{1 Mark Count} & 2&2&1&1 &0&2&0&1.33&2
\\\hline\textbf{2 Marks Count} &1&1&0& 2&2&2&0&1.33&2
\\\hline\textbf{Total Marks} &4&4&1& 5&4&6&\bf{1}&\bf{4}&\bf{6}\\\hline
\end{array}}}$$

Recent questions in Programming

#3761
5.3k
views
1 answers
7 votes
Early binding refers to a binding performed at compile time and late binding refers to a binding performed at execution time. Consider the following ... , increase, decreaseLate, early, decrease, increaseEarly, late, increase, decrease
#3762
7.8k
views
3 answers
15 votes
Consider the program below in a hypothetical programming language which allows global variables and a choice of static or dynamic scoping.int i; program main() { i = 10; call f(); } procedure ... x=10, y=20$x=20, y=10$x=10, y=10$x=20, y=20$
#3763
11.3k
views
5 answers
33 votes
Consider the C program given below : #include <stdio.h> int main () { int sum = 0, maxsum = 0, i, n = 6; int a [] = {2, -2, -1, 3, 4, 2}; for ( ... $8$7$6$
#3764
13.4k
views
5 answers
49 votes
The function f is defined as follows:int f (int n) { if (n <= 1) return 1; else if (n % 2 == 0) return f(n/2); else return f(3n - 1); } ... .Which one of the following options is true of the above?i and iiii and ivii and iiiii and iv
#3765
10.9k
views
2 answers
43 votes
C program is given below:# include <stdio.h> int main () { int i, j; char a [2] [3] = {{'a', 'b', 'c'}, {'d', 'e', 'f'}}; char b [3] [2]; char *p = *b; for (i = ... $\text{d f}$ $\text{a e}$\text{d c}$\text{b f}$
#3766
15.4k
views
3 answers
65 votes
Consider the C program given below. What does it print?#include <stdio.h> int main () { int i, j; int a [8] = {1, 2, 3, 4, 5, 6, 7, 8}; for(i = 0; i < 3; i++) { a[i] = a[i ... $2, 4$3, 2$3, 3$
#3767
11.0k
views
4 answers
24 votes
Consider the C program below. What does it print?# include <stdio.h> # define swapl (a, b) tmp = a; a = b; b = tmp void swap2 ( int a, int b) { int tmp; tmp = a; a = ... $5, 4$4, 5$4, 4$
#3768
10.1k
views
4 answers
31 votes
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); }dlrowNull stringdlrldworow
#3769
5.8k
views
2 answers
12 votes
Match the programming paradigms and languages given in the following table. Paradigms Languages(I)Imperative(a)Prolog(II)Object Oriented(b)Lisp(III)Functional(c)C, Fortran 77, Pascal(IV)Logic(d ... d, II-c, III-b, IV-aI-c, II-d, III-a, IV-b
#3770
1.6k
views
1 answers
3 votes
Consider the following program in pseudo-Pascal syntax. What is printed by the program if parameter $a$ in procedure $\text{test1}$ is passed ascall-by-reference parametercall-by- ... (*Example*) b:=3; test1(b); writeln('point3: ', b); end
#3771
5.6k
views
3 answers
21 votes
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 ... :=A+B Y :=abs(A-B); W :=A-B Z :=A*B end;
#3772
1.9k
views
1 answers
1 votes
Consider the program below:Program main: var r:integer; procedure two: begin write (r); end procedure one: var r:integer; begin r:=5; two; end ... for all variables;Dynamic scoping is assumed for all variables.Give reasons for your answer.
#3773
25.9k
views
3 answers
38 votes
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) ... maximum value of $n$ for which the stack will not overflow. Give reasons for your answer.
#3774
4.0k
views
2 answers
22 votes
An unrestricted use of the "$goto$" statement is harmful becauseit makes it more difficult to verify programsit increases the running time of the ... memory required for the programsit results in the compiler generating longer machine code
#3775
2.2k
views
1 answers
4 votes
Consider the following program in Pseudo-Pascal syntax.program what: var z: integer procedure recur(x): begin if x <= 40 then begin x:x+z recur(x); z ... ; called?What value is printed by the program if the parameter is passed by reference?
#3776
10.0k
views
3 answers
38 votes
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$
#3777
14.3k
views
4 answers
45 votes
Consider the following C code segment.int a, b, c = 0; void prtFun(void); main() { static int a = 1; /* Line 1 */ prtFun(); a += 1; prtFun(); printf( \n %d %d , a, b); } void ...
#3778
21.0k
views
2 answers
44 votes
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$
#3779
9.2k
views
4 answers
41 votes
Consider the C function given below.int f(int j) { static int i = 50; int k; if (i == j) { printf("something"); k = f(i); return 0; } else ... $j = 50$.
#3780
19.9k
views
4 answers
61 votes
Consider the following function.double f(double x){ if( abs(x*x - 3) < 0.01) return x; else return f(x/2 + 1.5/x); }Give a value $q$ (to $2$ decimals) such that $f(q)$ will return $q$:_____.