Download as pdf or txt
Download as pdf or txt
You are on page 1of 7

SOLICAR ENGINEERING REVIEW CENTER AND SERVICES

Sample Questions:
1. What does MATLAB stand for?

A) Math Analysis Language Tool


B) Matrix Analysis Language Tool
C) Mathematical Analysis Language
D) Matrix Laboratory

2. Which command in MATLAB is used to create a new variable?

A) new
B) var
C) create
D) let

3. What is the default extension of a MATLAB script file?

A) .mat
B) .m
C) .md
D) .txt

4. Which of the following statements is used to create a for loop in MATLAB?

A) while
B) do-while
C) for
D) repeat-until

5. Which command in MATLAB is used to display the contents of a variable?

A) show
B) display
C) disp
D) print

6. What is the result of the following expression in MATLAB: 3 + 5 * 2

A) 16
B) 13
C) 11
D) 15

7. Which of the following commands is used to create a matrix with all elements set to 0?

A) zeros
B) ones
C) eye
D) rand
8. Which of the following commands is used to calculate the square root of a number in MATLAB?

A) sqrt
B) root
C) power
D) exp

9. Which of the following commands is used to generate a random number in MATLAB?

A) random
B) rand
C) randn
D) randomize

10. Which of the following commands is used to read input from the user in MATLAB?

A) input
B) read
C) readln
D) get

11. What is the result of the following code in MATLAB:

a = [1 2 3; 4 5 6];
b = [7 8 9; 10 11 12];
c = a + b;

A) [8 10 12; 14 16 18]
B) [7 8 9 10 11 12]
C) [7 10 12; 14 16 18]
D) [8 11 14; 17 20 23]

12. Which command in MATLAB is used to create a plot?

A) plot
B) createplot
C) drawplot
D) makeplot

13. Which of the following commands is used to find the maximum element of a matrix in MATLAB?

A) min
B) max
C) maximum
D) findmax

14. Which of the following commands is used to concatenate two matrices vertically in MATLAB?

A) horzcat
B) vertcat
C) cat
D) merge

15. Which of the following commands is used to calculate the dot product of two vectors in MATLAB?

A) dot
B) cross
C) inner
D) product

16. What is the result of the following code in MATLAB:

x = 1:5;
y = x.^2;

A) x = [1 2 3 4 5], y = [1 4 9 16 25]
B) x = [1 2 3 4 5], y = [2 4 6 8 10]
C) x = [1 2 3 4 5], y = [1 2 3 4 5]
D) x = [1 2 3 4 5], y = [1 3 5 7 9]

17. Which of the following commands is used to convert a string to uppercase in MATLAB?

A) upper
B) toUpperCase
C) toUpper
D) uppercase

18. Which of the following commands is used to round a number to the nearest integer in MATLAB?

A) round
B) ceil
C) floor
D) fix

19. Which of the following commands is used to find the indices of the non-zero elements in a matrix in MATLAB?

A) nonzero
B) find
C) index
D) locate

20. What is the result of the following code in MATLAB:

x = 0:pi/10:2*pi;
y = sin(x);

A) x is a vector with 11 elements, y is a vector with 11 elements


B) x is a vector with 21 elements, y is a vector with 21 elements
C) x is a vector with 11 elements, y is a vector with 21 elements
D) x is a vector with 21 elements, y is a vector with 11 elements
21. Which of the following commands is used to generate a random number between 0 and 1 in MATLAB?

A) random
B) rand
C) randomize
D) randn

22. Which of the following commands is used to calculate the inverse of a matrix in MATLAB?

A) inverse
B) inv
C) transpose
D) invert

23. Which of the following commands is used to calculate the square root of a number in MATLAB?

A) sqrt
B) square
C) squareroot
D) root

24. Which of the following commands is used to calculate the transpose of a matrix in MATLAB?

A) transpose
B) trans
C) t
D) tr

25. What is the result of the following code in MATLAB:

x = [1 2; 3 4];
y = [5 6; 7 8];
z = x*y;

A) z = [7 10; 15 22]
B) z = [19 22; 43 50]
C) z = [11 14; 23 26]
D) z = [12 15; 18 21]

26. Which of the following commands is used to calculate the determinant of a matrix in MATLAB?

A) det
B) determinant
C) detmat
D) matdet

27. Which of the following commands is used to calculate the mean of a matrix in MATLAB?

A) mean
B) avg
C) average
D) matmean

28. Which of the following commands is used to calculate the standard deviation of a matrix in MATLAB?

A) stddev
B) stdev
C) std
D) deviation

29. Which of the following commands is used to create a diagonal matrix in MATLAB?

A) diag
B) diagonal
C) diags
D) matdiag

30. What is the result of the following code in MATLAB:

x = [1 2 3];
y = [4 5 6];
z = [7 8 9];
a = [x; y; z];

A) a = [1 2 3; 4 5 6; 7 8 9]
B) a = [1 4 7; 2 5 8; 3 6 9]
C) a = [1 2 3 4 5 6 7 8 9]
D) a = [1 2 3; 4 5 6; 7 8 9;]

31. Which of the following commands is used to find the maximum value in a matrix in MATLAB?

A) maxval
B) max
C) maximum
D) matmax

32. Which of the following commands is used to find the minimum value in a matrix in MATLAB?

A) minval
B) min
C) minimum
D) matmin

33. Which of the following commands is used to calculate the dot product of two vectors in MATLAB?

A) dot
B) product
C) dotprod
D) vecdot
34. Which of the following commands is used to calculate the cross product of two vectors in MATLAB?

A) crossprod
B) cross
C) veccross
D) xprod

35. Which of the following commands is used to calculate the norm of a vector in MATLAB?

A) norm
B) vecnorm
C) vectornorm
D) normvec

36. Which of the following commands is used to calculate the eigenvalues of a matrix in MATLAB?

A) eig
B) eigen
C) eigm
D) mat_eig

37. Which of the following commands is used to create a sparse matrix in MATLAB?

A) spr
B) sparse
C) sparsify
D) sp_matrix

38. Which of the following commands is used to resize an array in MATLAB?

A) size
B) reshape
C) resize
D) arrayresize

39. Which of the following commands is used to concatenate two matrices horizontally in MATLAB?

A) horzcat
B) cat
C) concat
D) hcat

40. Which of the following commands is used to concatenate two matrices vertically in MATLAB?

A) vertcat
B) cat
C) concat
D) vcat
41. Which of the following commands is used to generate a random number between 0 and 1 in MATLAB?

A) rand
B) randn
C) randi
D) random

42. Which of the following commands is used to generate a random integer between two specified values in MATLAB?

A) rand
B) randn
C) randi
D) random

43. Which of the following commands is used to generate an array of normally distributed random numbers in
MATLAB?

A) rand
B) randn
C) randi
D) random

44. Which of the following commands is used to round a number up to the nearest integer in MATLAB?

A) ceil
B) floor
C) round
D) int

45. Which of the following commands is used to round a number down to the nearest integer in MATLAB?

A) ceil
B) floor
C) round
D) int

46. Which of the following commands is used to create a plot in MATLAB?

A) plot
B) createplot
C) plotgraph
D) drawplot

47. Which of the following commands is used to create a scatter plot in MATLAB?

A) plot
B) scatter
C) scatterplot
D) plotscatter

You might also like