Shared Flashcard Set

Details

MATLAB Chapter 2,3,4 T/F Blank
d
60
Engineering
Undergraduate 2
09/17/2013

Additional Engineering Flashcards

 


 

Cards

Term
C2. A bag of groceries is an example of abstraction.
Definition
True
Term
C2. An algorithm is a series of logical steps that solves one specific problem.
Definition
False. Written correctly, algorithms can be generalized to solve a range of problems
Term
C2.It is impossible to write a complete, practical program in any paradigm other than procedural
Definition
True
Term
C2. To be useful to an algorithm, the result of every computation must be assigned to a variable.
Definition
True
Term
C2. In programming, if you know the values of z and x in the expression z = x + y, you can derive the value y.
Definition
False
Term
C2. Untyped languages are free to ignore the nature of the data in variables.
Definition
False
Term
C2. Anything assigned to be the value of the variable is an object.
Definition
True
Term
C2. Class is a concept restricted to object-oriented programming.
Definition
False. In general, especially in MATLAB, the class of an item refers to its data type.
Term
C2. You can permanently save the commands entered in the Command window.
Definition
False
Term
C2. Double-clicking an entry in the Command History window lets you rerun that command.
Definition
True
Term
C2. You can manually change the values of variables displayed in the Workspace window
Definition
True
Term
C2. You double-click a file name in the Current Directory window to run that script.
Definition
False
Term
C2. A Document window lets you view and edit data items
Definition
True
Term
C2. MATLAB permits multiple Figure windows to be open simultaneously.
Definition
True
Term
C2. An asterisk on the File Name tab in the Editor window indicates that this is a script that can be executed
Definition
False
Term
C2. MATLAB echoes comments entered in a script in the Command window.
Definition
False
Term
C2. When the name of script is typed in the Command window, it will be saved if necessary before it is executed.
Definition
False
Term
C2. ______ means expressing a quality apart from a particular implementation.
Definition
Abstraction
Term
C2. _______ is a sequence of instructions for solving a problem.
Definition
Algorithm
Term
C2. Without______, a programming solution can be mathematically proven to be correct.
Definition
side effects
Term
C2. Variable names must not begin with _______
Definition
a numeric character
Term
C2. Armed with both the____ and______ of a variable, a compiler can do a better job of ensuring that the programmer isn't misinterpreting data
Definition
name; type
Term
C2. An instance of a _____ is a(n)_______ that is usually stored in a variable of that ________.
Definition
class; object; class
Term
C2. You can ______ in the Command window in a manner similar to the way you ______ on a scientific calculator.
Definition
perform calculations; perform calculations
Term
C2. You________ an entry in the Command History window to _____that command
Definition
double-click; repeat the execution
Term
C2. The columns in the Workspace window show the______of the variable,its_____,and its______
Definition
name; current value; data type
Term
C2. You______the name of a file in the Current Directory window to edit that file.
Definition
double-click
Term
C2. A Document window opens automatically when you ______a(n)_____in the Workspace window.
Definition
double-click; variable name
Term
C2. Graphics windows are created when a(n)_________ requests a graph.
Definition
automatically; MATLAB command
Term
C2. You create comments by putting a(n)_______in the text file.
Definition
percent sign(%)
Term
C2. MATLAB will ______ all text from the comment mark to ______.
Definition
ignored; the end of the current line
Term
C3. A homogeneous collection must consist entirely of numbers
Definition
False. Homogeneous collections must consist of data of the same type.
Term
C3. The function linspace(...) can create only vectors, whereas the functions zeros(...),one(...), and rand(...) produce either vectors or arrays of any dimension
Definition
True
Term
C3. The length(...) function applied to a column vector gives you the number of rows
Definition
False. B/c a column vector has more columns than rows, it returns the number of columns.
Term
C3. You can access any element(s) of an array of any dimensions using single index vector
Definition
True This is the array linearization. Dont use it
Term
C3. Mathematical or logical operators are allowed only between two arrays of the same shape(rows and columns).
Definition
False. Either array can be a scalar quantity (a 1 x 1 array).
Term
C3. You can access data in a vector A with an index vector that is longer than A.
Definition
True, as long as the indices in the index vector do not exceed the dimensions of A
Term
C3. You can access data in a vector A with a logical vector that is longer than A
Definition
False. The position of the values in the logical index vector corresponds to the position of values in the vector being indexed. Longer logical index vectors are reaching beyond the end of the original vector.
Term
C3. When moving a block of data in the form of specified rows and columns from array to array B, the shape of the block in A must match the shape of the block in B.
Definition
True
Term
C3. Vector elements have two attributes that make them unique: their_____ and their______
Definition
numerical value; position in the vector
Term
C3. Vectors can be created using the colon operator, for example, B = 1:3:20, where the first number is the_____, the second number is the _______, and the third number is the _______.
Definition
starting value; increment; ending value
Term
C3. When indexing a source vector with a logical vector, the result will contain the________of the source vector corresponding in the position to the________in the logical vector.
Definition
elements; true values
Term
C3. The normal precedence of operators can be overruled by the use of_______.
Definition
parentheses
Term
C3. Arithmetic operations can be performed collectively on the individual components of two arrays as long as both arrays________ or one of them is__________.
Definition
have the same dimensions; a scalar
Term
C3. To remove elements from arrays, you write________in________.
Definition
the empty vector, [ ]; complete rows or columns
Term
C3. Removing rows or columns from an array is_________,and can lead to________. Wherever possible, use__________to________.
Definition
bad; logical difficulties; indexing; copy the rows and columns you want to keep
Term
C4 .MATLAB keywords are colored green by the editor
Definition
False
Term
C4. Indentation is required in MATLAB to define code blocks.
Definition
False. only used to clarity for the user.
Term
C4. It is possible that no code at all is executed by if or switch contructs
Definition
True
Term
C4. The word true is a valid logical expression
Definition
True
Term
C4. When evaluating a sequence of logical && expresions, MATLAB will stop processing when it finds the first true result
Definition
False. The result that invalidates all other && expressions is false.
Term
C4. The for loop repeats the enclosed code block a fixed number of times even if you modify the index variable within the code block.
Definition
True But you can still use break to exit the loop early
Term
C4. Using a break statement is illegal in a while loop.
Definition
False. But it ought to be. This is really bad programming practice.
Term
C4. The logical expression used in a while loop specifies the conditions for exiting the loop.
Definition
False. The expression specifies the reason to stay in the loop.
Term
C4. MATLAB uses_______in the text to define the extent of code blocks.
Definition
key command words
Term
C4. The function ______ is implicitly called by MATLAB if you supply a vector of logical values to the if statement.
Definition
all(...)
Term
C4. It is good practice to include_______in a switch statement to trap illegal values entering the switch.
Definition
otherwise
Term
C4. There is no reason to evaluate any more components of a logical or expression once a(n)_______result has been found.
Definition
true
Term
C4. A while loop can be repeated a number of times, depending on the _______ being processed.
Definition
variable; values of data
Term
C4. If you are in a(n)________loop, you can use the break statement to skip immediately out of the _______ loop
Definition
for or while; innermost containing
Supporting users have an ad free experience!