Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Parameter Passing Material
Recent questions tagged parameter-passing
7
votes
1
answer
31
GATE CSE 1992 | Question: 10b
Show the activation records and the display structure just after the procedures called at lines marked $x$ and $y$ have started their execution. Be sure to indicate which of the two procedures named $A$ you are referring to. Program Test; Procedure A; Procedure B; Procedure A; begin …… end A; begin y: A; end B; begin B; end A; begin x: A; end Test
Show the activation records and the display structure just after the procedures called at lines marked $x$ and $y$ have started their execution. Be sure to indicate which...
go_editor
1.6k
views
go_editor
asked
Apr 24, 2016
Programming in C
gate1992
parameter-passing
programming
runtime-environment
normal
descriptive
+
–
43
votes
5
answers
32
GATE CSE 2003 | Question: 74
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 name 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...
go_editor
12.9k
views
go_editor
asked
Apr 24, 2016
Compiler Design
gatecse-2003
programming
compiler-design
parameter-passing
runtime-environment
normal
+
–
69
votes
4
answers
33
GATE CSE 2016 Set 1 | Question: 36
What will be the output of the following pseudo-code when parameters are passed by reference and dynamic scoping is assumed? a = 3; void n(x) { x = x * a; print (x); } void m(y) { a = 1 ; a = y - a; n(a); print (a); } void main () { m(a); } $6,2$ $6,6$ $4,2$ $4,4$
What will be the output of the following pseudo-code when parameters are passed by reference and dynamic scoping is assumed? a = 3; void n(x) { x = x * a; ...
Sandeep Singh
24.0k
views
Sandeep Singh
asked
Feb 12, 2016
Compiler Design
gatecse-2016-set1
parameter-passing
normal
+
–
58
votes
3
answers
34
GATE CSE 2016 Set 1 | Question: 15
Consider the following C program. # include <stdio.h> void mystery (int *ptra, int *ptrb) { int *temp; temp = ptrb; ptrb =ptra; ptra = temp; } int main () { int a = 2016, b=0, c= 4, d = 42; mystery (&a, &b); if (a < c) mystery (&c, &a); mystery (&a, &d); printf("%d\n", a); } The output of the program is _________.
Consider the following C program.# include <stdio.h void mystery (int *ptra, int *ptrb) { int *temp; temp = ptrb; ptrb =ptra; ptra = temp; } int main () { int a...
Sandeep Singh
18.1k
views
Sandeep Singh
asked
Feb 12, 2016
Programming in C
gatecse-2016-set1
programming-in-c
easy
numerical-answers
parameter-passing
+
–
29
votes
7
answers
35
GATE CSE 2016 Set 2 | Question: 12
The value printed by the following program is _______. void f (int * p, int m) { m = m + 5; *p = *p + m; return; } void main () { int i=5, j=10; f (&i, j); printf ("%d", i+j); }
The value printed by the following program is _______.void f (int * p, int m) { m = m + 5; *p = *p + m; return; } void main () { int i=5, j=10; f (&i, j); p...
Akash Kanase
8.9k
views
Akash Kanase
asked
Feb 12, 2016
Programming in C
gatecse-2016-set2
programming-in-c
normal
numerical-answers
parameter-passing
+
–
21
votes
1
answer
36
GATE CSE 1989 | Question: 3-viii
In which of the following case(s) is it possible to obtain different results for call-by-reference and call-by-name parameter passing? Passing an expression as a parameter Passing an array as a parameter Passing a pointer as a parameter Passing as array element as a parameter
In which of the following case(s) is it possible to obtain different results for call-by-reference and call-by-name parameter passing?Passing an expression as a parameter...
Cruise Device
4.6k
views
Cruise Device
asked
Jan 22, 2016
Compiler Design
gate1989
parameter-passing
runtime-environment
compiler-design
multiple-selects
+
–
7
votes
4
answers
37
Parameter Passing | GATE 1993 | common data questions 6 marks
Consider the block of code given below: Program PARAM(input,output); var m,n:integer; procedure P(var x,y:integer); var m:integer; begin m:=1; x:=y+1; end; procedure Q(x:integer; var y:integer); begin x:=y+1; end; begin m:=0; P ... of the above 32. What is the scope of m declared in the main program? a)PARAM,P,Q b)PARAM,P c)PARAM,Q d)P,Q
Consider the block of code given below:Program PARAM(input,output);var m,n:integer;procedure P(var x,y:integer);var m:integer;beginm:=1;x:=y+1;end;procedure Q(x:integer; ...
Aspi R Osa
3.3k
views
Aspi R Osa
asked
Dec 10, 2015
Compiler Design
parameter-passing
runtime-environment
+
–
2
votes
1
answer
38
Find the value of Z
P(X:integer,Y:integer) { X = 6; A = 8; return ( X + Y ) } if the function P were invoked by the following program fragment. k = 1; L = 1; Z = (K, L); Then the value of Z would be? where X=call by reference and Y=pass by value
P(X:integer,Y:integer) { X = 6; A = 8; return ( X + Y ) }if the function P were invoked by the following program fragment. k = 1; L = 1; Z = (K, L);Then the value of Z wo...
Nishikant kumar
1.0k
views
Nishikant kumar
asked
Nov 16, 2015
Programming in C
programming
parameter-passing
+
–
9
votes
2
answers
39
TIFR CSE 2011 | Part B | Question: 32
Various parameter passing mechanisms have been in used in different programming languages. Which of the following statements is true? Call by value result is used in language Ada. Call by value result is the same as call by name. Call by value is the most robust. Call by reference is the same as call by name. Call by name is the most efficient.
Various parameter passing mechanisms have been in used in different programming languages. Which of the following statements is true?Call by value result is used in langu...
makhdoom ghaya
1.7k
views
makhdoom ghaya
asked
Oct 22, 2015
Programming in C
tifr2011
programming
parameter-passing
+
–
0
votes
1
answer
40
Consider the following code
void main() { int x=10, y=5; swap(x,y); print(x,y); } void swap(int a, int b) { int c, x=0; c=a; a=b; b=c; } what is output using call by text? a) 5 0 b) 5 10 c) 10 0 d) 10 10
void main() { int x=10, y=5; swap(x,y); print(x,y); } void swap(int a, int b) { int c, x=0; c=a; a=b; b=c; }what is output using call by text?a) 5 0b) 5 10c) 10 0d) ...
Isha Karn
523
views
Isha Karn
asked
Dec 9, 2014
Programming in C
programming
parameter-passing
+
–
1
votes
4
answers
41
Consider the following program
int i = 1; int main() { int a[]= { 0,1, 2} ; f(a[i], i); printf("%d", a[i]); } void f(int x, int y) { y++; x=5*i; } In above function f() uses " call by name" technique, what is the output printed? a) 2 b) 10 c) 5 d) 1
int i = 1; int main() { int a[]= { 0,1, 2} ; f(a[i], i); printf("%d", a[i]); } void f(int x, int y) { y++; x=5*i; }In above function f() uses " call by name" technique, w...
Isha Karn
979
views
Isha Karn
asked
Dec 9, 2014
Programming in C
programming
parameter-passing
+
–
0
votes
1
answer
42
What will be the second value printed by the program if parameter passing mechanism is call by reference?
What will be the second value printed by the program if parameter passing mechanism is call by reference?int b=10 //global begin procedure func(int x,int y) begin print(b...
shree
522
views
shree
asked
Nov 22, 2014
Programming in C
programming
parameter-passing
+
–
85
votes
6
answers
43
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.6k
views
Ishrat Jahan
asked
Oct 31, 2014
Programming in C
gateit-2006
programming
programming-in-c
normal
parameter-passing
+
–
25
votes
1
answer
44
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
+
–
23
votes
4
answers
45
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
+
–
3
votes
1
answer
46
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
+
–
13
votes
6
answers
47
GATE CSE 1995 | Question: 2.4
What is the value of $X$ printed by the following program? program COMPUTE (input, output); var X:integer; procedure FIND (X:real); begin X:=sqrt(X); end; begin X:=2 FIND(X); writeln(X); end. $2$ $\sqrt{2}$ Run time error None of the above
What is the value of $X$ printed by the following program?program COMPUTE (input, output); var X:integer; procedure FIND (X:real); begin X:=sqrt(X); end; begin X:=2 FIND(...
Kathleen
7.1k
views
Kathleen
asked
Oct 8, 2014
Compiler Design
gate1995
compiler-design
parameter-passing
runtime-environment
easy
+
–
11
votes
3
answers
48
GATE CSE 1993 | Question: 26
A stack is used to pass parameters to procedures in a procedure call. If a procedure $P$ has two parameters as described in procedure definition: procedure P (var x :integer; y: integer); and if $P$ is called by ; $P(a, b)$ State precisely in a ... $b$ In the generated code for the body of procedure $P$, how will the addressing of formal parameters $x$ and $y$ differ?
A stack is used to pass parameters to procedures in a procedure call.If a procedure $P$ has two parameters as described in procedure definition:procedure P (var x :intege...
Kathleen
3.0k
views
Kathleen
asked
Sep 29, 2014
Compiler Design
gate1993
compiler-design
parameter-passing
runtime-environment
normal
descriptive
+
–
4
votes
1
answer
49
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
50
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.7k
views
go_editor
asked
Sep 29, 2014
Programming in C
gatecse-2010
programming
programming-in-c
easy
parameter-passing
+
–
15
votes
2
answers
51
GATE CSE 2006 | Question: 56, ISRO2009-58
Consider the following code written in a pass-by-reference language like FORTRAN and these statements about the code. subroutine swap(ix,iy) it = ix L1 : ix = iy L2 : iy = it end ia = 3 ib = 8 call swap (ia, ib+5) print *, ia, ib end ... : The program will print 13 and -2 Exactly the following set of statement(s) is correct: S1 and S2 S1 and S4 S3 S1 and S5
Consider the following code written in a pass-by-reference language like FORTRAN and these statements about the code. subroutine swap(ix,iy) it = ix L1 : ix = iy L2 : iy ...
Rucha Shelke
6.8k
views
Rucha Shelke
asked
Sep 26, 2014
Programming in C
gatecse-2006
programming
parameter-passing
normal
out-of-syllabus-now
isro2009
+
–
13
votes
1
answer
52
GATE CSE 1999 | Question: 15
What will be the output of the following program assuming that parameter passing is call by value call by reference call by copy restore procedure P{x, y, z}; begin y:y+1; z: x+x; end; begin a:= b:= 3; P(a+b, a, a); Print(a); end
What will be the output of the following program assuming that parameter passing iscall by valuecall by referencecall by copy restoreprocedure P{x, y, z}; begin y:y+1; z:...
Kathleen
5.9k
views
Kathleen
asked
Sep 23, 2014
Compiler Design
gate1999
parameter-passing
normal
runtime-environment
descriptive
+
–
30
votes
5
answers
53
GATE CSE 2004 | Question: 2,ISRO2017-54
Consider the following function void swap(int a, int b) { int temp; temp = a; a = b; b = temp; } In order to exchange the values of two variables $x$ and $y$. call $swap(x, y)$ call $swap(\&x, \&y)$ $swap (x, y)$ cannot be used as it does not return any value $swap (x, y)$ cannot be used as the parameters are passed by value
Consider the following functionvoid swap(int a, int b) { int temp; temp = a; a = b; b = temp; }In order to exchange the values of two variables $x$ and $y$.call $swap(x, ...
Kathleen
14.7k
views
Kathleen
asked
Sep 18, 2014
Compiler Design
gatecse-2004
compiler-design
programming-in-c
parameter-passing
easy
isro2017
runtime-environment
+
–
40
votes
5
answers
54
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.3k
views
Kathleen
asked
Sep 17, 2014
Programming in C
gatecse-2003
compiler-design
normal
runtime-environment
parameter-passing
+
–
13
votes
2
answers
55
GATE CSE 2002 | Question: 1.18
The results returned by function under value-result and reference parameter passing conventions Do not differ Differ in the presence of loops Differ in all cases May differ in the presence of exception
The results returned by function under value-result and reference parameter passing conventionsDo not differDiffer in the presence of loopsDiffer in all casesMay differ i...
Kathleen
8.3k
views
Kathleen
asked
Sep 15, 2014
Programming in C
gatecse-2002
programming
parameter-passing
normal
out-of-syllabus-now
+
–
11
votes
2
answers
56
GATE CSE 2001 | Question: 2.19
Consider the following program Program P2 var n : int; procedure W(var x : int) begin x = x + 1; print x; end procedure D begin var n : int; n = 3; W(n); end begin \\begin P2 n=10; D; end If the language has dynamic scooping and parameters are passed by reference, what will be printed by the program? 10 11 3 None of the above
Consider the following programProgram P2 var n : int; procedure W(var x : int) begin x = x + 1; print x; end procedure D begin var n : int; n = 3; W(n); end begin \\begin...
Kathleen
7.4k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2001
programming
parameter-passing
normal
out-of-syllabus-now
+
–
27
votes
4
answers
57
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.4k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2001
programming-in-c
parameter-passing
normal
ugcnetcse-aug2016-paper3
+
–
6
votes
2
answers
58
GATE CSE 2000 | Question: 18
Consider the following program is pseudo-Pascal syntax program main; var x: integer; procedure Q (z: integer); begin z := z+x; writeln(z); end; procedure P (y: integer); var x: integer; begin x := y+2; Q(x); writeln(x); ... is call-by-value and the scope rule is static scoping? the parameter passing mechanism is call-by-reference and the scope rule is dynamic scoping?
Consider the following program is pseudo-Pascal syntaxprogram main; var x: integer; procedure Q (z: integer); begin z := z+x; writeln(z); end; procedure P (y: integer);...
Kathleen
3.0k
views
Kathleen
asked
Sep 14, 2014
Programming in C
gatecse-2000
programming
parameter-passing
normal
out-of-syllabus-now
descriptive
+
–
1
votes
1
answer
59
GATE CSE 1992 | Question: 10a
What type of parameter passing mechanism (call-by-value, call-by-reference, call-by-name, or-by-value result) is the following sequence of actions trying to implement for a procedure call $P (A[i])$ where P (i:integer) is a procedure and A is an integer array? Is the ... say z. Assign to z the value of A[i]. Execute the body of P using z for A[i] Set A[i] to z.
What type of parameter passing mechanism (call-by-value, call-by-reference, call-by-name, or-by-value result) is the following sequence of actions trying to implement for...
Kathleen
1.2k
views
Kathleen
asked
Sep 13, 2014
Programming in C
gate1992
parameter-passing
programming
normal
out-of-gate-syllabus
+
–
27
votes
3
answers
60
GATE CSE 1991 | Question: 09a
Consider the following pseudo-code (all data items are of type integer): procedure P(a, b, c); a := 2; c := a + b; end {P} begin x := 1; y := 5; z := 100; P(x, x*y, z); Write ('x = ', x, 'z = ', z); end Determine its output, if the parameters are passed to the Procedure $\text{P}$ by value reference name
Consider the following pseudo-code (all data items are of type integer): procedure P(a, b, c); a := 2; c := a + b; end {P} begin x := 1; y := 5; z := 100; P(x, x*y, z); W...
Kathleen
3.6k
views
Kathleen
asked
Sep 12, 2014
Compiler Design
gate1991
compiler-design
parameter-passing
normal
runtime-environment
descriptive
+
–
Page:
« prev
1
2
3
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register