MATLAB_Questions
MATLAB_Questions
11. Plotting
48. How can you generate a vector of random integers between 1 and 10?
a) randint(1,10)
b) rand(1,10)
c) randi([1,10])
d) randint(10)
Answer: c) randi([1,10])
49. What does the command diag([1, 2, 3]) return?
a) [1 2 3]
b) A 3x3 diagonal matrix
c) A 2x2 diagonal matrix
d) Error
Answer: b) A 3x3 diagonal matrix
50. Which function is used to calculate the cross product of two vectors?
a) dot()
b) cross()
c) mult()
d) vectorprod()
Answer: b) cross()
51. What is the default value for the step in start:step:end if step is not provided?
a) 0
b) 1
c) -1
d) Undefined
Answer: b) 1
81. Which command is used to pause execution for a specific amount of time?
a) pause()
b) wait()
c) halt()
d) sleep()
Answer: a) pause()
93. How can you find the indices of non-zero elements in a matrix?
a) nonzero(A)
b) find(A)
c) index(A)
d) locate(A)