(Solved) : 2 Preconditions Postconditions 3 Points Following Functions Either Check Box Says Postcond Q44027972 . . .

2 Preconditions and Postconditions (3 points) For the following functions, either check the box that says the postcondition always holds when the function is given inputs that satisfy its preconditions or give a concrete counterexample: specific values of the inputs such that the preconditions (if there is one) holds and the postcondition does not hold. You don’t have to write any proofs. int fi(int x, int y) 1/@requires 0 < x && X <= y; 1/Censures result < 0; int f2(int x) //@requires x % 2 == 0; //@ensures X >= 0 || result > X; return x – y; return x / 2; @ensures always true? @ensures always true? X = int f3(int x, int y) //@requires y < -1; 1/@ensures result > y ; int f4(int x, int y) //@requires x + y == 42; 1/@ensures result – X == y; return x % y; return 42; Censures always true? @ensures always true? int f5(int x, int y) 1/@ensures result > 0; int f6(int x, int y) //Censures result <= 0; if (x < 0) X = -X; if (y < 0) y = -y; if (y > x) { return y – x; } else { return x – y; if (x <= 0) X = -X; if (y <= 0) y = -y; if (y >= x) { return y – x; } else { return x – y: @ensures always true? @ensures always true? x= y= Show transcribed image text 2 Preconditions and Postconditions (3 points) For the following functions, either check the box that says the postcondition always holds when the function is given inputs that satisfy its preconditions or give a concrete counterexample: specific values of the inputs such that the preconditions (if there is one) holds and the postcondition does not hold. You don’t have to write any proofs. int fi(int x, int y) 1/@requires 0 0; int f6(int x, int y) //Censures result
Expert Answer
Answer to 2 Preconditions and Postconditions (3 points) For the following functions, either check the box that says the postcondit…
OR