Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Consider the following JavaScript program (6pts) vaX, y, Z; function sub1 { var.a, y, Z, function sub2 ( var a, b, z; function sub3
1. Consider the following JavaScript program (6pts) vaX, y, Z; function sub1 { var.a, y, Z, function sub2 ( var a, b, z; function sub3 (X List all the variables, along with the program units where they are declared, that are visible in the bodies of sub1, sub2 and sub3, assuming static scope 2. Show the order of evaluation of the expressions assuming that there are no precedence rules and all operators associate right to left. (9 pts) a*b-1 + c ii)(a-b)/c & (d'ela-3) ii) a (b-1) /c mod d 3. Let the function fun be defined as (10 pts) int fun(int *k) *k +4; return 3* ("k) -1;) suppose fun is used in the program as follows void maiolX intL:10, j = 10, sum1, sum2; sum1- (i/2) + fun (&i); sum2 - fun (&j) + (j/ 2);) What are the values of sum1 and sum2 a. Operands in the expressions are evaluated left to right? b. Operands in the expressions are evaluated right to left
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started