Debug School

Akanksha
Akanksha

Posted on

Top 30 MATLAB Interview Questions with Answers multiple choice style

1. What does MATLAB stand for?

a) Mathematical Laboratory
b) Matrix Laboratory
c) Mathematical Analysis Tool Laboratory
d) Matrix Analysis Tool Laboratory
Answer: b) Matrix Laboratory

2. Which command is used to clear the MATLAB workspace?

a) clear
b) reset
c) clc
d) close
Answer: a) clear

3. Which MATLAB function is used to display text on the screen?

a) disp
b) display
c) print
d) show
Answer: a) disp

4. What is the extension for MATLAB script files?

a) .mat
b) .script
c) .m
d) .txt
Answer: c) .m

5. How do you comment a single line in MATLAB?

a) //
b) '''
c) #
d) %
Answer: d) %

6. Which function is used to read data from a text file in MATLAB?

a) readtable
b) importdata
c) load
d) readfile
Answer: b) importdata

7. What does the 'plot' function in MATLAB do?

a) Displays a histogram
b) Displays a scatter plot
c) Displays a line plot
d) Displays a bar plot
Answer: c) Displays a line plot

8. Which MATLAB function is used to find the square root of a number?

a) sqrt
b) squareroot
c) root
d) power
Answer: a) sqrt

9. Which command is used to save variables to a file in MATLAB?

a) store
b) save
c) savefile
d) export
Answer: b) save

10. In MATLAB, what does 'ans' represent?

a) Answer
b) Analysis
c) Array Name Summary
d) Algorithmic Notation System
Answer: a) Answer

11. Which function is used to concatenate arrays in MATLAB?

a) concat
b) join
c) merge
d) cat
Answer: d) cat

12. What is the output of 'mod(15, 7)' in MATLAB?

a) 1
b) 2
c) 3
d) 4
Answer: a) 1

13. Which function is used to generate a sequence of numbers in MATLAB?

a) linspace
b) range
c) sequence
d) numberseq
Answer: a) linspace

14. What is the purpose of the 'hold' function in MATLAB?

a) Holds the current plot
b) Holds the command window
c) Holds the workspace
d) Holds the variable value
Answer: a) Holds the current plot

15. Which MATLAB function is used to find the mean of an array?

a) mean
b) average
c) avg
d) m
Answer: a) mean

16. What does the 'eye' function in MATLAB generate?

a) Identity matrix
b) Zero matrix
c) Random matrix
d) Ones matrix
Answer: a) Identity matrix

17. Which MATLAB function is used to generate random numbers between 0 and 1?

a) rand
b) random
c) r
d) randint
Answer: a) rand

18. Which operator is used for matrix multiplication in MATLAB?

*a) **
b) x
c) mul
d) matrixmul
*Answer: a) **

19. What is the output of 'round(3.7)' in MATLAB?

a) 3
b) 4
c) 3.5
d) 4.5
Answer: b) 4

20. Which function is used to find the maximum value in an array in MATLAB?

a) max
b) maximum
c) maxvalue
d) findmax
Answer: a) max

21. What does the 'subplot' function in MATLAB do?

a) Creates subplots within a figure
b) Rotates the plot
c) Changes the plot color
d) Scales the plot
Answer: a) Creates subplots within a figure

22. Which MATLAB function is used to perform element-wise logical OR?

a) |
b) ||
c) or
d) logicalor
Answer: a) |

23. What does the 'ones' function in MATLAB generate?

a) Matrix of ones
b) Matrix of zeros
c) Matrix of random numbers
d) Identity matrix
Answer: a) Matrix of ones

24. Which function is used to compute the inverse of a matrix in MATLAB?

a) inv
b) inverse
c) invmatrix
d) computeinverse
Answer: a) inv

25. In MATLAB, what does 'pi' represent?

a) 3.142
b) 22/7
c) 3.1416
d) Mathematical constant π
Answer: d) Mathematical constant π

26. Which function is used to concatenate strings in MATLAB?

a) strcat
b) concatenate
c) concatstr
d) joinstr
Answer: a) strcat

27. What is the output of 'ceil(4.3)' in MATLAB?

a) 4
b) 5
c) 4.5
d) 5.5
Answer: b) 5

28. Which MATLAB function is used to create a cell array?

a) cell
b) createcell
c) cellarray
d) makecell
Answer: a) cell

29. What does the 'fliplr' function in MATLAB do?

a) Flips the matrix left to right
b) Flips the matrix up to down
c) Flips the plot horizontally
d) Flips the plot vertically
Answer: a) Flips the matrix left to right

30. Which MATLAB function is used to calculate the dot product of two vectors?

a) dot
b) dotproduct
c) vectorproduct
d) product
Answer: a) dot

Top comments (0)