mirror of
https://github.com/appinfosapienza/so-un-bot.git
synced 2025-05-07 03:19:38 +02:00
Added 2021-03-29 exam
This commit is contained in:
parent
d2b06855c6
commit
6be029493b
177 changed files with 1133 additions and 1628 deletions
30
Ingegneria del Software/0321_26/correct.txt
Normal file
30
Ingegneria del Software/0321_26/correct.txt
Normal file
|
@ -0,0 +1,30 @@
|
|||
<pre>
|
||||
model System
|
||||
|
||||
Integer y;
|
||||
|
||||
Real r1024;
|
||||
|
||||
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
|
||||
|
||||
equation
|
||||
|
||||
y = if (r1024 <= 0.3) then 1 else 0;
|
||||
|
||||
algorithm
|
||||
|
||||
when initial() then
|
||||
|
||||
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
|
||||
|
||||
r1024 := 0;
|
||||
|
||||
elsewhen sample(0,1) then
|
||||
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
|
||||
end when;
|
||||
|
||||
end System;
|
||||
|
||||
</pre>
|
1
Ingegneria del Software/0321_26/quest.txt
Normal file
1
Ingegneria del Software/0321_26/quest.txt
Normal file
|
@ -0,0 +1 @@
|
|||
Si consideri l'ambiente (use case) che consiste di un utente che, ad ogni unità di tempo (ad esempio, un secondo) manda al nostro sistema input 1 (ad esempio, esegue una prenotazione) con probabilità 0.3 oppure input 0 con probabilità 0.7. Quale dei seguenti modelli Modelica rappresenta correttamente tale ambiente.
|
28
Ingegneria del Software/0321_26/wrong 1.txt
Normal file
28
Ingegneria del Software/0321_26/wrong 1.txt
Normal file
|
@ -0,0 +1,28 @@
|
|||
<pre>
|
||||
model System
|
||||
|
||||
Integer y; Real r1024;
|
||||
|
||||
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
|
||||
|
||||
equation
|
||||
|
||||
y = if (r1024 <= 0.3) then 0 else 1;
|
||||
|
||||
algorithm
|
||||
|
||||
when initial() then
|
||||
|
||||
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
|
||||
|
||||
r1024 := 0;
|
||||
|
||||
elsewhen sample(0,1) then
|
||||
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
|
||||
end when;
|
||||
|
||||
end System;
|
||||
|
||||
</pre>
|
27
Ingegneria del Software/0321_26/wrong 2.txt
Normal file
27
Ingegneria del Software/0321_26/wrong 2.txt
Normal file
|
@ -0,0 +1,27 @@
|
|||
<pre>
|
||||
model System
|
||||
|
||||
Integer y; Real r1024;
|
||||
|
||||
Integer state1024[Modelica.Math.Random.Generators.Xorshift1024star.nState];
|
||||
|
||||
equation
|
||||
|
||||
y = if (r1024 >= 0.3) then 1 else 0;
|
||||
|
||||
algorithm
|
||||
|
||||
when initial() then
|
||||
|
||||
state1024 := Modelica.Math.Random.Generators.Xorshift1024star.initialState(614657, 30020);
|
||||
|
||||
r1024 := 0;
|
||||
|
||||
elsewhen sample(0,1) then
|
||||
|
||||
(r1024,state1024) := Modelica.Math.Random.Generators.Xorshift1024star.random(pre(state1024));
|
||||
|
||||
end when;
|
||||
|
||||
end System;
|
||||
</pre>
|
Loading…
Add table
Add a link
Reference in a new issue