



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The instructions and questions for a test in a programming languages 1 course, focusing on message passing, the relational model, and programming models. Students are required to identify correct statements, choose the best programming model for given problems, and write functions using oz's message passing model.
Typology: Exams
1 / 7
This page cannot be seen from the preview
Don't miss anything!




For Grading
declare MyGauge = {NewGauge} {Test local R in {Send MyGauge fetch(R)} R end โ==โ 0} {Send MyGauge up} {Test {Send MyGauge fetch($)} โ==โ 1} {Send MyGauge up} {Test {Send MyGauge fetch($)} โ==โ 2} {Send MyGauge down} {Test {Send MyGauge fetch($)} โ==โ 1} {Send MyGauge up} {Send MyGauge up} {Test {Send MyGauge fetch($)} โ==โ 3}
MyGauge2 = {NewGauge} {Test {Send MyGauge2 fetch($)} โ==โ 0} {Send MyGauge2 down} {Test {Send MyGauge2 fetch($)} โ==โ ~1} {Send MyGauge2 down} {Test {Send MyGauge2 fetch($)} โ==โ ~2} for I in 1..12 do {Send MyGauge2 up} end {Test {Send MyGauge2 fetch($)} โ==โ 10}
declare MyAer = {NewAuctioneer} local Status1 Status2 Status3 Status4 in {Send MyAer bid(17 Status1)} {Send MyAer bid(8 Status2)} {Send MyAer bid(27 Status3)} {Send MyAer bid(24 Status4)} {Send MyAer stop} {Test Status1 โ==โ false } {Test Status2 โ==โ false } {Test Status3 โ==โ true } {Test Status4 โ==โ false } end
MyAer2 = {NewAuctioneer} local Status1 Status2 Status3 Status Status5 Status6 Status in {Send MyAer2 bid(100 Status1)} {Send MyAer2 bid(15 Status2)} {Send MyAer2 bid(99 Status3)} {Send MyAer2 bid(99 Status4)} {Send MyAer2 bid(100 Status5)} {Send MyAer2 bid(100 Status6)} {Send MyAer2 bid(100 Status7)} {Send MyAer2 stop} % first of the highest bids wins {Test Status1 โ==โ true } {Test Status2 โ==โ false } {Test Status3 โ==โ false } {Test Status4 โ==โ false } {Test Status5 โ==โ false } {Test Status6 โ==โ false } {Test Status7 โ==โ false } end
% Stopping with no bids MyAer3 = {NewAuctioneer} {Send MyAer3 stop} % Bidding after an auction is over {Test {Send MyAer3 bid(50 $)} โ==โ false }
{Test {SolveAll proc {$ Ans} {PositionOf nil 0 Ans} end } โ==โ nil} {Test {SolveAll proc {$ Ans} {PositionOf 0|nil 0 Ans} end } โ==โ [1]} {Test {SolveFirst proc {$ Ans} {PositionOf [4 0 2 0] 4 Ans} end } โ==โ 1} {Test {SolveAll proc {$ Ans} {PositionOf [4 0 2 0] 0 Ans} end } โ==โ [2 4]} {Test {SolveFirst proc {$ Ans} {PositionOf [4 0 2 0] 2 Ans} end } โ==โ 3} {Test {SolveAll proc {$ Ans} {PositionOf [4 0 2 0] 5 Ans} end } โ==โ nil} {Test {SolveAll proc {$ Ans} {PositionOf [5 0 2 1 4 0 2 0 88] 0 Ans} end } โ==โ [2 6 8]} {Test {SolveFirst proc {$ X} {PositionOf [99 22 X 55] 7 3} end } โ==โ 7} {Test {SolveFirst proc {$ Ind} {PositionOf [99 22 8 55] Ind 3} end } โ==โ 8}