Matlab Creating and Using Vectors Quiz
35 fundamental questions on creating, indexing, and manipulating row and column vectors in MATLAB.
Question 1
Which command creates a row vector containing the numbers 1, 2, and 3?
Question 2
How do you create a column vector with elements 4, 5, and 6?
Question 3
What does the expression '1:5' generate?
Question 4
What is the result of '1:2:7'?
Question 5
How do you access the second element of a vector named 'v'?
Question 6
What happens if you try to access index 0 in MATLAB (e.g., v(0))?
Question 7
If v = [10, 20, 30], what is the result of 'v + 5'?
Question 8
How do you transpose a row vector 'r' into a column vector?
Question 9
What is the result of '[1, 2] + [3, 4]'?
Question 10
Which command creates a vector counting down from 10 to 1?
Question 11
What is the length of the vector generated by '0:0.5:2'?
Question 12
If v = [1, 2, 3, 4, 5], what does 'v(2:4)' return?
Question 13
How do you concatenate two row vectors 'a' and 'b' horizontally?
Question 14
What is the result of 'v(end)'?
Question 15
If you try to add a row vector of length 3 to a column vector of length 3 (e.g., [1,2,3] + [1;2;3]), what happens in modern MATLAB?
Question 16
Which function returns the number of elements in a vector?
Question 17
How do you replace the third element of vector 'v' with the value 99?
Question 18
What does 'linspace(1, 10, 3)' generate?
Question 19
If v = [10, 20, 30, 40], what is 'v([1, 3])'?
Question 20
What is the result of 'v = []'?
Question 21
How do you delete the second element of a vector 'v'?
Question 22
What is the default step size for the colon operator if none is specified (e.g., 1:5)?
Question 23
Can a vector contain a mix of numbers and strings in MATLAB?
Question 24
What does 'v(end-1)' access?
Question 25
If v = [1, 2, 3], what is 'v * 2'?
Question 26
Which command creates a vector of five zeros?
Question 27
What is the result of 'sum([1, 2, 3])'?
Question 28
How do you reverse a vector 'v'?
Question 29
What happens if you assign a value to an index outside the current bounds? (e.g., v(10) = 5 where v has length 3)
Question 30
Which operator performs element-wise division?
Question 31
If A = [1, 2] and B = [3, 4], what is 'A .* B'?
Question 32
What is the result of 'ones(3, 1)'?
Question 33
How do you check if a vector is empty?
Question 34
What is the result of 'min([5, 2, 9])'?
Question 35
If v = [10, 20, 30], what is 'v( [true, false, true] )'?
