Data Types and Structures 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 Data Types and Structures flashcards as text
What does the `containers.Map` class provide in MATLAB?
Answer: A key-value data structure similar to a dictionary or hash map
`containers.Map` implements a hash map allowing lookup of values by arbitrary key types.
How do you remove a field `z` from struct `s` in MATLAB?
Answer: rmfield(s, 'z')
`rmfield(s, 'z')` returns a new struct without the field `z`; it does not modify `s` in place.
What is the output of `class(true)` in MATLAB?
Answer: 'logical'
MATLAB's Boolean type is called `logical`, so `class(true)` returns `'logical'`.
Which function checks if all elements in a logical array are true?
Answer: all()
`all()` returns true only if every element is nonzero/true, while `any()` returns true if at least one element is.
What is the byte size of a `double` value in MATLAB?
Answer: 8 bytes
`double` is a 64-bit (8-byte) floating-point type conforming to IEEE 754.
How do you vertically concatenate two cell arrays `A` and `B` of equal column count?
Answer: [A; B]
The semicolon in `[A; B]` concatenates cell arrays vertically, just like numeric arrays.
Which MATLAB function returns the data type of a variable as a character vector?
Answer: class()
`class(x)` returns a character vector such as `'double'`, `'char'`, or `'cell'` describing the variable's type.