โ† All MATLAB Flashcard Decks

General MCQ Flashcards

7 cards from real MATLAB practice questions. Tap to flip, then mark Knew It or Still Learning โ€” missed cards come back until you master them.

Read the first 7 General MCQ flashcards as text
  1. In MATLAB, what does the function strcmp(s1, s2) return?

    Answer: 1 if strings are equal, 0 otherwise

    strcmp returns logical 1 (true) if s1 and s2 are identical, and logical 0 (false) otherwise.

  2. Which MATLAB function converts a numeric value to a string?

    Answer: num2str

    num2str converts a numeric array to a character array (string), with optional format control.

  3. What does the MATLAB function isempty(A) return when A = []?

    Answer: 1

    isempty returns 1 (true) when the array has any dimension of size zero, such as an empty matrix [].

  4. Which statement correctly defines an anonymous function for f(x) = x^2 + 1 in MATLAB?

    Answer: f = @(x) x^2 + 1

    Anonymous functions in MATLAB are created with the @ operator followed by the argument list and expression.

  5. What is the result of logical expression (3 > 2) & (5 < 4) in MATLAB?

    Answer: 0

    The & operator is element-wise AND; (3>2) is true and (5<4) is false, so true & false = 0.

  6. Which MATLAB function computes the eigenvalues and eigenvectors of a square matrix?

    Answer: eig(A)

    eig(A) returns the eigenvalues of A, and [V,D] = eig(A) returns eigenvectors V and diagonal eigenvalue matrix D.

  7. What does the MATLAB command 'whos' display?

    Answer: A list of current workspace variables with size, bytes, and class

    whos lists all variables in the current workspace along with their size, bytes, and data class.