Given the following: #includ int a[] ={4, 6}, i = 0, y =3, z =1; void f(int x){ int z = 2; g (); X = x + y; z = z +X; i++; return x + a[ i ]+y; } void g(){ z += 3; y = a[i] + z; } void main(){ printf("%d", y + f( a[i] ) - y); } State the output assuming the following: A) Call by reference, dynamic scoping, operands are evaluated right to left. B) Call by name, static scoping; operands are evaluated left to right.

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter2: Using Data
Section: Chapter Questions
Problem 14RQ
icon
Related questions
Question
Given the following:
#includ<sdtio.h>
int a[] ={4, 6}, i = 0, y =3, z =1;
void f(int x){
int z = 2;
g ();
X = x + y;
z = z +X;
i++;
return x + a[ i ]+y;
}
void g(){
z += 3;
y = a[i] + z;
}
void main(){
printf("%d", y + f( a[i] ) - y);
}
State the output assuming the following:
A) Call by reference, dynamic scoping, operands are evaluated right to left.
B) Call by name, static scoping; operands are evaluated left to right.
Transcribed Image Text:Given the following: #includ<sdtio.h> int a[] ={4, 6}, i = 0, y =3, z =1; void f(int x){ int z = 2; g (); X = x + y; z = z +X; i++; return x + a[ i ]+y; } void g(){ z += 3; y = a[i] + z; } void main(){ printf("%d", y + f( a[i] ) - y); } State the output assuming the following: A) Call by reference, dynamic scoping, operands are evaluated right to left. B) Call by name, static scoping; operands are evaluated left to right.
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT