CMPSC 200 Final Exam Questions With
Correct Answers
Issue with trying to time computer code runs - CORRECT ANSWER✔✔-run times
| | | | | | | | | | | |
can vary from run to run; operating system can make adjustments to the system
| | | | | | | | | | | | | |
clock--so using the system clock for timing is difficult
| | | | | | | |
Data types from least to most storage - CORRECT ANSWER✔✔-
| | | | | | | | |
singe<complex=double
~= - CORRECT ANSWER✔✔-not equal
| | | |
sparse matrix - CORRECT ANSWER✔✔-most elements are zero
| | | | | | |
Storage order for field names (structure arrays) - CORRECT ANSWER✔✔-in order
| | | | | | | | | | |
of creation
|
x = [4 3] - CORRECT ANSWER✔✔-x~=3
| | | | | |
x~=4
Flow chart characteristics - CORRECT ANSWER✔✔-it is a graphical representation
| | | | | | | | | |
of how computer code flows or progresses, and it is constructed with well-
| | | | | | | | | | | |
defined conventions |
,continue - CORRECT ANSWER✔✔-skips the rest of the current loop iteration,
| | | | | | | | | | |
advances to the next loop pass | | | | |
short circuit evaluation - CORRECT ANSWER✔✔-When checking logic, you do not
| | | | | | | | | | |
evaluate the other terms if you find you do not have to; only with scalars, &&,
| | | | | | | | | | | | | | | |
and || |
do while - CORRECT ANSWER✔✔-not in MATLAB; guaranteed to run at least once
| | | | | | | | | | | |
units of information used to store 1 logical variable - CORRECT ANSWER✔✔-bit
| | | | | | | | | | |
while loop vs for loop - CORRECT ANSWER✔✔-use while loop when you can only
| | | | | | | | | | | | | |
know after the fact how many times the loop will need to execute
| | | | | | | | | | | |
solving linear equations - CORRECT ANSWER✔✔-option 1: x = A\b
| | | | | | | | |
option 2: x = inv(A)*b | | | |
option 3: aug_A = [A b] | | | | |
reduced_echelon_form = rref(aug_A) | |
x = reduced_echelon_form(:, end)
| | |
Tic and toc - CORRECT ANSWER✔✔-how much wall time has elapsed for a code
| | | | | | | | | | | | | |
to run
|
Memory used to store a dense 100x100 matrix of single precision floating point
| | | | | | | | | | | | |
numbers - CORRECT ANSWER✔✔-=100*100*8*.5 KB
| | | |
, Sentinel loop - CORRECT ANSWER✔✔-terminates when a certain condition is met
| | | | | | | | | |
(sentinel condition)
| |
code vectorization - CORRECT ANSWER✔✔-uses vector operations instead of
| | | | | | | | |
element-element loop-based operations | |
computer code categories - CORRECT ANSWER✔✔-1: sequences
| | | | | |
2: selection structures
| |
3: repetition structures
| |
completely remove last cell of a cell array C - CORRECT ANSWER✔✔-C{end} = []
| | | | | | | | | | | | |
Valid for loop index - CORRECT ANSWER✔✔-a scalar, vector, or matrix
| | | | | | | | | |
if MATLAB finds a true case in a switch, it will continue checking the other cases -
| | | | | | | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
An exclusive or evaluates as false when either inputs A or B (but not both) are
| | | | | | | | | | | | | | | |
non-zero - CORRECT ANSWER✔✔-false
| | |
The ' operator and the transpose command both compute transposes but these
| | | | | | | | | | | |
two techniques do not behave identically under all circumstances - CORRECT
| | | | | | | | | | |
ANSWER✔✔-true
Correct Answers
Issue with trying to time computer code runs - CORRECT ANSWER✔✔-run times
| | | | | | | | | | | |
can vary from run to run; operating system can make adjustments to the system
| | | | | | | | | | | | | |
clock--so using the system clock for timing is difficult
| | | | | | | |
Data types from least to most storage - CORRECT ANSWER✔✔-
| | | | | | | | |
singe<complex=double
~= - CORRECT ANSWER✔✔-not equal
| | | |
sparse matrix - CORRECT ANSWER✔✔-most elements are zero
| | | | | | |
Storage order for field names (structure arrays) - CORRECT ANSWER✔✔-in order
| | | | | | | | | | |
of creation
|
x = [4 3] - CORRECT ANSWER✔✔-x~=3
| | | | | |
x~=4
Flow chart characteristics - CORRECT ANSWER✔✔-it is a graphical representation
| | | | | | | | | |
of how computer code flows or progresses, and it is constructed with well-
| | | | | | | | | | | |
defined conventions |
,continue - CORRECT ANSWER✔✔-skips the rest of the current loop iteration,
| | | | | | | | | | |
advances to the next loop pass | | | | |
short circuit evaluation - CORRECT ANSWER✔✔-When checking logic, you do not
| | | | | | | | | | |
evaluate the other terms if you find you do not have to; only with scalars, &&,
| | | | | | | | | | | | | | | |
and || |
do while - CORRECT ANSWER✔✔-not in MATLAB; guaranteed to run at least once
| | | | | | | | | | | |
units of information used to store 1 logical variable - CORRECT ANSWER✔✔-bit
| | | | | | | | | | |
while loop vs for loop - CORRECT ANSWER✔✔-use while loop when you can only
| | | | | | | | | | | | | |
know after the fact how many times the loop will need to execute
| | | | | | | | | | | |
solving linear equations - CORRECT ANSWER✔✔-option 1: x = A\b
| | | | | | | | |
option 2: x = inv(A)*b | | | |
option 3: aug_A = [A b] | | | | |
reduced_echelon_form = rref(aug_A) | |
x = reduced_echelon_form(:, end)
| | |
Tic and toc - CORRECT ANSWER✔✔-how much wall time has elapsed for a code
| | | | | | | | | | | | | |
to run
|
Memory used to store a dense 100x100 matrix of single precision floating point
| | | | | | | | | | | | |
numbers - CORRECT ANSWER✔✔-=100*100*8*.5 KB
| | | |
, Sentinel loop - CORRECT ANSWER✔✔-terminates when a certain condition is met
| | | | | | | | | |
(sentinel condition)
| |
code vectorization - CORRECT ANSWER✔✔-uses vector operations instead of
| | | | | | | | |
element-element loop-based operations | |
computer code categories - CORRECT ANSWER✔✔-1: sequences
| | | | | |
2: selection structures
| |
3: repetition structures
| |
completely remove last cell of a cell array C - CORRECT ANSWER✔✔-C{end} = []
| | | | | | | | | | | | |
Valid for loop index - CORRECT ANSWER✔✔-a scalar, vector, or matrix
| | | | | | | | | |
if MATLAB finds a true case in a switch, it will continue checking the other cases -
| | | | | | | | | | | | | | | | |
CORRECT ANSWER✔✔-false |
An exclusive or evaluates as false when either inputs A or B (but not both) are
| | | | | | | | | | | | | | | |
non-zero - CORRECT ANSWER✔✔-false
| | |
The ' operator and the transpose command both compute transposes but these
| | | | | | | | | | | |
two techniques do not behave identically under all circumstances - CORRECT
| | | | | | | | | | |
ANSWER✔✔-true