Basic Introduction Flashcards
7 cards from real MATLAB practice questions. Tap to flip, then mark Knew It or Still Learning — missed cards come back until you master them.
Read the first 7 Basic Introduction flashcards as text
In MATLAB, what value does the built-in constant 'pi' represent?
Answer: 3.14159265358979...
pi is a built-in MATLAB constant holding the double-precision value of π ≈ 3.14159265358979.
Which command removes all variables from the MATLAB workspace?
Answer: clear all
clear all removes all variables and functions from the workspace memory.
What is the output of size([1 2 3; 4 5 6]) in MATLAB?
Answer: [2 3]
size() returns a row vector [rows cols]; the 2×3 matrix yields [2 3].
How do you concatenate two row vectors A = [1 2] and B = [3 4] horizontally in MATLAB?
Answer: [A, B]
Using a comma or space inside brackets [A, B] concatenates vectors horizontally to give [1 2 3 4].
What does the 'end' keyword refer to when used as an index in MATLAB?
Answer: The last element of the array dimension
When used in indexing, end refers to the last index of the dimension being accessed.
Which MATLAB function returns the number of elements in an array?
Answer: numel()
numel() returns the total number of elements in an array, equivalent to prod(size(A)).
What type of variable does MATLAB use by default for numeric values?
Answer: double
MATLAB stores numeric values as double-precision (64-bit) floating-point by default.