Loops
Decision Structures
Matlab Basics
Matlab General
100

What loop structure would you use to iterate through each element of an array?

What is a for loop?

100

What keyword do you use to start a conditional statement in MATLAB?

What is if?

100

This command is used to clear all variables from the workspace in MATLAB.

What is clear?

100

This keyword is used to stop a loop.  

What is break?

200

What will happen if the condition of a while loop is always true?

What is that it will create an infinite loop?

200

This keyword is used to define an alternative path when the condition in an if statement is false.

What is else?

200

The symbol used to indicate matrix transposition in MATLAB.

What is the apostrophe (')?

200

This command is used to create a figure window for plotting.

What is figure()?

300

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?

300

This operator is used to compare two values for equality in an if statement.

What is ==?

300

To display a message or value in the Command Window, you would use this function.

What is disp()?

300

To label the X-axis of a plot, you would use this function.

What is xlabel()?

400

This function can help determine the number of iterations in a loop based on the size of an array.

What is length?

400

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?

400

This function returns the largest element in a vector.

What is max()?

400

This function creates a simple 2D line plot of given X and Y data.

What is plot()?

500

What is the output of the following code?

x = 1;

for i = 1:5

    x = x + i;

end

What is 16?

500

This operator is used to negate a condition in an if statement.

What is ~ (tilde)?

500

This operator is used for element-wise multiplication in MATLAB.

What is .*?

500

This function creates an array of random numbers.

What is randi()?