MATLAB Quiz
Fast practice, instant feedback. Timer auto-submits when time’s up.
Avg score: 5% Most missed: “Which code snippet sets a new random seed based on the current time and saves th…”

MATLAB MCQs For LinkedIn Skill Assessments.

MATLAB is a proprietary multi-paradigm programming language and numeric computing environment.

MATLAB Quiz
Time left 00:00
25 Questions

1. Which choice is correct syntax for a 'switch' statement?
2. How is the random seed for MATLAB's random number generator first initializedin a MATLAB Session?
3. Which choice is the correct syntax for declaring a function that returns the input value as the output?
4. What kind of files are stored with the .mat extension?
5. At what will MATLAB look first for a called function?
6. Which choice adds 'b' to each row of 'a'?

a = ones(4, 4);
b= [1 2 3 4];
7. Which choice is the proper syntax to append a new elements 'a' to the end of 1x 2 dimensional cell array 'C'?
8. Which choice has a different final result in 'f10' than the other three?
9. What is the size of 'b'?

a = [1 2 3];
b = repmat(a,2,3);
10. You have a matrix 'data' in which each column is mono audio recording from a room in your house. You've noticed that each column has a very different mean and when you plot them all on the same graph, the spread across the y axis make it impossible to see anything. You want to subtract the mean from each column. Which code block will accomplish this?
11. Which code block contains the correct syntax for a 'while' loop?
12. Which is NOT a function that adds text to a plot?
13. Which statement turns 'menu' into the variable 'menu_string' below?

menu = {'hot dog' 'corn dog' 'regular burger' 'cheeseburger' 'veggie burger'}
menu_string =
'hot dog
corn dog
regular burger
cheeseburger
veggie burger'
14. What do you call in the 'command' window to see all the variables in the workspace and their classes?
15. You've just plotted some data and want to change the color behind the lines you've plotted to black. Which code block will accomplish this?
16. What built-in definition does i have?
17. You have loaded a dataset of people's heights into a 100 x 1 array called 'height'. Which statement will return a 100 x 1 array, 'sim_height', with values from a normal distribution with the same mean and variance as your height data?
18. What is the state of a at the end of this code?

a = [1 2; 3 4];
b = a(:,2);
c = b + 3;
a(1:2,1) = c;


a =
6 3
7 4
19. Which function CANNOT be used to randomly sample data?
20. Which statement reverses vector 'a'?

a = [ 1 2 3 4];
21. For which of these arrays do 'mean', 'median', and 'mode' return the same value?
22. In MATLAB, the 'imfilter' command performs a convolution operation between an image and a matrix. Suppose you have an image loaded in MATLAB into the variable 'img' and you apply the following code. The original image appears slightly blurred because the convolution smoothed out the image (removed noise). Why do you think this happened?

h = ones(5,5)/25;
imshow(imfilter(img,h));
23. What does the Profiler track?
24. Which statement creates a logical array that is 1 if the element in 'passwords' contains a digit and 0 if it does not?
'passwords = {'abcd' '1234' 'qwerty' 'love1'};'
25. How do you access the value for the field 'name' in structure S?