Programming:Function and Classes Assignment
- Country :
Australia
Q1. From what distribution does the rand() function return value?
a. normal
b. poisson
c. binomial
d. uniform
Q2. Based on the code below, c is the _ of a.
a = rand(1, 11);
b = sort(a);
c = b(1, ceil(end/2));
a. median
b. mode
c. mean
d. margin
Q3. What does the Profiler track?
a. execution time
b. command history
c. errors
d. the value of variables
Q4. Which code block contains the correct syntax for a while loop?
a. a = 0;
do
a = a + 1;
while a < 5> end
b. a = 0;
while(a < 5> a = a + 1;
c. a = 0;
while a < 5> a = a + 1;
d. a = 0;
while a < 5> a = a + 1;
end
Q5. What does b contain?
a.
b.
Q6. You have written a function myfun and want to measure how long it takes to run. Which code segment will return in t the time in seconds it takes myfun to run?
a. t = cputime(myfun());
b. tic;
myfun();
toc;
c. timer.start;
myfun()
t = timer.stop;
d. t = timer(myfun());
Q7. What is %% used for?
a. argument placeholder
b. block quotes
c. code sections
d. conversion specifier
Q8. what is the . character NOT used for?
a. structure field access
b. a decimal point
c. cell array access
d. element-wise operations
Q9. Which function could you use for multiple linear regression?
a. polyval
b. regress
c. solve
d. polyfit
Q10. For which of these arrays do mean, median, and mode return the same value?
a. [0 1 1 1 2]
b. [1 3 5 5 6]
c. [0 1 1 1 1]
d. [0 0 5 5 5]
Q11. You are in the middle of a long MATLAB session where you have performed many analyses and made many plots. You run the following commands, yet a figure window doesn't pop up on the top of your screen with your plot. What might be the issue?
x = [-1:0.1:1];
y = X.^2;
plot(x, y)
a. Your plot doesn't plot in a figure window because figure was not called immediately in advance.
b. Your plot syntax is incorrect.
c. Your plot is in a figure window that was already open, hidden behind other windows on your screen.
d. Your plot was saved to an image file but not displayed.
Q12. How do you access the value for the field name in structure S?
a. S['name']
b. S.name
c. S('name')
d. S{'name'}
Q13. What built-in definition does i have?
a. basic imaginary unit
b. index function
c. infinity
d. index variable
Q14. Which statement is equivalent to this for loop?
a = [1 2 3; 4 5 6];
b = zeros(size(a));
for i_row = 1:size(a, 1)
for i_col = 1:size(a, 2)
b(i_row, i_col) = a(i_row, i_col)^2;
end
end
a. b = a*a;
b. b = a.^2;
c. b = a^2;
d. b = pow2(a);
Q15. You have plotted values of cosine from -10 to 10 and want to change the x-axis tick marks to every pi, from -3pi to 3pi. Which statement will do that?
a. xticks(-3pi:3.14:3pi)
b. xticks(-3pi:pi:3pi)
c. xticks(linespace(-3pi(), 3pi(), pi()))
d. xticks(linespace(-3pi, 3pi, pi)
Q16. What is the value of c?
a = ones(1,3);
b = 1:3;
c = conv(a,b)
a. [-1 2 -1]
b. [1 3 6 5 3]
c. 6
d. [1 -2 1]
Q17. Which function CANNOT be used to randomly sample data?
a. datasample
b. randi
c. resample
d. randperm
Q18. Which choice is correct syntax for a switch statement?
a. x = 7;
switch x
case 2
disp("two");
otherwise
disp("not two");
end
b. x = 7;
switch x :
case 2
disp("two");
otherwise
disp("not two");
end
c. x = 7;
switch x
case 2
disp("two");
else
disp("not two");
end
d. x = 7;
switch x
case 2
disp("two");
default
disp("not two");
end
Q19. What is the result of this code?
a = 1;
b = 2;
c = 3;
d = 4;
e = c / (~a - b == c - d);
a. Error
b. c = NaN
c. c = Inf
d. c = -0.2500
Q20. What is true of a handle class object?
a. When you pass a handle object to a function, a new object is made that is independent of the original.
b. All copies of handle objects refer to the same underlying object.
c. Handle object cannot reference one another.
d. Handle object do not have a default eq function.
Get your Computer Programming assignment solved by our Matlab Experts from Exam Question Bank . Our Assignment Writing Experts are efficient to provide a fresh solution to all question. We are serving more than 10000+ Students in Australia, UK & US by helping them to score HD in their academics. Our Experts are well trained to follow all marking rubrics & referencing Style. Be it a used or new solution, the quality of the work submitted by our assignment experts remains unhampered.
You may continue to expect the same or even better quality with the used and new assignment solution files respectively. Theres one thing to be noticed that you could choose one between the two and acquire an HD either way. You could choose a new assignment solution file to get yourself an exclusive, plagiarism (with free Turn tin file), expert quality assignment or order an old solution file that was considered worthy of the highest distinction.