← All MATLAB Flashcard Decks

Basic Introduction 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 Basic Introduction flashcards as text
  1. What symbol is used to start a comment in a MATLAB script?

    Answer: %

    The percent sign (%) starts a comment in MATLAB; everything after it on the same line is ignored.

  2. Which of the following creates a 3×3 identity matrix in MATLAB?

    Answer: eye(3)

    eye(n) creates an n×n identity matrix with ones on the diagonal and zeros elsewhere.

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

    Answer: Both 'true' and 1

    MATLAB returns logical 1 for true comparisons; logical 1 and the string 'true' are equivalent representations.

  4. Which MATLAB function computes the square root of a number?

    Answer: sqrt(x)

    sqrt(x) is the dedicated MATLAB function for computing the square root of x.

  5. How does MATLAB index arrays — starting from 0 or 1?

    Answer: 1, unlike most languages

    MATLAB arrays are 1-indexed, meaning the first element is at index 1, not 0.

  6. What does the command 'who' display in MATLAB?

    Answer: A list of variable names in the workspace

    who lists the names of all variables currently defined in the MATLAB workspace.

  7. In MATLAB, what is the difference between '==' and '='?

    Answer: '=' assigns a value; '==' tests equality

    The single '=' is the assignment operator, while '==' is the relational equality comparison operator.