Question: 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
Get step-by-step solutions from verified subject matter experts
