Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Webpage for Programming:
Recent questions tagged programming
35
votes
2
answers
871
GATE IT 2004 | Question: 59
What is the output of the following program? #include<stdio.h> int funcf (int x); int funcg (int y); main () { int x = 5, y = 10, count; for (count = 1; count <= 2; ++count) { y += funcf(x) + funcg(x); printf ("%d", y); } } funcf (int x) { int y; y ... funcg (int x) { static int y = 10; y += 1; return (y + x); } $43 \ 80$ $42 \ 74$ $33 \ 37$ $32 \ 32$
What is the output of the following program?#include<stdio.h int funcf (int x); int funcg (int y); main () { int x = 5, y = 10, count; for (count = 1; count <= 2; ++count...
Ishrat Jahan
9.7k
views
Ishrat Jahan
asked
Nov 2, 2014
Programming in C
gateit-2004
programming
programming-in-c
normal
+
–
30
votes
3
answers
872
GATE IT 2004 | Question: 58
Consider the following C program which is supposed to compute the transpose of a given $4 \times 4$ matrix $M$. Note that, there is an $X$ in the program which indicates some missing statements. Choose the correct option to replace $X$ in the program. #include<stdio.h> #define ROW 4 #define COL 4 ... j < 4; ++j){ M[i][j] = t; t = M[j][i]; M[j][i] = M[i][j]; }
Consider the following C program which is supposed to compute the transpose of a given $4 \times 4$ matrix $M$. Note that, there is an $X$ in the program which indicates ...
Ishrat Jahan
12.4k
views
Ishrat Jahan
asked
Nov 2, 2014
Programming in C
gateit-2004
programming
easy
programming-in-c
array
+
–
29
votes
3
answers
873
GATE IT 2004 | Question: 15
Let $x$ be an integer which can take a value of $0$ or $1$. The statement if (x == 0) x = 1; else x = 0; is equivalent to which one of the following ? $x = 1 + x;$ $x = 1 - x;$ $x = x - 1;$ $x = 1\% x;$
Let $x$ be an integer which can take a value of $0$ or $1$. The statementif (x == 0) x = 1; else x = 0;is equivalent to which one of the following ?$x = 1 + x;$$x = 1 - ...
Ishrat Jahan
9.9k
views
Ishrat Jahan
asked
Nov 1, 2014
Programming in C
gateit-2004
programming
easy
identify-function
+
–
6
votes
2
answers
874
GATE IT 2006 | Question: 53
Match the following concepts and their best possible descriptions. Concept Description i. overloading a. allows to define a class to have properties of another class ii. friend b. defining a set of similar functions iii. constructor c. used in dereferencing iv. protected d. used to give a non-member ... , ii-f, iii-h, iv-a, v-g, vi-d i-b, ii-e, iii-c, iv-f, v-g, vi-s
Match the following concepts and their best possible descriptions. Concept Descriptioni.overloadinga.allows to define a class to have properties of another classii.friend...
Ishrat Jahan
4.7k
views
Ishrat Jahan
asked
Oct 31, 2014
Object Oriented Programming
gateit-2006
programming
match-the-following
object-oriented-programming
non-gate
+
–
74
votes
6
answers
875
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.1k
views
Ishrat Jahan
asked
Oct 31, 2014
Programming in C
gateit-2006
programming
programming-in-c
normal
+
–
85
votes
6
answers
876
GATE IT 2006 | Question: 50
Which one of the choices given below would be printed when the following program is executed? #include <stdio.h> void swap (int *x, int *y) { static int *temp; temp = x; x = y; y = temp; } void printab () { static int i, a = -3, b = -6; i = 0; while (i <= 4) { if ((i++)%2 == 1 ... $a = 12, b = 9$ $a = 3, b = 6$ $a = 3, b = 6$ $a = 6, b = 3$ $a = 15, b = 12$
Which one of the choices given below would be printed when the following program is executed?#include <stdio.h void swap (int *x, int *y) { static int *temp; temp = x; x ...
Ishrat Jahan
25.8k
views
Ishrat Jahan
asked
Oct 31, 2014
Programming in C
gateit-2006
programming
programming-in-c
normal
parameter-passing
+
–
101
votes
6
answers
877
GATE IT 2006 | Question: 49
Which one of the choices given below would be printed when the following program is executed ? #include <stdio.h> struct test { int i; char *c; }st[] = {5, "become", 4, "better", 6, "jungle", 8, "ancestor", 7, " ... $\text{etter, u, 6, ungle}$ $\text{cetter, k, 6, jungle}$ $\text{etter, u, 8, ncestor}$
Which one of the choices given below would be printed when the following program is executed ?#include <stdio.h struct test { int i; char *c; }st[] = {5, "become", 4, "be...
Ishrat Jahan
27.3k
views
Ishrat Jahan
asked
Oct 31, 2014
Programming in C
gateit-2006
programming
programming-in-c
normal
structure
+
–
7
votes
1
answer
878
GATE IT 2007 | Question: 35
Early binding refers to a binding performed at compile time and late binding refers to a binding performed at execution time. Consider the following statements: Static scope facilitates w1 bindings. Dynamic scope requires w2 bindings. Early bindings w3 ... , decrease, increase Late, early, increase, decrease Late, early, decrease, increase Early, late, increase, decrease
Early binding refers to a binding performed at compile time and late binding refers to a binding performed at execution time. Consider the following statements:Static sco...
Ishrat Jahan
5.2k
views
Ishrat Jahan
asked
Oct 29, 2014
Programming in C
gateit-2007
programming
variable-binding
normal
out-of-syllabus-now
+
–
15
votes
3
answers
879
GATE IT 2007 | Question: 34, UGCNET-Dec2012-III: 52
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 f() { int i = 20; call g (); } procedure g() { print i; } Let $x$ be the ... . Then, $x$ and $y$ are: $x=10, y=20$ $x=20, y=10$ $x=10, y=10$ $x=20, y=20$
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; ...
Ishrat Jahan
7.6k
views
Ishrat Jahan
asked
Oct 29, 2014
Programming in C
gateit-2007
programming
variable-binding
easy
ugcnetcse-dec2012-paper3
+
–
25
votes
1
answer
880
GATE IT 2007 | Question: 33
Consider the program below in a hypothetical language which allows global variable and a choice of call by reference or call by value methods of parameter passing. int i ; program main () { int j = 60; i = 50; call f (i, j); print i, j; } procedure f (x, y) { i = 100; x ... :$ i = 100, j = 60$ Call by value : $i = 100, j = 60$; Call by reference :$ i = 10, j = 70$
Consider the program below in a hypothetical language which allows global variable and a choice of call by reference or call by value methods of parameter passing. ...
Ishrat Jahan
8.6k
views
Ishrat Jahan
asked
Oct 29, 2014
Compiler Design
gateit-2007
programming
parameter-passing
normal
compiler-design
runtime-environment
+
–
32
votes
5
answers
881
GATE IT 2007 | Question: 31
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 (i = 0; i < n; i++) { if (i == 0 || a [i] < 0 || a [i] < a [ ... } if (sum > maxsum) maxsum = sum ; printf ("%d\n", maxsum); } What is the value printed out when this program is executed? $9$ $8$ $7$ $6$
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 (i = 0; i < n; i++) { if (i =...
Ishrat Jahan
11.0k
views
Ishrat Jahan
asked
Oct 29, 2014
Programming in C
gateit-2007
programming
programming-in-c
normal
+
–
49
votes
5
answers
882
GATE IT 2007 | Question: 27
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); } Assuming that arbitrarily large integers can be passed as a parameter to the function, consider the following ... values of $n \geq 1$. Which one of the following options is true of the above? i and iii i and iv ii and iii ii and iv
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); }Assuming that arbitrarily large int...
Ishrat Jahan
13.2k
views
Ishrat Jahan
asked
Oct 29, 2014
Programming in C
gateit-2007
programming
recursion
normal
+
–
42
votes
2
answers
883
GATE IT 2008 | Question: 52
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 = 0; i < 2; i++) { for (j = 0; j < ... $\text{b e}$ $\text{c f}$ $\text{a c}$ $\text{e b}$ $\text{d f}$ $\text{a e}$ $\text{d c}$ $\text{b f}$
C program is given below:# include <stdio.h int main () { int i, j; char a [3] = {{'a', 'b', 'c'}, {'d', 'e', 'f'}}; char b [3] ; char *p = *b; for (i = 0; i < 2; i++)...
Ishrat Jahan
10.6k
views
Ishrat Jahan
asked
Oct 28, 2014
Programming in C
gateit-2008
programming
programming-in-c
normal
array
+
–
65
votes
3
answers
884
GATE IT 2008 | Question: 51
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] + 1; i++; } i--; for (j = 7; j > 4; j--) { int i = j/2; a[i] = a[i] - 1; } printf ("%d, %d", i, a[i]); } $2, 3$ $2, 4$ $3, 2$ $3, 3$
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...
Ishrat Jahan
15.1k
views
Ishrat Jahan
asked
Oct 28, 2014
Programming in C
gateit-2008
programming
programming-in-c
normal
array
+
–
23
votes
4
answers
885
GATE IT 2008 | Question: 50
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 = b; b = tmp; } void swap3 (int*a, int*b) { int tmp; tmp = *a; *a = *b; *b ... (num1 > = num2) {swap3 (&num1, &num2);} printf ("%d, %d", num1, num2); } $5, 5$ $5, 4$ $4, 5$ $4, 4$
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 = b; b ...
Ishrat Jahan
10.6k
views
Ishrat Jahan
asked
Oct 28, 2014
Programming in C
gateit-2008
programming
programming-in-c
easy
parameter-passing
+
–
30
votes
4
answers
886
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.7k
views
Ishrat Jahan
asked
Oct 28, 2014
Programming in C
gateit-2008
programming
programming-in-c
normal
array
+
–
12
votes
2
answers
887
GATE IT 2008 | Question: 13
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) C++, Smalltalk, Java I-c, II-d, III-b, IV-a I-a, II-d, III-c, IV-b I-d, II-c, III-b, IV-a I-c, II-d, III-a, IV-b
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, Fortra...
Ishrat Jahan
5.7k
views
Ishrat Jahan
asked
Oct 27, 2014
Programming in C
gateit-2008
programming
programming-paradigms
easy
out-of-syllabus-now
+
–
3
votes
1
answer
888
GATE CSE 1996 | Question: 19
Consider the following program in pseudo-Pascal syntax. What is printed by the program if parameter $a$ in procedure $\text{test1}$ is passed as call-by-reference parameter call-by-value-result parameter program Example (input, output) var b: integer; procedure test2: begin b ... ', a, b); end begin (*Example*) b:=3; test1(b); writeln('point3: ', b); end
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 paramete...
Kathleen
1.5k
views
Kathleen
asked
Oct 9, 2014
Programming in C
gate1996
programming
parameter-passing
normal
out-of-syllabus-now
+
–
21
votes
3
answers
889
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.4k
views
Kathleen
asked
Oct 8, 2014
Programming in C
gate1995
programming
identify-function
descriptive
+
–
1
votes
1
answer
890
GATE CSE 1994 | Question: 22
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 begin r:=2; two; one; two; end What is printed by the above program if Static scoping is assumed for all variables; Dynamic scoping is assumed for all variables. Give reasons for your answer.
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 begin r:=2; two; one; two; ...
Kathleen
1.9k
views
Kathleen
asked
Oct 5, 2014
Programming in C
gate1994
programming
variable-binding
normal
out-of-gate-syllabus
+
–
37
votes
3
answers
891
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.7k
views
Kathleen
asked
Oct 5, 2014
Programming in C
gate1994
programming
recursion
normal
descriptive
+
–
22
votes
2
answers
892
GATE CSE 1994 | Question: 1.5
An unrestricted use of the "$goto$" statement is harmful because it makes it more difficult to verify programs it increases the running time of the programs it increases the memory required for the programs it results in the compiler generating longer machine code
An unrestricted use of the "$goto$" statement is harmful becauseit makes it more difficult to verify programsit increases the running time of the programsit increases the...
Kathleen
3.9k
views
Kathleen
asked
Oct 4, 2014
Programming in C
gate1994
programming
easy
goto
+
–
4
votes
1
answer
893
GATE CSE 1997 | Question: 10
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:=x+10 end end(*recur*) begin(*what*) z=10; recur(z); writeln(z) end ... by program? How many times is ‘recur’ called? What value is printed by the program if the parameter is passed by reference?
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:=x+10 end end(*recur...
Kathleen
2.1k
views
Kathleen
asked
Sep 29, 2014
Programming in C
gate1997
programming
parameter-passing
normal
out-of-syllabus-now
+
–
37
votes
3
answers
894
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
+
–
45
votes
4
answers
895
GATE CSE 2012 | Question: 48
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 prtFun(void) { static int a = 2; /* Line 2 */ int b = 1; a += + ... $\begin{array}{lll} 3 & & 1 & \\ 5 & & 2 & \\ 5 & & 2 & \end{array}$
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, ...
gatecse
14.0k
views
gatecse
asked
Sep 29, 2014
Programming in C
gatecse-2012
programming
programming-in-c
normal
+
–
43
votes
2
answers
896
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.6k
views
go_editor
asked
Sep 29, 2014
Programming in C
gatecse-2011
programming
programming-in-c
normal
array
+
–
41
votes
4
answers
897
GATE CSE 2014 Set 2 | Question: 42
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 return 0; } Which one of the following is TRUE? The function returns $0$ for all ... . The function returns $0$ when $j = 50$. The function will exhaust the runtime stack or run into an infinite loop when $j = 50$.
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 return 0; }Which one of the fol...
go_editor
9.0k
views
go_editor
asked
Sep 28, 2014
Programming in C
gatecse-2014-set2
programming
programming-in-c
+
–
59
votes
4
answers
898
GATE CSE 2014 Set 2 | Question: 40
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$:_____.
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)$ wi...
go_editor
19.5k
views
go_editor
asked
Sep 28, 2014
Programming in C
gatecse-2014-set2
programming
recursion
numerical-answers
normal
+
–
131
votes
4
answers
899
GATE CSE 2014 Set 2 | Question: 11
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set $p$ to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set $p$ correctly? $p = n * (n-1) * (n-2) / 6;$ $p = n * (n-1) / 2 * (n-2) / 3;$ $p = n * (n-1) / 3 * (n-2) / 2;$ $p = n * (n-1) * (n-2) / 6.0;$
Suppose $n$ and $p$ are unsigned int variables in a C program. We wish to set $p$ to $^nC_3$. If $n$ is large, which one of the following statements is most likely to set...
go_editor
15.8k
views
go_editor
asked
Sep 28, 2014
Programming in C
gatecse-2014-set2
programming
programming-in-c
normal
+
–
78
votes
4
answers
900
GATE CSE 2006 | Question: 57
Consider this C code to swap two integers and these five statements: the code void swap (int *px, int *py) { *px = *px - *py; *py = *px + *py; *px = *py - *px; } S1: will generate a compilation error S2: may generate a ... procedure correctly for some but not all valid input pointers S5: may add or subtract integers and pointers S1 S2 and S3 S2 and S4 S2 and S5
Consider this C code to swap two integers and these five statements: the codevoid swap (int *px, int *py) { *px = *px - *py; *py = *px + *py; *px = *py - *px; }S1...
Rucha Shelke
21.1k
views
Rucha Shelke
asked
Sep 26, 2014
Programming in C
gatecse-2006
programming
programming-in-c
normal
pointers
+
–
Page:
« prev
1
...
25
26
27
28
29
30
31
32
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register