Question: Consider again the same function as in Q 1 , but with a changed precondition: def f ( x ) : ' ' ' Pre:

Consider again the same function as in Q1, but with a changed precondition:
def f(x):
''' Pre: x is a natural number greater than 997'''
a = x
y =10
while a >0:
a = a - y
y = y -1
return a * y
Assuming the function terminates, what would be a correct variant that?
Question 2Answer
a.
a-y is a variant
b.
y-1 is a variant
c.
a+y is a variant
d.
None of the above is a variant for this function.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!