MidtermSoln

# MidtermSoln - CS 536 Midterm Exam(60 min Solution...

This preview shows pages 1–2. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CS 536: Midterm Exam (60 min) Solution Instructions This exam is closed book, closed notes, and no support equipment (calculators, phones, computers, etc). All the questions are short-answer. The usual penalty for copying or sharing answers on a quiz or exam is a nal grade of E for the course. If you have any questions, please ask during the quiz, not after. When a problem says “all” states, ignore improper states. Program variables range over the integers unless otherwise speci ed. Questions 1. [9 points] Say ! ( x ) = 4 and ! ( y ) = 3. Do either of ! ( if x < 0 then 1 else x ) and ! ( if ! ( x < 0) then ! (1) else ! ( x ) ) use incorrect notation? If not, then brie y (in a sentence or two) explain why. The rst is ne; the second is incorrect: the outer ! expects a syntactic argument, but it’s being passed a mix of syntactic and semantic values. 2. [16 = 2*8 points] Say ! ( w ) = 5, ! ( z ) = 10. Let " " = ! [ w := 6][ w := 7][ z := 9] and " # = ! [ z := 9][ w := 7]. (2a) Is " " = " # ? (If not, brie y explain why.) (2b) Is " " ! " # ?...
View Full Document

{[ snackBarMessage ]}

### Page1 / 2

MidtermSoln - CS 536 Midterm Exam(60 min Solution...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online