Bird
0
0

What will be the output of this MATLAB code?

medium📝 Predict Output Q5 of 15
MATLAB - Cell Arrays and Structures
What will be the output of this MATLAB code?
data = {3.14, 'dog', [1 2 3]};
disp(class(data))
Achar
Bcell
Cdouble
Darray
Step-by-Step Solution
Solution:
  1. Step 1: Identify the variable type

    Variable data is created using curly braces {}, so it is a cell array.
  2. Step 2: Check class function output

    class(data) returns 'cell' because data is a cell array container.
  3. Final Answer:

    cell -> Option B
  4. Quick Check:

    Container type = cell [OK]
Quick Trick: class() on cell array returns 'cell' [OK]
Common Mistakes:
  • Thinking class returns type of first element
  • Confusing cell with numeric or char
  • Expecting 'array' which is not a MATLAB class

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes