Shared Flashcard Set

Details

MATLAB Chapter 5 6 7
asd
36
Engineering
Undergraduate 2
10/05/2013

Additional Engineering Flashcards

 


 

Cards

Term
Ch5. All data used by a function must be passed in as parameters to the function.
Definition
False. Functions have access to all the system data and functions and can also reach global data directly.
Term
Ch5. The name of the first function in an m-file must match the name of the file containing its definition.
Definition
False. Although this ought to be True. MATLAB calls user-defined functions by the name of the m-file, and ignores the name specified there.
Term
Ch5. The first documentation line appears in the Current Directory listing.
Definition
True
Term
Ch5. Functions must consume at least one parameter.
Definition
False. Functions can be defined with no parameters required.
Term
Ch5. The calling code must provide assignments for every result returned from a function.
Definition
False. Any result for which a variable is not provided by the caller is ignored.
Term
Ch5. The names of auxiliary functions must being with local_
Definition
False. This is merely a convention suggested to clarify the source of their definition.
Term
Ch5. _____ permits a code block to be packaged and referred to collectively rather than individually.
Definition
Procedural Abstraction or Encapsulation
Term
Ch5. Values of the ________ parameters are copied to define the ________ parameters inside the function.
Definition
actual; formal
Term
Ch5. If more than one result is to be returned from a function, they are defined in a(n) ________.
Definition
vector-like container of variable names
Term
Ch5. ________ describes the situation where the variables within a function are not visible from outside, and the function is unable to cause side effects by making assignments to outside variables.
Definition
Local Scope
Term
Ch5. Calling code can only reach the ________ function in an m-file. Other functions in the m-file can only be called from the _______ or _______.
Definition
first; first function; other auxiliary functions in the same file
Term
Ch6. Casting changes the value of a piece of data.
Definition
False. Casting changes the way the computer views a piece of data without changing it.
Term
Ch6. The ASCII code maps individual characters to their internal numerical representation.
Definition
True
Term
Ch6. B/c the single quote mark (') delimits strings, you cannot use it within a string.
Definition
False. It can be represented within a string by inserting two successive quote marks:(' ')
Term
Ch6. If you attempt mathematical operations on a character string, MATLAB will throw an error.
Definition
False. MATLAB will automatically cast the string to its ASCII values first
Term
Ch6. The function disp(...) can display multiple values to the Command window.
Definition
True. But they have to be explicitly converted to characters and concatenated into one string
Term
Ch6. The function strcmp(...) throws an error if the two strings are of unequal length, unless one of them is a single character.
Definition
False. Unequal length strings are reported as not being equal
Term
Ch6. The switch statement will correctly compare strings of unequal length in the case tests.
Definition
True
Term
Ch6. Numerical values are stored in MATLAB in ________ for efficient numerical computation.
Definition
a special internal representation
Term
Ch6. Most common _________,________ and many _______ are represented in ASCII by the numbers _________.
Definition
characters; numbers; punctuation marks; 0-127
Term
Ch6.The function _______ casts a string to a vector of the same length as the string containing the numerical mapping of ________.
Definition
uint8(...); each letter
Term
Ch6. The function fprintf(...) requires a(n) _______ that defines exactly how the resulting string should be formatted and a variable number of _______.
Definition
format control string; value parameters
Term
Ch6. Since the ________ statement tests a logical expression, it _________ test strings of unequal length.
Definition
if; cannot
Term
Ch6. A special version of the cast function _______ accepts strings with different lengths, _________, and stores them in an array of characters.
Definition
char(...); pads them with blanks
Term
Ch7. Of all the collective operations defined for numerical arrays, only logical operations can be applied to a whole cell array.
Definition
False. None of the collective operations defined for numerical arrays can be applied to cell arrays or structures.
Term
Ch7. A cell array or a structure can contain any legal MATLAB object.
Definition
True
Term
Ch7. You gain access to the contents of a cell by using, {...}.
Definition
True
Term
Ch7. Since the contents of a structure are heterogeneous, we can store other structures in any structure.
Definition
True
Term
Ch7. The statement rmfield(str, 'price') removes the field 'price' and its value from the structure str.
Definition
False. It returns a new structure with the field and value removed.
Term
Ch7. The statement getfield(str, ) returns the value of the specified field.
Definition
True.
Term
Ch7. You cannot extract and process all of the values of a field in a structure array.
Definition
False. If stra is a structure array with the field data, the expression {stra.data} will extract all the values into a cell array.
Term
Ch7. To perform any operations on the contents of a heterogeneous collection, the items must be _______ and if necessary _________.
Definition
extracted one at a time; replaced
Term
Ch7. Cell arrays can be treated for the purpose of concatenation and slicing as ________ of _________.
Definition
arrays; containers
Term
Ch7. The assignment B{3} = {42} results in the third entry in the cell array B being a(n) ________.
Definition
cell containing 42
Term
Ch7. If a variable called field contains the name of a field in a structure str, the expression _______ will set the value of that field to 42.
Definition
str.(field) = 42
Term
Ch7. MATLAB has built-in function _________ that consumes pairs of entries, each consisting of a(n) ________ and a(n) ________, and produces a structure array.
Definition
struct(...); field name as a string; cell array of field contents
Supporting users have an ad free experience!