1. Engineering
  2. Computer Science
  3. please give the correct answers...

Question: please give the correct answers...

Question details
Please give the correct answers
Check all that apply. The objective is to prove that when this program ends, s n. Check the best loop invariant before each iteration to use in order to achieve my objective. s=0 i++) (i=1; s=s+1 for i <= n; s < n for all i > O i n for all i 0 s= i-1 for all i > 0 s>ifor all i > 0 s <= i-l for all i > 0, You selected this answer
ct Question 6 0/15 pts Check all that apply. The objective is to prove that when this program ends, s 2A(n+1)-1. Check all loop invariants before each iteration for the code below. for (i-o; i < n; i) s 2A(i+1) -1 for all iso O s- 2A0-1) for alli o s = 2^(i-1) for all i > 0. You selected this answer This property is false. s is not a power of 2 it starts with 1 and thern increments with power of 2s. s is not even as the least significant bit is always 1. s 2Ai for all i s O s= 2^(i-1)-1 for all i > O
ect Question 8 Fill in the blank.. Instructions are numbered starting from 1. There is a loop invariant code at Line Answer -1 if there is no loop invariant code. 3. for (i-0; i < n it+) 4. b-2(s +x) +b 5. s=b+x*x + 2
Check all that apply. The objective is to prove that when this program ends, m will be the smallest value in Array A. Check all loop invariants for the code below before the iteration. for (1-2; İ仁A.length; ǐ++) if (m> A[i]) m = A[i] m <- Alkl for all k such that 1 < ki Correct! This property is true even if not very helpful for my objective. in m <= A[k] for all k such that 1 <-k <= (i-1) <= Alength
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution