need description. Other wise I would downvote.    Thank you

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

I need description. Other wise I would downvote. 

 

Thank you 

 

Problem 2 (Declaration Order, Sec. 3.3.3, 20 pts):
Consider the following pseudocode.
1. procedure main
a: integer : 1
b: integer : 2
2.
3.
procedure middle
b: integer :=a
4.
5.
6.
procedure inner
7.
print a, b
8.
a: integer := 3
-- body of middle
innero
9.
10.
11.
print a, b
12.
-- body of main
middleo
13.
14.
print a, b
As can be seen from the pseudocode, this is a language that allows
nested subroutines (middle is nested inside main and inner is nested
inside middle).
a) Suppose that this is a language with the declaration order rules of a
language like C, i.e. names must be declared before use, and the scope of
a name extends from its declaration through the end of the block.
For each print statement (lines 7, 11, and 14), indicate which
declarations of a and b are in the referencing environment (i.e.
what declarations are they referring to). The declarations are
lines that have the assignment to the variable (':=').
• What numbers are output by the program?
b) Suppose that this is a language with the declaration order rules of
Modula-3, i.e. names can be declared in any order, and their scope is the
entire block in which they are declared (see 3rd paragraph in pg. 132 of
4th edition or pg. 129 in 3rd edition of your textbook).
• For each print statement (lines 7, 11, and 14), indicate which
declarations of a and b are in the referencing environment. The
declarations are lines that have the assignment to the variable
(':=').
• What numbers are output by the program?
Transcribed Image Text:Problem 2 (Declaration Order, Sec. 3.3.3, 20 pts): Consider the following pseudocode. 1. procedure main a: integer : 1 b: integer : 2 2. 3. procedure middle b: integer :=a 4. 5. 6. procedure inner 7. print a, b 8. a: integer := 3 -- body of middle innero 9. 10. 11. print a, b 12. -- body of main middleo 13. 14. print a, b As can be seen from the pseudocode, this is a language that allows nested subroutines (middle is nested inside main and inner is nested inside middle). a) Suppose that this is a language with the declaration order rules of a language like C, i.e. names must be declared before use, and the scope of a name extends from its declaration through the end of the block. For each print statement (lines 7, 11, and 14), indicate which declarations of a and b are in the referencing environment (i.e. what declarations are they referring to). The declarations are lines that have the assignment to the variable (':='). • What numbers are output by the program? b) Suppose that this is a language with the declaration order rules of Modula-3, i.e. names can be declared in any order, and their scope is the entire block in which they are declared (see 3rd paragraph in pg. 132 of 4th edition or pg. 129 in 3rd edition of your textbook). • For each print statement (lines 7, 11, and 14), indicate which declarations of a and b are in the referencing environment. The declarations are lines that have the assignment to the variable (':='). • What numbers are output by the program?
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY