Assignment 3 - Programming Language Semantics and Memory Management
Due in Lecture Feb 3. This homework doesn't involve writing any
programs, so just turn in your answers on paper.
- Exercise 3.5 in textbook (page 79)
- Exercises 3.17a and 3.17c in textbook (page 81). Skip 3.17b.
- Exercise 4.1 in textbook (page 116). Also consider the following
issues. How easy is it for beginners to learn the language? (Reflect on
your own experience in CSE 142, and also the experience of less capable
students.) How easy it is for experiened programmers
to understand a program they didn't write? Are there any
appropriate guidelines for writing identifiers that differ only by case?
(Consider squid, Squid, and sQuId.) Should
these guidelines be only suggestions, or should the compiler check them?
Consider other issues as well if appropriate. Your answer should be a
well-written short essay.
- The following Java statement gives a compile error. (Personally I find
this really annoying, but that's a different issue.) Why do Java's
coercion rules say this an error? How can you fix the code?
float f;
f = 5.0;
- Exercise 5.2 in textbook (page 151)
- Exercise 5.3 in textbook (page 151)
- Exercise 5.13 in textbook (page 153)
- Consider the following program in an Algol-like language. This program
will print out six values.
begin
integer n;
procedure p(j: integer)
begin
n := n+10;
j := 5;
n := n+1;
print(j,n);
end;
n := 0;
p(n); print(n);
p(n); print(n);
end;
- What is the output if n is passed by value?
- What is the output if n is passed by result?
- What is the output if n is passed by value-result?
- What is the output if n is passed by reference?