What loop structure would you use to iterate through each element of an array?
What is a for loop?
What keyword do you use to start a conditional statement in MATLAB?
What is if?
This command is used to clear all variables from the workspace in MATLAB.
What is clear?
This keyword is used to stop a loop.
What is break?
This kind of error shows up as soon as you run the code, for example a misspelled function name.
What is a syntax error?
What will happen if the condition of a while loop is always true?
What is that it will create an infinite loop?
This keyword is used to define an alternative path when the condition in an if statement is false.
What is else?
The symbol used to indicate matrix transposition in MATLAB.
What is the apostrophe (')?
This command is used to create a figure window for plotting.
What is figure()?
Trying to open a spreadsheet that is not in the current folder triggers this kind of error.
What is a runtime (dynamic) error?
What is the main difference between for and while loops?
What is that for loops iterate a specific number of times, while while loops continue until a condition is false?
This operator is used to compare two values for equality in an if statement.
What is ==?
To display a message or value in the Command Window, you would use this function.
What is disp()?
To label the X-axis of a plot, you would use this function.
What is xlabel()?
The code runs with no error message but the answer is wrong. Name the error type and say why it is the hardest to find.
A logical error. MATLAB cannot know your algorithm is wrong, so you must compare with a known solution.
This function can help determine the number of iterations in a loop based on the size of an array.
What is length?
What is the purpose of the else keyword in a decision structure?
What is to provide an alternative action when the if condition is false?
This function returns the largest element in a vector.
What is max()?
This function creates a simple 2D line plot of given X and Y data.
What is plot()?
A and B are both 1x3 and you get 'Incorrect dimensions for matrix multiplication' for A*B. Which operator did you probably mean?
The element-wise operator. .*
What is the output of the following code?
x = 1;
for i = 1:5
x = x + i;
end
What is 16?
This operator is used to negate a condition in an if statement.
What is ~ (tilde)?
This operator is used for element-wise multiplication in MATLAB.
What is .*?
This function creates an array of random numbers.
What is randi()?
Your while loop never ends and MATLAB is frozen. What key combination stops it?
What is Ctrl + C?