Docsity

Quiz 9 with Solution for Programming Language Structures | CSCE 330, Quizzes of Computer Science

Toggle sidebar
bg1
CSCE 330 Fall 2007
Quiz 9
Assigned Thursday, 07-10-04
1. Recall that, in denotational semantics, the state is a triple <mem, i, o>.
(a) Which component(s) of the state are changed by a read instruction?
Answer: i, mem
(b) Which component(s) of the state are changed by a write instruction?
Answer: o (only)
(c) Which component(s) of the state are changed by an assignment?
Answer: mem
2. What is the denotational semantics of the following program, where the
initial input stream contains only the integer z?
read(n);
i := n+1;
write(i);
Hint: it is a very short answer!
Answer: <z+1>. Also acceptable: z+ 1, although technically the a nswer
is a sequence.
1

Partial preview of the text

Download Quiz 9 with Solution for Programming Language Structures | CSCE 330 and more Quizzes Computer Science in PDF only on Docsity!

CSCE 330 Fall 2007

Quiz 9

Assigned Thursday, 07-10-

  1. Recall that, in denotational semantics, the state is a triple <mem, i, o>.

(a) Which component(s) of the state are changed by a read instruction? Answer: i, mem (b) Which component(s) of the state are changed by a write instruction? Answer: o (only) (c) Which component(s) of the state are changed by an assignment? Answer: mem

  1. What is the denotational semantics of the following program, where the initial input stream contains only the integer z? read(n); i := n+1; write(i);

Hint: it is a very short answer! Answer: <z+1>. Also acceptable: z + 1, although technically the answer is a sequence.