CMPSC 200 Practice Exam Questions With
Correct Answers
What does MATLAB stand for? - CORRECT ANSWER✔✔-Matrix Laboratory
| | | | | | | |
What numeric value would be produced by this calculation in MATLAB? 5-2/4^2
| | | | | | | | | | |
a) 4.875
| |
b) 4.75
| |
c) 5.125
| |
d) This calculation would produce a syntax error - CORRECT ANSWER✔✔-a) 4.875
| | | | | | | | | | |
Which of the following is not a valid variable name in MATLAB?
| | | | | | | | | | |
a) 38special
| |
b) B52s
|
c) Blink_182
| |
d) U2 - CORRECT ANSWER✔✔-a) 38special
| | | | |
- a valid variable name must start with a letter followed be letters, digits, or
| | | | | | | | | | | | | | |
underscores
What is the value of z at the end of a run of this code fragment?
| | | | | | | | | | | | | | |
cos = @(y) sin(y)
| | | |
z = cos(0)
| |
,a) 1 | |
b) 0 (or something numerically equal to zero)
| | | | | | | |
c) -1| |
d) This code fragment will not run due to a syntax error - CORRECT ANSWER✔✔-
| | | | | | | | | | | | | |
b) 0 (or something numerically equal to zero)
| | | | | | |
Picture a figure containing 18 subplots, arranged as if they had 3 rows and 6
| | | | | | | | | | | | | | |
columns. Which subplot command is associated with operations for the plot in
| | | | | | | | | | | |
the 2nd row, 4th column?
| | | |
a) subplot(3,6,11)
| |
b) subplot(3,6,10)
|
c) subplot(6,3,10)
|
d) subplot(6,3,11) - CORRECT ANSWER✔✔-b) subplot(3,6,10)
| | | | |
Which of the following is a valid function header in MATLAB?
| | | | | | | | | |
a) function y, z = f[x]
| | | | | |
b) function = f(x) y,z
| | | | |
c) y,z = f(x)
| | | |
d) function [y,z] = f(x) - CORRECT ANSWER✔✔-d) function [y,z] = f(x)
| | | | | | | | | | |
Consider the following code fragment: | | | | |
x = exp(0)
| |
x=x+1
| | | |
When one runs the code, what is the value of x at the end of a run of this code?
| | | | | | | | | | | | | | | | | | |
, a) 2 | |
b) 1 | |
c) 0 | |
d) This code fragment will not run due to a syntax error - CORRECT ANSWER✔✔-
| | | | | | | | | | | | | |
a) 2 |
Which command rounds an arbitrary variable y to the nearest integer towards
| | | | | | | | | | | |
positive infinity? |
a) floor(y)
| |
b) ceil(y)
| |
c) fix(y)
| |
d) round(y) - CORRECT ANSWER✔✔-b) ceil(y)
| | | | |
If a person wants to print an character string using the fprintf command, the
| | | | | | | | | | | | | |
necessary type field could be | | | |
a) %s| |
b) %c| |
c) %d| |
d) %i - CORRECT ANSWER✔✔-a) %s
| | | | |
Which of these is a built-in function in MATLAB?
| | | | | | | |
a) NaN
| |
b) pi| |
c) size
|
Correct Answers
What does MATLAB stand for? - CORRECT ANSWER✔✔-Matrix Laboratory
| | | | | | | |
What numeric value would be produced by this calculation in MATLAB? 5-2/4^2
| | | | | | | | | | |
a) 4.875
| |
b) 4.75
| |
c) 5.125
| |
d) This calculation would produce a syntax error - CORRECT ANSWER✔✔-a) 4.875
| | | | | | | | | | |
Which of the following is not a valid variable name in MATLAB?
| | | | | | | | | | |
a) 38special
| |
b) B52s
|
c) Blink_182
| |
d) U2 - CORRECT ANSWER✔✔-a) 38special
| | | | |
- a valid variable name must start with a letter followed be letters, digits, or
| | | | | | | | | | | | | | |
underscores
What is the value of z at the end of a run of this code fragment?
| | | | | | | | | | | | | | |
cos = @(y) sin(y)
| | | |
z = cos(0)
| |
,a) 1 | |
b) 0 (or something numerically equal to zero)
| | | | | | | |
c) -1| |
d) This code fragment will not run due to a syntax error - CORRECT ANSWER✔✔-
| | | | | | | | | | | | | |
b) 0 (or something numerically equal to zero)
| | | | | | |
Picture a figure containing 18 subplots, arranged as if they had 3 rows and 6
| | | | | | | | | | | | | | |
columns. Which subplot command is associated with operations for the plot in
| | | | | | | | | | | |
the 2nd row, 4th column?
| | | |
a) subplot(3,6,11)
| |
b) subplot(3,6,10)
|
c) subplot(6,3,10)
|
d) subplot(6,3,11) - CORRECT ANSWER✔✔-b) subplot(3,6,10)
| | | | |
Which of the following is a valid function header in MATLAB?
| | | | | | | | | |
a) function y, z = f[x]
| | | | | |
b) function = f(x) y,z
| | | | |
c) y,z = f(x)
| | | |
d) function [y,z] = f(x) - CORRECT ANSWER✔✔-d) function [y,z] = f(x)
| | | | | | | | | | |
Consider the following code fragment: | | | | |
x = exp(0)
| |
x=x+1
| | | |
When one runs the code, what is the value of x at the end of a run of this code?
| | | | | | | | | | | | | | | | | | |
, a) 2 | |
b) 1 | |
c) 0 | |
d) This code fragment will not run due to a syntax error - CORRECT ANSWER✔✔-
| | | | | | | | | | | | | |
a) 2 |
Which command rounds an arbitrary variable y to the nearest integer towards
| | | | | | | | | | | |
positive infinity? |
a) floor(y)
| |
b) ceil(y)
| |
c) fix(y)
| |
d) round(y) - CORRECT ANSWER✔✔-b) ceil(y)
| | | | |
If a person wants to print an character string using the fprintf command, the
| | | | | | | | | | | | | |
necessary type field could be | | | |
a) %s| |
b) %c| |
c) %d| |
d) %i - CORRECT ANSWER✔✔-a) %s
| | | | |
Which of these is a built-in function in MATLAB?
| | | | | | | |
a) NaN
| |
b) pi| |
c) size
|