MATLAB for Mathematicians MCQs

By: Prof. Dr. Fazal Rehman Shamil | Last updated: November 25, 2024

Q1: In MATLAB, what is the purpose of the “syms” command?

  • (A) To define symbolic variables
  • (B) To define numerical arrays
  • (C) To create a function handle
  • (D) To plot a function

Answer: (A) To define symbolic variables


Q2: What does the MATLAB function “eig” compute?

  • (A) Eigenvalues and eigenvectors of a matrix
  • (B) The inverse of a matrix
  • (C) Determinant of a matrix
  • (D) Rank of a matrix

Answer: (A) Eigenvalues and eigenvectors of a matrix


Q3: Which MATLAB function is used to solve a system of linear equations using LU decomposition?

  • (A) linsolve
  • (B) lu
  • (C) inv
  • (D) linsolveLU

Answer: (A) linsolve


Q4: In MATLAB, what does the “fft” function compute?

  • (A) Fourier Transform of a signal
  • (B) Fast Fourier Transform of a signal
  • (C) Inverse Fourier Transform of a signal
  • (D) Laplace Transform of a signal

Answer: (B) Fast Fourier Transform of a signal


Q5: In MATLAB, which of the following is the correct way to create a column vector from the elements 1, 2, 3, 4?

  • (A) [1 2 3 4]’
  • (B) [1; 2; 3; 4]
  • (C) [1 2 3 4]
  • (D) (1, 2, 3, 4)

Answer: (B) [1; 2; 3; 4]


Q6: Which MATLAB command would you use to find the condition number of a matrix?

  • (A) cond(A)
  • (B) inv(A)
  • (C) det(A)
  • (D) rank(A)

Answer: (A) cond(A)


Q7: What is the output of the following MATLAB code: “x = linspace(0, 10, 5)”?

  • (A) A 1×5 vector with values from 0 to 10 linearly spaced
  • (B) A 5×1 vector with values from 0 to 10
  • (C) A 10×1 vector with values from 0 to 10
  • (D) A 5×5 matrix

Answer: (A) A 1×5 vector with values from 0 to 10 linearly spaced


Q8: In MATLAB, what does the “meshgrid” function do?

  • (A) Generates matrices for 3D plotting
  • (B) Creates a mesh of points for surface plots
  • (C) Solves a system of linear equations
  • (D) Plots 2D data

Answer: (B) Creates a mesh of points for surface plots


Q9: What is the result of running the command “A = rand(3)” in MATLAB?

  • (A) A 3×3 matrix with random integers
  • (B) A 3×3 matrix with random values between 0 and 1
  • (C) A 3×3 matrix with random values between -1 and 1
  • (D) A 3×3 matrix with random values between 0 and 10

Answer: (B) A 3×3 matrix with random values between 0 and 1


Q10: What is the purpose of the “fsolve” function in MATLAB?

  • (A) To solve a system of nonlinear equations
  • (B) To solve a system of linear equations
  • (C) To compute the Fourier transform
  • (D) To find the inverse of a matrix

Answer: (A) To solve a system of nonlinear equations