BONUS: (4 points) Consider the following program, written in JavaScript-like syn
ID: 3601099 • Letter: B
Question
BONUS: (4 points) Consider the following program, written in JavaScript-like syntar //main program var x, Y, z; function sub10 var a, y, z function sub20) t Var a, b, z; function sub30 i Var a, x, w; Considering the following calling sequence and assuming dynamic scoping, what variables are visible during execution of the last subprogram activated? 1. Main calls sub2; sub2 calls sub3; sub3 calls subl BONUS: (2 points) Given the following beginning of a class definition for a superclass named clock, how many accessor and mutator methods will be needed to complete the class definition? class clock: price): color, -init-(self, self, shape = shape self.colorcolor self.price = price shape, def a. 1 mutator, 1 accessor b. 3 mutator, 4 accessor c. 3 mutator, 3 accessor d. 4 mutator, 5 accessorExplanation / Answer
Question 1:
Here a sequence of functions are going on. So when the control goes to the last function
which is sub1 it's local variables a,y,z and global variables x,y,z are visible to the last
subprogram.
Question 2:
In the class there are three variables or properties for the class.
So for the three properties three mutators or setter methods are required
and three accessor methods are required.
So the answer is Option C
**Comment for any further queries. Upvote if the answer is satisfactory.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.