Page 1 of 1

Question 13 (4 marks) A code fragment FragQ13 is given below, where n is an integer and n ≥ 0. // FragQ13 var aSpot in S

Posted: Thu Jun 09, 2022 4:11 pm
by answerhappygod
Question 13 4 Marks A Code Fragment Fragq13 Is Given Below Where N Is An Integer And N 0 Fragq13 Var Aspot In S 1
Question 13 4 Marks A Code Fragment Fragq13 Is Given Below Where N Is An Integer And N 0 Fragq13 Var Aspot In S 1 (53.85 KiB) Viewed 198 times
Question 13 (4 marks) A code fragment FragQ13 is given below, where n is an integer and n ≥ 0. // FragQ13 var aSpot in Spot var i in Int aSpot.leftOne () aSpot.leftOne () aSpot.upOne () for (i <-- 1 to n). { aSpot.upOne () aSpot.upOne () aSpot.rightOne() Let aSpot be the state of the variable aSpot after k executions of the body of the for loop in Frag013 (where k≥ 0 is an integer). Let p(k) be the following proposition. p(k): aSpot, is (k-2, 2k + 1). Explain why the proposition p(0) is true. (Note: You are asked only to explain why p(0) is true, not p(k) for a general integer k.)