Login
Register
Dark Mode
Brightness
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Search results for parameter-passing
46
votes
5
answers
1
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.2k
views
gatecse
asked
Feb 14, 2018
Programming in C
gatecse-2018
programming-in-c
pointers
parameter-passing
normal
programming
2-marks
+
–
85
votes
6
answers
2
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
+
–
69
votes
4
answers
3
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
+
–
29
votes
7
answers
4
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
+
–
23
votes
4
answers
5
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
+
–
27
votes
4
answers
6
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
+
–
13
votes
6
answers
7
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
+
–
23
votes
6
answers
8
GATE CSE 1991 | Question: 03,x
Indicate all the true statements from the following: Recursive descent parsing cannot be used for grammar with left recursion. The intermediate form for representing expressions which is best suited for code optimization is the postfix form. A ... passing, the effect can be correctly simulated in C No feature of Pascal typing violates strong typing in Pascal.
Indicate all the true statements from the following:Recursive descent parsing cannot be used for grammar with left recursion.The intermediate form for representing expres...
Kathleen
7.0k
views
Kathleen
asked
Sep 12, 2014
Compiler Design
gate1991
compiler-design
parameter-passing
difficult
multiple-selects
+
–
40
votes
5
answers
9
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
+
–
73
votes
2
answers
10
GATE CSE 2013 | Question: 42
What is the return value of $f(p,p)$, if the value of $p$ is initialized to $5$ 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$ is initialized to $5$ before the call? Note that the first parameter is passed by reference, whereas the second ...
gatecse
21.2k
views
gatecse
asked
Aug 7, 2014
Programming in C
gatecse-2013
compiler-design
normal
marks-to-all
numerical-answers
parameter-passing
runtime-environment
+
–
44
votes
4
answers
11
GATE CSE 2008 | Question: 60
What is printed by the following C program? int f(int x, int *py, int **ppz) { int y, z; **ppz += 1; z = **ppz; // corrected z = *ppz; to z = **ppz; *py += 2; y = *py; x += 3; return x+y+z; } void main() { int c, *b, **a; c = 4; b = &c; a = &b; printf("%d", f(c, b, a)); } $18$ $19$ $21$ $22$
What is printed by the following C program?int f(int x, int *py, int ppz) { int y, z; ppz += 1; z = ppz; // corrected z = *ppz; to z = ppz; *py += 2; y = *py; x += 3;...
Kathleen
18.0k
views
Kathleen
asked
Sep 12, 2014
Programming in C
gatecse-2008
programming
programming-in-c
normal
parameter-passing
+
–
43
votes
5
answers
12
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
13.0k
views
go_editor
asked
Apr 24, 2016
Compiler Design
gatecse-2003
programming
compiler-design
parameter-passing
runtime-environment
normal
+
–
11
votes
3
answers
13
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
+
–
3
votes
1
answer
14
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
397
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
+
–
37
votes
3
answers
15
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
+
–
22
votes
3
answers
16
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
+
–
58
votes
3
answers
17
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.2k
views
Sandeep Singh
asked
Feb 12, 2016
Programming in C
gatecse-2016-set1
programming-in-c
easy
numerical-answers
parameter-passing
+
–
19
votes
2
answers
18
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
+
–
30
votes
5
answers
19
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
+
–
11
votes
2
answers
20
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
+
–
Page:
1
2
next »
Email or Username
Show
Hide
Password
I forgot my password
Remember
Log in
Register