← 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. Which MATLAB function returns the size of each dimension of an array?

    Answer: size(A)

    size(A) returns a row vector whose elements are the lengths of the corresponding dimensions of A.

  2. What does the MATLAB expression A(end, :) return?

    Answer: The last row of A

    The keyword 'end' refers to the last index in a dimension, so A(end, :) selects the last row and all columns.

  3. Which operator performs element-wise multiplication in MATLAB?

    Answer: .*

    The .* operator multiplies corresponding elements of two arrays, whereas * performs matrix multiplication.

  4. What is the output of mod(10, 3) in MATLAB?

    Answer: 1

    mod(10, 3) returns 1, the remainder when 10 is divided by 3 (10 = 3×3 + 1).

  5. Which MATLAB command is used to clear all variables from the workspace?

    Answer: clear

    The clear command removes all variables from the current workspace; clc only clears the Command Window text.

  6. How do you create a column vector of values from 1 to 10 with step 2 in MATLAB?

    Answer: (1:2:10)'

    The expression (1:2:10)' creates the row vector [1 3 5 7 9] and transposes it into a column vector.

  7. What function would you use to find the maximum value in each column of a matrix M?

    Answer: max(M, [], 1)

    max(M, [], 1) operates along dimension 1 (rows), returning the maximum of each column.