This question concerns environments and scope chains. We will use the following definition for environments: EmptyEnvironment : empty environment • Extend(id, value, old_env) : extend old_env by binding variable named id to value. • ExtendRec(rec_function_name, formal_param, body_expr, old_env): a recursive scope chain with name of function, formal parameter, body of function and the old environmen Consider a series of environments og,...,03 below and answer the questions following each. • oo : EmptyEnvironment What is the value of lookup(x, ao)? (Type your answer. No explanations please). • 01 : Extend(y, 40, Extend(x, 20, 0)) What is the value of lookup(x, 01)? (Type your answer). 03 : Extend(x, 75, 01) What is the value of lookup(x, oz)? (Type your answer). • o3 : ExtendRec(S, m, e, oa) What is the value of lookup(x, as)? (Type your answer). What is the value of lookup(f, og)? (Choose the correct answer). (a) error (b) Closure(f, e, ag) (0) Closure(x, e, og) (d) Closure(t, a, ag) (@) NumValue(20) Select the correct choice (a) - (e) and type it in the box below.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
This question concerns environments and scope chains. We will use the following definition for environments:
EmptyEnvironment : empty environment
Extend(id, value, old_env) : extend old_env by binding variable named id to value.
• ExtendRec(rec_function_name, formal_param, body_expr, old_env): a recursive scope chain with name of function, formal parameter, body of function and the old environment.
Consider a series of environments og,...,o3 below and answer the questions following each.
• og : EmptyEnvironment
What is the value of lookup(x, oo)? (Type your answer. No explanations please).
• q1 : Extend(y, 40, Extend(2, 20, o0))
What is the value of lookup(x, 01)? (Type your answer).
• o2 : Extend(x, 75, o1)
What is the value of lookup(x, og)? (Type your answer).
• o3 : ExtendRec(f, 0, e, o2)
What is the value of lookup(x, as)? (Type your answer).
What is the value of lookup(f, og)? (Choose the correct answer).
(a) error
(b) Closure(f, e. 02)
(c) Closure(x, e, o3)
(d) Closure(f, e., o3)
(e) NumValue(20)
Select the correct choice (a) - (e) and type it in the box below.
Transcribed Image Text:This question concerns environments and scope chains. We will use the following definition for environments: EmptyEnvironment : empty environment Extend(id, value, old_env) : extend old_env by binding variable named id to value. • ExtendRec(rec_function_name, formal_param, body_expr, old_env): a recursive scope chain with name of function, formal parameter, body of function and the old environment. Consider a series of environments og,...,o3 below and answer the questions following each. • og : EmptyEnvironment What is the value of lookup(x, oo)? (Type your answer. No explanations please). • q1 : Extend(y, 40, Extend(2, 20, o0)) What is the value of lookup(x, 01)? (Type your answer). • o2 : Extend(x, 75, o1) What is the value of lookup(x, og)? (Type your answer). • o3 : ExtendRec(f, 0, e, o2) What is the value of lookup(x, as)? (Type your answer). What is the value of lookup(f, og)? (Choose the correct answer). (a) error (b) Closure(f, e. 02) (c) Closure(x, e, o3) (d) Closure(f, e., o3) (e) NumValue(20) Select the correct choice (a) - (e) and type it in the box below.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Concept of pointer parameter
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
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education