Quiz2

  • June 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Quiz2 as PDF for free.

More details

  • Words: 229
  • Pages: 2
Quiz! • Books and papers put away • Hats off or brims turned backwards • Piece of paper out - Name and Student ID on it

• Your work is your own - Eyes on your own paper - Protect your own paper - Turn your paper over when you’re done

• You have 10 minutes • Turn in papers on first pass by your aisle

Quiz 2 – Type Checking Suppose Oberon had an Enumerated Set type that can be a set of any finite atomic type (BOOLEANS and ranges of INTEGER): VAR smallIntSet: SET OF 1..10; VAR boolSet1, boolSet2: SET OF BOOLEAN; BEGIN smallIntSet := smallIntSet ++ 5;(* insert 5 into set *) boolSet1 := boolSet1 ++ boolSet2; (* union two sets *) END Based on the the Expression Compatibility table for the SET type, below, write a “complete” Oberon type checking testcase for the SET type. Operator | first operand second operand result type -----------------------------------------------------------------------------------++ -- ** | SET OF T T SET OF T | T SET OF T SET OF T | SET OF T SET OF T SET OF T Hint: Expanding this table to include erroneous types (the illegal cases) will help you derive a complete testcase. Hint: You may use symmetries (e.g., commutativity) to reduce the number of cases you write down, but you must note the symmetries in your answer.

Related Documents

Quiz2
August 2019 29
Quiz2
November 2019 24
Quiz2
June 2020 8
Quiz2 Answers
November 2019 9
Quiz2 Solutions
June 2020 5
Quick Quiz2
June 2020 2