Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

PS11.3 CONTUNUED d. Given the following script function [y, z] = Fina!Exam (x) y

ID: 2265855 • Letter: P

Question

PS11.3 CONTUNUED d. Given the following script function [y, z] = Fina!Exam (x) y =1 ; z =0; if x=-y Y-100,; else z= end end d.1 If w=FinalExam (100)-100, what is w? A: w=true | B: w-10 | C: w-100 | D: w=false | E: None of the others d.2 If [u, v]-FinalExam (0), which of the following is true? A: v>=u; | B: v(su; | C: v=u=0; | D: v=u; 8both>0 | E: None of the others e. Given the Vector Z- [10 2 34 56 7], which of the answers below will yield 34? A: Z[1]; B: Z[2 C: Z[3] D: Z[4]E: None of the others f. Given the following script, what value will x be, when the loop finishes?: for n=1 : 10 x-n-l; end A: 1 B: 4; C: 9; D: 10E: None of the others g. Given the following script, if x--5 what does y equal?: if (x-1 ) y=x ; y-24 Y-x*2; else if (x>1) else end A: 1 B: 10; C:-10;|D: 12 E: None of the others

Explanation / Answer

1. The exaluation begins from the left side FinalExam(100) will result in 1 which is compared with 100. Since 1 is not equal to 100, w=false i.e. w=0; Hence option D is correct

2. Since [u,v]=FinalExam(0) will result in u=0 and v=100, option A is the right answer.

3. Z=[10 2 34 56 7]. Since the third element is 34, Z[3] will result in 34. Hence option C is correct

4. The for loop starts with n=1 and increments n by 1 for every iteration. The last value of n would be 10 and hence 9 would be stored in x. So, when the loop finishes x=9. Answer is option C.

5. Since x=-5, the first and second conditions are not satisfied. Therefore y=2*x and hence y=-10 is the correct option. Answer is C.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote