Readiness Assessment 4C
What would be the result of the MATLAB command below sign(-4) -1 0 4 -4 1 -
-1
Given the MATLAB expression below, which operation would be performed first2 * 3 / 5 * 4 5 * 4 3 / 5 2 * 3 6 / 5 3 / 20
2 * 3
Given the code segment n = 0; if (x>0) if (x<1000) n = 0.1*x else n = n + 100 if (x<5000) n = n + 0.2*(x-1000) else n = n + 800 + 0.3*(x-5000) end end else disp('invalid input') end what would the final value of n when x = 1500? 0 100 1500 200 150 invalid input
200
Given the row vector R = [1, 4, 2, 3, 5, 1, 2, 6, 4, 2, 4, 5], what would be the result of the following MATLAB command?median(R) 1 3 6 5 4 3.5
3.5
Given the array (matrix) x = [1.1 2.3 5.6; 2.4 9.8 4.9; 7.7 3.3 4.4; 10.2 6.1Â 8.4; 1.5 7.2 5.9] what would be the result of the command length(x)? 5 3 3 5 5 3 a = 3 b = 5 a = 5 b = 3 15
5
Which of the following commands would produce a row array (matrix) consisting of the numbers 2 through 15 with increments of 0.2? I. 2:15:0.2II. 2:0.2:15III. linspace(2:0.2:15)IV. linspace(2,15,66)V. linspace(2:15:66) I only I and IV only I and V only II only II and V only III and V only II and IV only They will all produce the correct array.
II and IV only
What is stored in the variable secondrow after the following code segment is executed? x =[1 2 3; 4 5 6; 7 8 9]; [n1,n2] = size(x); counter = 0; for a = 1:n2 k = 1; while k<=a x(a,k) = 0; k = k+1; counter = counter+1; end end secondrow = x(2,:) [ 4 5 6] [6 5 4] [0 0 0] [0 0 6] [0 5 6] [4 0 0 ] [0 0 4]
[0 0 6]
Which of the following code segments would correctly display a message prompting the user to enter a value and then store the user's entry into the variable a? disp('Please enter a value for a' ) ans = a a = input('Please enter a value for a. ') a = disp ('Please enter a value for a. ') input('Please enter a value for a. ') = a disp('Please enter a value for a' ) a = ans
a = input('Please enter a value for a. ')
Given the array (matrix) x = [1.1 2.3 5.6; 2.4 9.8 4.9; 7.7 3.3 4.4; 10.2 6.1Â 8.4; 1.5 7.2 5.9] what would be stored in medianofx after the command below was executedmedianofx = median(x') a column array (matrix) containing the values 2.4, 6.1, and 5.6 a row array (matrix) containing the values 2.4, 6.1, and 5.6 a row array (matrix) containing the values 2.3, 4.9, 4.4, 8.4, and 5.9 a column array (matrix) containing the values 2.3, 4.9, 4.4, 8.4, and 5.9 an empty matrix
a row array (matrix) containing the values 2.3, 4.9, 4.4, 8.4, and 5.9
Suppose we knew that the sine of some angle was 0.7. Which command would determine the angle in degrees? sind(0.7) asin(0.7 ) asind(0.7) dsin(0.7) dasin(0.7) asine(0.7)
asind(0.7)
The MATLAB clear command ______________ -deletes all the commands in the Command History window -deletes all the variables stored in memory and shown in the Workspace window -deletes all the commands in the Workspace window -deletes all the variables stored in memory and shown in the Command window -deletes all the commands in the Command window
deletes all the variables stored in memory and shown in the Workspace window
By default, the sort() function will sort _____________________ in descending (high to low) order in ascending (low to high) order in random order
in ascending (low to high) order
The MATLAB function sin() expects the angle to be in ______ binary decimal degrees radians hexadecimal
radians
Error messages in MATLAB are shown in _____________ by default. blue yellow black red white purple
red
Given the row vector R = [1, 4, 2, 3, 5, 1, 2, 6, 4, 2, 4, 5], which of the following MATLAB commands would descendingly (high to low) sort the values in R? sort(R, 'descend') sortrows(R) sort(R') sort(R) sortrows(R, 'descend
sort(R, 'descend')
The MATLAB std() function is used to determine _____________ the average value in a set of numbers the standard deviation or how close the individual values are to the average of a set of numbers. the lowest (smallest) value in a set of numbers. the highest (largest) value in a set of numbers. the most frequently occurring value is a set of numbers.
the standard deviation or how close the individual values are to the average of a set of numbers.