← 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. What is the MATLAB syntax to access elements in a struct field named 'age' of variable 'person'?

    Answer: person.age

    MATLAB uses dot notation to access struct fields, so person.age retrieves the 'age' field of the struct 'person'.

  2. Which MATLAB function is used to solve a system of linear equations Ax = b?

    Answer: A \ b

    The backslash operator A\b computes the solution to the linear system Ax=b efficiently without explicitly computing the inverse.

  3. What does the function cell2mat do in MATLAB?

    Answer: Converts a cell array of matrices into a single matrix

    cell2mat concatenates the contents of a cell array of numeric arrays into a single numeric matrix.

  4. In MATLAB, which loop type checks the condition AFTER executing the loop body at least once?

    Answer: MATLAB has no such loop

    MATLAB does not have a built-in do-while loop; both for and while loops check their conditions before each iteration.

  5. What is the purpose of the 'nargin' variable inside a MATLAB function?

    Answer: Number of input arguments passed to the function

    nargin returns the number of input arguments provided by the caller, allowing functions to handle optional inputs.

  6. Which MATLAB function applies a given function to each element of an array and returns the results?

    Answer: arrayfun

    arrayfun applies a function to each element of an array and collects the results into an output array of the same size.

  7. What does the MATLAB function 'reshape(A, m, n)' do?

    Answer: Rearranges elements of A into an m×n matrix without changing data

    reshape rearranges the elements of A column-by-column into a new matrix of size m×n; the total number of elements must remain the same.