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

Material Type: Quiz; Class: PROGRAM LANG STRUCTURES; Subject: Computer Science & Engineering; University: University of South Carolina - Columbia; Term: Fall 2007;

Typology: Quizzes

Pre 2010

Uploaded on 09/02/2009

koofers-user-yu4
koofers-user-yu4 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

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.