PSU CMPSC200 MIDTERM EXAM
QUESTIONS WITH SOLUTIONS
MATLAB generally interprets computer code line by line from the top to the
bottom of a program. - -True
- Volatile Memory - -Temporary data storage
- Non-volatile Memory - -Permanant data storage
- Main Memory - -Stores programs and program data into random access
memory
- Arithmetic and Logic Unit (ALU) - -Performs mathematical operations
- Which of the following are characteristics of computers? - -1. Do not tire
2. Follow instructions precisely
3. Are reliable in most contexts
- Which of the following are true about MATLAB variables? - -1. May contain
letters or numbers
2. Must begin with a letter
3. May end with a letter
- The default angular unit in MATLAB is radians unless specified otherwise. -
-True
- An array cannot contain multiple pieces of information. - -False
- Which built-in command would you use if you wanted to generate
uniformly distributed pseudorandom numbers? - -rand( )
- Which built-in command returns the largest number of elements in any
dimension of a variable? - -length( )
- The semi-colon at the end of a line of code is generally an optional piece of
syntax in the MATLAB programming language. - -True
- log(x) - -log base e of x
- log10(x) - -log base 10 of x
- ln(x) - -Not a valid MATLAB command
, - 0 (zero) is the typical computer science representation for true, while 1
(one) is the typical computer science representation for false. - -False
- plot( ) - -Plots y-data points vs. x-data points
- legend( ) - -Creates a legend for a plot
- comet( ) - -Creates an animated plot
- title( ) - -Adds a title to a plot
- figure( ) - -Calls a figure, creating it if necessary
- clf - -Clears the contents of a figure, but does not delete the figure window
entirely
- close - -Used to completely delete one or more figure windows
- axis( ) - -Used to control the axes of a plot
- semilogx( ) - -Plots normal y vs. logarithm of x
- loglog( ) - -Plots logarithm of y vs. logarithm of x
- plot3( ) - -Plots a 3D plot
- surf( ) - -Plots a 3D surface plot
- Consider the array A=[5, 2; −3, 1]. Which of the following is not a valid
approach for allocating this array in MATLAB? Make sure that your allocation
has the same dimensionality as A. - -A = [5; 2 -3; 1]
- MATLAB array indexes must be positive integers. - -True
- Which of the following are characteristics of syntax errors? - -1. The code
is written in such a way that MATLAB does not understand what it is being
asked to do
2. Results in a red error message displaying in the Command Window
- Which of the following is not true about plotting in MATLAB? - -Plotting is
not a useful feature in the MATLAB programming language
- Consider the subplot command: subplot(m,n,p)
In this expression, m represents ___________, n represents ___________, and p
represents ____________ - -1. The number of rows for the entire figure
2. The number of columns for the entire figure
QUESTIONS WITH SOLUTIONS
MATLAB generally interprets computer code line by line from the top to the
bottom of a program. - -True
- Volatile Memory - -Temporary data storage
- Non-volatile Memory - -Permanant data storage
- Main Memory - -Stores programs and program data into random access
memory
- Arithmetic and Logic Unit (ALU) - -Performs mathematical operations
- Which of the following are characteristics of computers? - -1. Do not tire
2. Follow instructions precisely
3. Are reliable in most contexts
- Which of the following are true about MATLAB variables? - -1. May contain
letters or numbers
2. Must begin with a letter
3. May end with a letter
- The default angular unit in MATLAB is radians unless specified otherwise. -
-True
- An array cannot contain multiple pieces of information. - -False
- Which built-in command would you use if you wanted to generate
uniformly distributed pseudorandom numbers? - -rand( )
- Which built-in command returns the largest number of elements in any
dimension of a variable? - -length( )
- The semi-colon at the end of a line of code is generally an optional piece of
syntax in the MATLAB programming language. - -True
- log(x) - -log base e of x
- log10(x) - -log base 10 of x
- ln(x) - -Not a valid MATLAB command
, - 0 (zero) is the typical computer science representation for true, while 1
(one) is the typical computer science representation for false. - -False
- plot( ) - -Plots y-data points vs. x-data points
- legend( ) - -Creates a legend for a plot
- comet( ) - -Creates an animated plot
- title( ) - -Adds a title to a plot
- figure( ) - -Calls a figure, creating it if necessary
- clf - -Clears the contents of a figure, but does not delete the figure window
entirely
- close - -Used to completely delete one or more figure windows
- axis( ) - -Used to control the axes of a plot
- semilogx( ) - -Plots normal y vs. logarithm of x
- loglog( ) - -Plots logarithm of y vs. logarithm of x
- plot3( ) - -Plots a 3D plot
- surf( ) - -Plots a 3D surface plot
- Consider the array A=[5, 2; −3, 1]. Which of the following is not a valid
approach for allocating this array in MATLAB? Make sure that your allocation
has the same dimensionality as A. - -A = [5; 2 -3; 1]
- MATLAB array indexes must be positive integers. - -True
- Which of the following are characteristics of syntax errors? - -1. The code
is written in such a way that MATLAB does not understand what it is being
asked to do
2. Results in a red error message displaying in the Command Window
- Which of the following is not true about plotting in MATLAB? - -Plotting is
not a useful feature in the MATLAB programming language
- Consider the subplot command: subplot(m,n,p)
In this expression, m represents ___________, n represents ___________, and p
represents ____________ - -1. The number of rows for the entire figure
2. The number of columns for the entire figure