- Consider the following program and assume big calls aubi, aub function bigO fu
ID: 3755682 • Letter: #
Question
- Consider the following program and assume big calls aubi, aub function bigO function aub10 var x- function sub20 ( var y var x-3 Under statie scoping and dynamic scoping which variable x is referenced in sub2 (a) Static: big's x, Dynamic: sub1's x (b) Static: sub1's x, Dynamic: sub1's (c) Static: sub1's x, Dynamic: big's (d) Static: big's x, Dynamic: big's x (e) None of the above - Which one of the arguments about dynamic scoping is (a) It is not possible to statically of a incorrect? lems. ly determine the type of a variable, causing readability prob- executing, its variables are visible to all subprograms that it calls is temporal (based on local sequences), not spatial (textual layout) (c) access to non-locals is temporal (based on local of the program (a) Requires dynamic binding of variable attributes (e) None of the above is incorrect (All are correct) -What is the advantage of heap-dynam dynamic) ic arrays over other array types (e.g., static, stack- (a) Can grow or shrink dynamically (b) Binding is done when compiled and storage is allocated from stack (c) Subscript ranges are statically bound. (d) More efficient (e) All of the aboveExplanation / Answer
1)b) static: sub1's x, Dynamic: sub1's because dynamic scope does not see how code writen but how code exicutes.
2)d) Requires dynamic binding of attributes.
3)a) can grow or shring dynamically. at run time.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.