• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/50

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

50 Cards in this Set

  • Front
  • Back
1. MATLAB keywords are colored green by the editor.
1. False.

Comments are colored green; keywords that control execution are colored blue.
2. Indentation is required in MATLAB to define code blocks.
2. False.

The MATLAB editor inserts indentation only to clarify for the reader the flow of control in a script.
3. It is possible that no code at all is executed by 'if' or 'switch' constructs.
3. True.

If the if statement has no else clause, or the switch statement has no otherwise clause and the data provided matches none of the specified cases.
4. The word 'true' is a valid logical expression.
4. True.
5. When evaluating a sequence of logical && expressions, MATLAB will stop processing when it finds the first true result.
5. False.

The result that invalidates all other && expressions is false.
6. The for loop repeats the enclosed code block a fixed number of times even if you modify the index variable within the code block.
6. True.

But you can still use break to exit the loop early.
7. Using a break statement is illegal in a while loop.
7. False.

But it ought to be. This is really bad programming practice.
8. The logical expression used in a while loop specifies the conditions for exiting the loop.
8. False.

The expression specifies the reason to stay in the loop.
1. MATLAB uses __________ in the text to define the extent of code blocks.
1. key command words
2. The function __________ is implicitly called by MATLAB if you supply a vector of logical values to the if statement.
2. all(...)
3. It is good practice to include __________ in a switch
statement to trap illegal values entering the switch.
3. otherwise
4. There is no reason to evaluate any more components of a logical or expression once a __________ result has been found.
4. true
5. A while loop can be repeated a ___________ number of times, depending on the ___________ being processed.
5.
variable;
values of data
6. If you are in a __________ loop, you can use the break
statement to skip immediately out of the __________ loop.
6.
for or while;
innermost containing
1. All data used by a function must be passed in as parameters to the function.
1. False.

Functions have access to all the system data and functions, and can also reach global data directly.
2. The name of the first function in an m-file must match the name of the file containing its definition.
2. 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.
3. The first documentation line appears in the Current Directory listing.
3. True.
4. Functions must consume at least one parameter.
4. False.

Functions can be defined with no parameters required.
5. The calling code must provide assignments for every result returned from a function.
5. False.

Any result for which a variable is not provided by the caller is ignored.
6. The names of auxiliary functions must begin with local_.
6. False.

This is merely a convention suggested to clarify the source of their definition.
1. _________ permits a code block to be packaged and
referred to collectively rather than individually.
1. Procedural abstraction
2. Values of the __________ parameters are copied to define the __________ parameters inside the function.
2.
actual;
formal
3. If more than one result is to be returned from a function, they are defined in a __________ .
3. vector-like container of variable names
4. __________ 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.
4. Local Scope
5. Calling code can only reach the __________ function in an m-file. Other functions in the m-file can only be called from the __________ or ___________ .
5.
first;
first function;
other auxiliary functions in the same file
1. Casting changes the value of a piece of data.
1. False.

Casting changes the way the computer views a piece of data without
changing it.
2. The ASCII code maps individual characters to their internal numerical representation.
2. True.
3. Because the single quote mark ( ' ) delimits strings, you cannot use it within a string.
3. False. It can be represented within a string by inserting two successive quote marks: (' ').
4. If you attempt mathematical operations on a character string, MATLAB will throw an error.
4. False.

MATLAB will automatically cast the string to its ASCII values first.
5. The function disp(...) can display multiple values to the Command window.
5. True.

But they have to be explicitly converted to characters and concatenated into one string.
6. The function strcmp(...) throws an error if the two strings are of unequal length, unless one of them is a single character.
6. False.

Unequal length strings are reported as not being equal.
7. The switch statement will correctly compare strings of unequal length in the case tests.
7. True.
1. Numerical values are stored in MATLAB in ___________ for efficient numerical computation.
1. a special internal representation
2. Most common __________ , __________ , and many __________ are represented in ASCII by the numbers __________ .
2.
characters;
numbers;
punctuation marks;
0–127
3. The function __________ casts a string to a vector of the same length as the string containing the numerical mapping of __________.
3.
uint8(...);
each letter
4. The function fprintf(...) requires a ___________ that
defines exactly how the resulting string should be formatted and a variable number of __________.
4.
format control string;
value parameters
5. Since the __________ statement tests a logical expression, it ___________ test strings of unequal length.
5.
if;
cannot
6. A special version of the __________ cast function accepts strings with different lengths, ___________ , and stores them in an array of characters.
6.
char(...);
pads them with blanks
1. Of all the collective operations defined for numerical arrays, only logical operations can be applied to a whole cell array.
1. False.

None of the collective operations defined for numerical arrays can be applied to cell arrays or structures.
2. A cell array or a structure can contain any legal MATLAB object.
2. True.
3. You gain access to the contents of a cell by using braces, {...}.
3. True.
4. Since the contents of a structure are heterogeneous, we can store other structures in any structure.
4. True.
5. The statement rmfield(str, 'price') removes the field 'price' and its value from the structure str.
5. False. It returns a new structure with the field and value removed.
6. The statement getfield(str, <fldname>) returns the value of the specified field.
6. True.
7. You cannot extract and process all of the values of a field in a structure array.
7. False.

If stra is a structure array with the field data, the expression {stra.data} will extract all the values into a cell array.
1. To perform any operations on the contents of a heterogeneous collection, the items must be __________ and __________ if necessary.
1.
extracted one at a time;
replaced
2. Cell arrays can be treated for the purpose of concatenation and slicing as __________ of ___________ .
2.
arrays;
containers
3. The assignment B{3} = {42} results in the third entry in the cell array B to be a __________ .
3. cell containing 42
4. If a variable called field contains the value of a field of a structure str, the expression __________ will set the value of that field to 42.
4. str.(field) = 42
5. MATLAB has a built-in function __________ that
consumes pairs of entries, each consisting of a __________ and a __________ , and produces a structure array.
5.
struct(...);
field name as a string;
cell array of field contents