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

Question 16 requires you to write the piece of the algorithm that corresponds to

ID: 3584879 • Letter: Q

Question

Question 16 requires you to write the piece of the algorithm that corresponds to the indicated portion of matlab code. (6.25 points each) 1. function [count zeros, an array] = ones and zeros (an array, size) 2. count zeros = 0; 3. for ii = 1:size 4 or 11 = 1 : size if mod (an rray (ii,jj), 2) an array (ii, jj)=o. c unt zeros = count zeros + 1; 7 else an array (ii, jj-1: end end %ena11 12. end %end 11 13. end %end function 16) How would you express the code on line 5 as an algorithmic statement or pseudocode? A) B) C) D) if an arrayfii, j] is even if an array[ii, j1] / 2 =:0 if an arrayfi i] is odd if a narray[ii, ji] /2 =-1

Explanation / Answer

C. Odd

Used it in if condition and it has to be 1 to go into it. To let mod(arr, 2) equals to 1, element in array must be odd since it only returns reminder.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote