Bird
0
0

Consider the code:

medium📝 Predict Output Q5 of 15
MATLAB - Cell Arrays and Structures
Consider the code:
C = {10, 20, 30};
result = C(2);

What is the class of result?
Adouble
Blogical
Cchar
Dcell
Step-by-Step Solution
Solution:
  1. Step 1: Understand parentheses indexing

    C(2) returns a cell array containing the second cell, not the content.
  2. Step 2: Determine class of result

    Since parentheses return a cell array subset, result is of class cell.
  3. Final Answer:

    cell -> Option D
  4. Quick Check:

    Parentheses indexing returns cell array class = B [OK]
Quick Trick: Parentheses keep cell type, curly braces extract content type [OK]
Common Mistakes:
  • Assuming result is numeric (double)
  • Confusing cell array with content type

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More MATLAB Quizzes