State the value of x after the statement if P(x) then x:=1 is executed, where P(x) is the statement
“x > 1,”
Given that thevalue of x when thisstatement is reachedis [3 marks]
a) x=0
b) x=1
c) x =2
Consider the statement "if then " which is equivalent to "if then "
a) If , then the statement is false, and thus the value of is equal to 0 after the statement "if then ".
b) If , then the statement is false, and thus the value of is equal to 1 after the statement "if then ".
c) If , then the statement is true, and thus the value of is equal to 1 after the statement "if then ".
Comments
Leave a comment