Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Parameter Passing Material
Recent questions tagged parameter-passing
3
votes
1
answer
1
GO Classes Test Series 2024 | Programming | Test 3 | Question: 19
#include<stdio.h> int test(int *a, int *b) { int c = *a-*b; if (c<0) return 0; else return (1 + test(&c, b)); } void main() { int x = 15; int y = 4; int a = test(&x,&y); printf("%d", a); } $2$ $3$ $4$ Run time error since we can not pass the address of local variable c in the function test.
#include<stdio.h int test(int *a, int *b) { int c = *a-*b; if (c<0) return 0; else return (1 + test(&c, b)); } void main() { int x = 15; int y = 4; int a = test(&x,&y); p...
GO Classes
394
views
GO Classes
asked
Apr 30, 2022
Programming in C
goclasses2024-programming-3-weekly-quiz
goclasses
programming
programming-in-c
functions
pointers
parameter-passing
recursion
2-marks
+
–
5
votes
1
answer
2
GATE Overflow Test Series | Mock GATE | Test 1 | Question: 42
What will be the output of the following C program? #include<stdio.h> void foo(int a, int *p1, int **p2) { static int b; *p1 = 6; *p2 = &b; } int main() { int a, *p1 = &a; a = 9; foo(a, p1, &p1); printf("%d,%d",a, *p1); } $6,0$ $9,6$ $6,6$ Garbage Value
What will be the output of the following C program?#include<stdio.h void foo(int a, int *p1, int p2) { static int b; *p1 = 6; *p2 = &b; } int main() { int a, *p1...
gatecse
540
views
gatecse
asked
Jan 3, 2021
Programming in C
go2025-mockgate-1
pointers
parameter-passing
programming-in-c
+
–
6
votes
3
answers
3
GATE Overflow Test Series | Programming | Test 1 | Question: 1
Consider the following C code fragment ( denote further statements): int main() { int my_array[30][40][50]; init_array(&my_array); ... } Which of the following is a valid declaration for the function init_array? Mark all the correct ... array)[30][40][50]); void init_array(int *** array); void init_array(int ** array[30][40]);
Consider the following C code fragment (… denote further statements):int main() { int my_array[30][40][50]; init_array(&my_array); ... }Which of the following is a vali...
gatecse
688
views
gatecse
asked
Jul 26, 2020
Programming in C
go2025-programming-1
parameter-passing
pointers
multiple-selects
+
–
4
votes
1
answer
4
GATE Overflow Test Series | Programming | Test 1 | Question: 29
What will be the output of the following C program? #include<stdio.h> void foo(int a, int *p1, int **p2) { **p2 = 5; *p1 = 6; a = 7; } int main() { int a, *p1 = &a, **p2 = &p1; a = 9; foo(a, p1, p2); printf("%d", a); }
What will be the output of the following C program?#include<stdio.h void foo(int a, int *p1, int p2) { p2 = 5; *p1 = 6; a = 7; } int main() { int a, *p1 = &a, p2 = &p1...
gatecse
194
views
gatecse
asked
Jul 26, 2020
Programming in C
go2025-programming-1
numerical-answers
pointers
parameter-passing
+
–
1
votes
1
answer
5
Self Doubt on scoping
int x = 5, y = 10 ; void main ( ) { int i = 2, j = 3 A (i, j); } void A (int i, int j) { int x = 10, y = 5 ; i = i + x : j = i + y : printf ("%d %d", i, j); B (i, j); } void B (int i, int j) { i ... by-name 3. call-by-need 4. call-by-value 5.Static scoping 6.Dynamic scoping Any reference for call by name and call by need Is for static coping $12,17,54$ or $12,17,59$?
int x = 5, y = 10 ; void main ( ) { int i = 2, j = 3 A (i, j); } void A (int i, int j) { int x = 10, y = 5 ; i = i + x : j = i + y : printf ("%d %d", i, j); B (i, j); } v...
srestha
457
views
srestha
asked
Mar 23, 2019
Programming in C
programming-in-c
dynamic-scoping
parameter-passing
+
–
0
votes
1
answer
6
parameter passing
#include<stdio.h> int fun(int arr[]) { arr=arr+1; printf("%d",arr[0]); } int main(void){ int arr[2]={10,20}; fun(arr); printf("%d",arr[0]); return 0; } A.COMPILE ERROR B.20,10 C.10,20 D.20,20
#include<stdio.h>int fun(int arr[]){ arr=arr+1; printf("%d",arr[0]);}int main(void){ int arr ={10,20}; fun(arr); printf("%d",arr[0]); return 0;}A.COMPIL...
Arun Rout
728
views
Arun Rout
asked
Jan 7, 2019
Programming in C
parameter-passing
+
–
5
votes
2
answers
7
TIFR CSE 2019 | Part B | Question: 8
Consider the following program fragment: var a,b : integer; procedure G(c,d: integer); begin c:=c-d; d:=c+d; c:=d-c end; a:=2; b:=3; G(a,b); If both parameters to $G$ are passed by reference, what are the values of $a$ and $b$ at the end of the above program fragment ? $a=0$ and $b=2$ $a=3$ and $b=2$ $a=2$ and $b=3$ $a=1$ and $b=5$ None of the above
Consider the following program fragment:var a,b : integer; procedure G(c,d: integer); begin c:=c-d; d:=c+d; c:=d-c end; a:=2; b:=3; G(a,b);If both parameters to $G$ are p...
Arjun
2.0k
views
Arjun
asked
Dec 18, 2018
Programming in C
tifr2019
programming
parameter-passing
+
–
0
votes
1
answer
8
Parameter Passing
Predict the Output for both the snippets for the following: 1. Call by Value 2. Call by Reference 3. Call by Need 4. Call by Name 5. Call by value Result/Call by value Return(Copy Restore) 6. Call by Text
Predict the Output for both the snippets for the following:1. Call by Value2. Call by Reference3. Call by Need4. Call by Name5. Call by value Result/Call by value Return(...
Balaji Jegan
1.3k
views
Balaji Jegan
asked
Nov 15, 2018
Programming in C
programming-in-c
parameter-passing
+
–
0
votes
0
answers
9
parameter passing technique
from below list of parameter passing techniques, which parameter passing technique we can implement in c? 1) call by value 2) call by refference 3) call by value result 4) call by name 5) call by text 6) call by need
from below list of parameter passing techniques, which parameter passing technique we can implement in c?1) call by value2) call by refference3) call by value result4) ca...
Rahul_Rathod_
527
views
Rahul_Rathod_
asked
Oct 3, 2018
Programming in C
parameter-passing
programming
programming-in-c
+
–
0
votes
0
answers
10
parameter passing tech
why we use parameter passing technique in C?? OR purpose of using "parameter passing technique"?? OR what is the advantage of using it in C??
why we use parameter passing technique in C??ORpurpose of using "parameter passing technique"??ORwhat is the advantage of using it in C??
Hira Thakur
305
views
Hira Thakur
asked
Sep 13, 2018
Programming in C
parameter-passing
+
–
0
votes
0
answers
11
Test Series
What is the output.My doubt is : What is meant by call by copy restore ? is it same as call by reference or there is some difference ?
What is the output.My doubt is : What is meant by call by copy restore ? is it same as call by reference or there is some difference ?
Na462
417
views
Na462
asked
May 2, 2018
Programming in C
programming-in-c
parameter-passing
+
–
0
votes
0
answers
12
parameter passing techniques
Does C support all passing parameters techniques like call by text, call by copy restore, and call by name?
Does C support all passing parameters techniques like call by text, call by copy restore, and call by name?
Rishabh Baghel
569
views
Rishabh Baghel
asked
Mar 5, 2018
Programming in C
programming-in-c
parameter-passing
+
–
46
votes
5
answers
13
GATE CSE 2018 | Question: 29
#include<stdio.h> void fun1(char* s1, char* s2){ char* temp; temp = s1; s1 = s2; s2 = temp; } void fun2(char** s1, char** s2){ char* temp; temp = *s1; *s1 = *s2; *s2 = temp; } int main(){ char *str1="Hi", *str2 = "Bye"; fun1 ... of the program above is: $\text{Hi Bye Bye Hi}$ $\text{Hi Bye Hi Bye}$ $\text{Bye Hi Hi Bye}$ $\text{Bye Hi Bye Hi}$
#include<stdio.h void fun1(char* s1, char* s2){ char* temp; temp = s1; s1 = s2; s2 = temp; } void fun2(char s1, char s2){ char* temp; temp = *s1; *s1 = *s2; *s2 = temp;...
gatecse
15.1k
views
gatecse
asked
Feb 14, 2018
Programming in C
gatecse-2018
programming-in-c
pointers
parameter-passing
normal
programming
2-marks
+
–
1
votes
1
answer
14
Virtual Gate Test Series: Programming & DS - Parameter Passing
int f(int &x, int c) { c = c-1; if (c == 0) return 1; x = x +1; return f(x,c) * x; } What is the return value of $f(p,p),$ if the value of $p$ is initialized to $4$ before the call$?$ Note that the first parameter is passed by reference, whereas the second parameter is passed by value.
int f(int &x, int c) { c = c-1; if (c == 0) return 1; x = x +1; return f(x,c) * x; } What is the return value of $f(p,p),$ if the value of $p$ i...
Ahwan
748
views
Ahwan
asked
Aug 20, 2017
Programming in C
programming-in-c
parameter-passing
virtual-gate-test-series
+
–
5
votes
1
answer
15
Test by Bikram | Mock GATE | Test 2 | Question: 14
Consider the following code snippet. void first(int p, int t) { p += t; t += p; } main() { int p = 4; first(p , p); } What is the final value of $p$ in both call by value and call by reference respectively ? $4$ and $12$ $5$ and $12$ $12$ and $16$ $4$ and $16$
Consider the following code snippet.void first(int p, int t) { p += t; t += p; } main() { int p = 4; first(p , p); }What is the final value of $p$ in both call by value a...
Bikram
505
views
Bikram
asked
Jan 24, 2017
Compiler Design
tbb-mockgate-2
compiler-design
parameter-passing
runtime-environment
+
–
0
votes
0
answers
16
CALL BY REFERENCE AND CALL BY NAME
foo(a, b, c) { b =b++; a = a++; c = a + b*10 } X=1; Y=2; Z=3; foo(X, Y+2, Z); CAN SOMEONE PLEASE TELL THE OUTPUTS FOR CALL BY REFERENCE AND CALL BY NAME. WHAT IS THE DIFERENCE BETWEEN CALL BY NAME AND CALL BY REFERENCE??
foo(a, b, c) { b =b++; a = a++; c = a + b*10 } X=1; Y=2; Z=3; foo(X, Y+2, Z);CAN SOMEONE PLEASE TELL THE OUTPUTS FOR CALL BY REFERENCE AND CALL BY NAME. WHAT IS THE DIFER...
sushmita
881
views
sushmita
asked
Jan 18, 2017
Compiler Design
programming
parameter-passing
compiler-design
+
–
8
votes
2
answers
17
Test by Bikram | Mock GATE | Test 1 | Question: 9
Consider the following program fragment : int foo(int ,int ); int a; int ar[4] = { 1,0, 2,3}; main() { a = 0; foo(ar[a], ar[ar[a]]); printf("%d,%d ,%d,%d ", ar[0] , ar[1] ,ar[2] , ar[3]); } foo(int x, int y) { x= x+1; y ... be printed by the program if parameter passed by call by name? $1, 50, 2, 3$ $3, 50, 2, 3$ $3, 50, 3, 4$ $3, 2, 2, 3$
Consider the following program fragment :int foo(int ,int ); int a; int ar[4] = { 1,0, 2,3}; main() { a = 0; foo(ar[a], ar[ar[a]]); printf("%d,%d ,%d,%d ", ar[0] , ar ,a...
Bikram
1.6k
views
Bikram
asked
Jan 16, 2017
GATE
tbb-mockgate-1
parameter-passing
runtime-environment
compiler-design
+
–
5
votes
1
answer
18
GATE CSE 1988 | Question: 8i
Consider the procedure declaration: Procedure P (k: integer) where the parameter passing mechanism is call-by-value-result. Is it correct if the call, P (A[i]), where A is an array and i an integer, is implemented as below. create a new local variable, ... P using z for k; set A [i] to z; Explain your answer. If this is incorrect implementation, suggest a correct one.
Consider the procedure declaration:Procedure P (k: integer)where the parameter passing mechanism is call-by-value-result. Is it correct if the call, P (A[i]), where A is ...
go_editor
1.7k
views
go_editor
asked
Dec 19, 2016
Compiler Design
gate1988
descriptive
compiler-design
runtime-environment
parameter-passing
+
–
19
votes
1
answer
19
GATE CSE 1988 | Question: 2xv
What is printed by following program, assuming call-by reference method of passing parameters for all variables in the parameter list of procedure P? program Main(inout, output); var a, b:integer; procedure P(x, y, z:integer); begin y:=y+1 z:=x+x end P; begin a:=2; b:=3; p(a+b, a, a); Write(a) end.
What is printed by following program, assuming call-by reference method of passing parameters for all variables in the parameter list of procedure P?program Main(inout, o...
go_editor
2.3k
views
go_editor
asked
Dec 19, 2016
Compiler Design
gate1988
descriptive
compiler-design
runtime-environment
parameter-passing
numerical-answers
+
–
4
votes
2
answers
20
GATE CSE 1990 | Question: 11a
What does the following program output? program module (input, output); var a:array [1...5] of integer; i, j: integer; procedure unknown (var b: integer, var c: integer); var i:integer; begin for i := 1 to 5 do a[i] := i; b:= 0; c := 0 for i := 1 to 5 do write (a[i]); ... b := 5; c := 6; end; begin i:=1; j:=3; unknown (a[i], a[j]); for i:=1 to 5 do write (a[i]); end;
What does the following program output?program module (input, output); var a:array [1...5] of integer; i, j: integer; procedure unknown (var b: integer, var c: integer); ...
makhdoom ghaya
1.8k
views
makhdoom ghaya
asked
Nov 25, 2016
Compiler Design
gate1990
descriptive
compiler-design
runtime-environment
parameter-passing
+
–
0
votes
2
answers
21
Kerala PSC AP Exam
The default parameter passing mechanism of functions is A) Call by Value B) Call by Reference C) Call by Result D) None of the above
The default parameter passing mechanism of functions is A) Call by ValueB) Call by ReferenceC) Call by ResultD) None of the above
Sankaranarayanan P.N
846
views
Sankaranarayanan P.N
asked
Oct 27, 2016
Programming in C
parameter-passing
+
–
6
votes
2
answers
22
GATE Overflow | Programming | Test 1 | Question: 14
void foo(int x) { int *p = &x; *p = x*x; } The above code is supposed to modify any input integer with its square. Which of the following statements regarding the above code is correct? The given code is wrong as ... not returning any value The given code is wrong as it is illegal to access the memory of a parameter variable inside a function
void foo(int x) { int *p = &x; *p = x*x; }The above code is supposed to modify any input integer with its square. Which of the following statements regarding the above co...
Arjun
916
views
Arjun
asked
Oct 18, 2016
Programming in C
go-programming-1
programming
programming-in-c
parameter-passing
+
–
3
votes
1
answer
23
UGC NET CSE | August 2016 | Part 3 | Question: 21
Assume that the program $‘P’$ is implementing parameter passing with ‘call by reference’. What will be printed by following print statements in $P$? Program P { x=10; y=3; funb(y,x,x) print x; print y; } funb (x,y,z) { y=y+4; z=x+y+z; } 10, 7 31, 3 10, 3 31, 7
Assume that the program $‘P’$ is implementing parameter passing with ‘call by reference’. What will be printed by following print statements in $P$?Program P { x=...
makhdoom ghaya
1.9k
views
makhdoom ghaya
asked
Oct 1, 2016
Compiler Design
ugcnetcse-aug2016-paper3
parameter-passing
+
–
1
votes
1
answer
24
what is printed by pint stmt if P1 is 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+4; } plzz elaborate the answer explanation? thanks in advance.
Program P1() { x=10, y=3; func1(y,x,x); print x; print y; } func1(x,y,z) { y=y+4; z=x+y+4; }plzz elaborate the answer explanation?thanks in advance.
neha singh
929
views
neha singh
asked
Aug 26, 2016
Programming in C
parameter-passing
+
–
2
votes
2
answers
25
UGC NET CSE | December 2014 | Part 3 | Question: 19
Consider the following statements $S1, S2$ and $S3$: $S1$: In call-by-value, anything that is passed into a function call is unchanged in the caller's scope when the function returns. $S2$: In call-by-reference, a function receives implicit reference to a ... $S3$ and $S1$ are true. $S2$ and $S1$ are true. $S1, S2, S3$ are true.
Consider the following statements $S1, S2$ and $S3$:$S1$: In call-by-value, anything that is passed into a function call is unchanged in the caller’s scope when the fun...
makhdoom ghaya
2.9k
views
makhdoom ghaya
asked
Jul 25, 2016
Compiler Design
ugcnetcse-dec2014-paper3
compiler-design
runtime-environment
parameter-passing
+
–
1
votes
2
answers
26
UGC NET CSE | December 2012 | Part 3 | Question: 44
The Default Parameter Passing Mechanism is called as Call by Value Call by Reference Call by Address Call by Name
The Default Parameter Passing Mechanism is called asCall by ValueCall by ReferenceCall by AddressCall by Name
go_editor
8.3k
views
go_editor
asked
Jul 13, 2016
Programming and DS
ugcnetcse-dec2012-paper3
programming-in-c
parameter-passing
+
–
19
votes
2
answers
27
ISRO2015-80
Consider the following code fragment void foo(int x, int y) { x+=y; y+=x; } main() { int x=5.5; foo(x,x); } What is the final value of $\textsf{x}$ in both call by value and call by reference, respectively? $5$ and $16$ $5$ and $12$ $5$ and $20$ $12$ and $20$
Consider the following code fragmentvoid foo(int x, int y) { x+=y; y+=x; } main() { int x=5.5; foo(x,x); }What is the final value of $\textsf{x}$ in both call by value an...
go_editor
7.2k
views
go_editor
asked
Jun 21, 2016
Compiler Design
isro2015
compiler-design
runtime-environment
parameter-passing
+
–
7
votes
1
answer
28
CMI2010-A-08
In programming language terminology, $\text{ call by value }$ refers to the fact that: A function call can return a value. When a function is called, arguments are copied into local storage. Functions can indirectly modify the value of external variables. Every argument passed to a function must have a value.
In programming language terminology, $\text{ call by value }$ refers to the fact that:A function call can return a value.When a function is called, arguments are copied i...
go_editor
1.2k
views
go_editor
asked
May 19, 2016
Compiler Design
cmi2010
compiler-design
runtime-environment
parameter-passing
+
–
22
votes
3
answers
29
GATE CSE 1991 | Question: 09b
For the following code, indicate the output if static scope rules dynamic scope rules are used var a,b : integer; procedure P; a := 5; b := 10; end {P}; procedure Q; var a, b : integer; P; end {Q}; begin a := 1; b := 2; Q; Write ('a = ', a, 'b = ', b); end
For the following code, indicate the output if static scope rulesdynamic scope rulesare usedvar a,b : integer; procedure P; a := 5; b := 10; end {P}; procedure Q; var a, ...
go_editor
4.3k
views
go_editor
asked
Apr 24, 2016
Compiler Design
gate1991
runtime-environment
normal
compiler-design
parameter-passing
descriptive
+
–
Page:
1
2
3
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register