CE 206 Midterm I

¡Supera tus tareas y exámenes ahora con Quizwiz!

Choose True or False: If x = [0:pi/6:pi], then the value(s) of cos (x) in COMMAND WINDOW is not defined or gives an error. : A. True B. False

B. False

Choose True or False: v(2)=20 sets third element of vector v to 20 A. True B. False

B. False

Choose True or False: zeros(m,n) - makes matrix of n rows and m columns, all with zeros. A. True B. False

B. False

If A = [1 2; 3 4] and B = [ 0 2; 5 6], then C = A.*B gives A. C = [0 4; 15 24] B. C = [0 4; 15 -24] C. Error D. C = [15 24; 0 4]

A. C = [0 4; 15 24]

Choose the INCORRECT statement regarding 'variables' used in MATLAB: A. Can contain punctuation, e.g., period, comma, semicolon B. Must begin with a letter C. Can be up to 63 characters long D. Can contain underscores (_)

A. Can contain punctuation, e.g., period, comma, semicolon

Choose True or False for the following statement: If x = [ 1 2 3 4 5], y = [ 10 20 30 40 50], then plot([1 2 3 4 5], [10 20 30 40 50]) will give the same output as plot(x,y) A. True B. False

A. True

Choose True or False for the following statement: Script file will recognize a variable if it has an assigned value in Command Window. A. True B. False

A. True

Choose True or False for the following statement: With use of 'load' command in MATLAB, if variable already exists in workspace, it is overwritten (its value is replaced by value in file). A. True B. False

A. True

Choose True or False: Address of element in a matrix is given by row number and column number. A. True B. False

A. True

Choose True or False: In MATLAB, multiple assignments on one line can be made by separating with a comma or semicolon. A. True B. False

A. True

Choose True or False: In the definition v = linspace( xi, xf, n ), xi is first number, xf is last number and n is number of terms. A. True B. False

A. True

Choose True or False: The output of x = -3:2 in COMMAND WINDOW is x = -3 -2 -1 0 1 2 A. True B. False

A. True

Choose True or False: The output of x = -3:2.5 in COMMAND WINDOW is x = -3 -2 -1 0 1 2 A. True B. False

A. True

Choose True or False: eye(n) - makes square matrix of n rows and n columns. Main diagonal (upper left to lower right) has ones, all other elements are zero. A. True B. False

A. True

Choose True or False: ones(m,n) - makes matrix of m rows and n columns, all with ones. A. True B. False

A. True

Identify the CORRECT method of assignment of a value in script file: A. Variable1 = 24 B. 24 = Variable1 = Variable2 C. Variable1 = 24 = Variable2 D. Variable1 = Variable2 = 24

A. Variable1 = 24

Which of the following could be a potential output of X = randi(3,3): A. X = [3 3 1; 2 3 1; 2 1 1] B. X = [3 0 1; 2 3 1; 1 1 3] C. Error D. X = [3 3 1; 2 3 1; 2 1 0]

A. X = [3 3 1; 2 3 1; 2 1 1]

The output of name = input( 'Your name: ' ) in Command Window is: A. Your name: B. 'Your name: ' C. An error D. A variable

A. Your name:

To make a 3×4 of random integer numbers between 50 and 90, the following command can be used: A. d = randi( [50 90], 3, 4) B. d = randi( [50 90], 4, 3) C. d = randi( [90 50], 3, 4) D. d = randi( [90 50], 4, 3)

A. d = randi( [50 90], 3, 4)

Identify the CORRECT command of importing data from Microsoft Excel: A. variable_name=xlsread('filename') B. variable_name=xlsread(filename) C. variable_name=xlread(filename) D. variable_name=xlread('filename')

A. variable_name=xlsread('filename')

If x = [1 2 3 4], then the outputs of y = x^2 and z = x.^3 in COMMAND WINDOW are: A. y = error, z = [1 8 27 64] B. y = [1 2 9 16], z = [1 8 27 64] C. y = error, z = error D. y = [1 2 9 16], z = error

A. y = error, z = [1 8 27 64]

The output of [ 1 2 3] + [2 3 4] is: A. [ 2 4 5] B. An array C. Matlab will give an error D. [2 5 6]

B. An array

If A = [1 2; 3 4], B = [0 1/2; 1 -1/2], C = A.*B and D = A*B, which of the following is CORRECT: A. C = D B. C ≠ D C. C = [0 1; 3 2] D. D = [2 -0.5; 4 0.5]

B. C ≠ D

Choose True or False for the following statement: If x = [ 1 2 3 4 5], y = [ 10 20 30 40 50], then plot([1 2 3 4 5], y) will be an error in MATLAB: A. True B. False

B. False

Choose True or False for the following statement: If x = [ 1 2 3 4 5], y = [ 10 20 30 40 50], then plot([1 2 3 4 5], y, '-g') will produce a grey-colored line in a figure window: A. True B. False

B. False

Choose True or False for the following statement: In the definition variable_name=input('prompt'), prompt is a number. A. True B. False

B. False

Choose True or False: = (equals sign) in MATLAB evaluates the expression on its left side and stores the resulting value in the variable on its right side. A. True B. False

B. False

Choose True or False: Address of element is its position in the vector and addresses always start at 0 A. True B. False

B. False

Choose True or False: For generating an array using the format m:q:n you can directly specify the number of elements of the array while linspace() lets you directly specify the spacing between each element. A. True B. False

B. False

Identify the INCORRECT statement with the use of variable_name=input('prompt'): A. Displays prompt text in Command Window B. Puts cursor immediately to left of prompt C. User types value and presses ENTER D. Script assigns user's value to variable and displays value unless input command had semicolon at end

B. Puts cursor immediately to left of prompt

Identify the INCORRECT statement with respect to plot(x,y,u,v,t,h) command in MATLAB: A. Plots y vs. x, v vs. u, h vs. t B. Vector size of a pair (e.g. x, y) should always be same as another pair (e.g. t, h) C. Can use line specifiers such as plot(x,y,'-b', u,v, '--r', 't,h, 'g:') D. None of the above

B. Vector size of a pair (e.g. x, y) should always be same as another pair (e.g. t, h)

What is output of the following: [ 1 2 3] + 5? A. [ 1 2 3] B. [ 6 7 8] C. Matlab will give an error D. [1 2 3 5]

B. [ 6 7 8]

If h = [ 2 4 6 ], v = [ -1 0 1 ]' , then which of the following is CORRECT: A. h * v = 0 B. h * v = 4 C. v * h = [-2 -4 -6; 0 0 2; 2 4 6] D. v * h = [-2 -4 -6; 2 0 0; 2 4 6]

B. h * v = 4

Fill in the blank such that average of three numbers is stored in variable 'ave_points': Game1 = 5; Game2 = 10; Game3 = 15; ave_points = ______________ A. (Game1 + Game2 + Game3)/2 B. average(Game1 + Game2+ Game3) C. (Game1 + Game2 + Game3)/3 D. (Game1 + Game2 - Game3)/3

C. (Game1 + Game2 + Game3)/3

Which of the following is not a valid variable name in MATLAB: A. Apple_2 B. Ora_2nge C. Bana_2!na D. L2ime2

C. Bana_2!na

Identify the INCORRECT statement with respect to plot(x,y) command in MATLAB: A. x and y are vectors that have same size (number of elements) B. x-values are on horizontal axis, and y-values are on vertical axis C. Does not create a new figure window D. None of the above

C. Does not create a new figure window

If A = [1 2; 3 4] and B = [ 1 0]', then C = A.*B gives A. C = [1; 3] B. C = [1 3] C. Error D. C = [0 1]

C. Error

What is output of the following: [ 1 2 3] + [5 6]? A. [ 1 2 3] B. [ 1 7 9] C. Matlab will give an error D. [1 2 3 5 6]

C. Matlab will give an error

Which of the following is an INCORRECT statement: A. MATLAB command eye(n) makes an n×n identity matrix B. Identity matrix is square matrix with ones on main diagonal and zeros elsewhere C. Matrix multiplication on any array with the identity matrix changes the array D. Matrix B is the inverse of matrix A if matrix product of A and B is the identity matrix

C. Matrix multiplication on any array with the identity matrix changes the array

The expression for generating a random number x between 5 and 10 is given by: A. x = 10 + 5*rand(1) B. x = 5 + 10*rand(1) C. x = 5 + 5*rand(1) D. x = -10 + 5*rand(1)

C. x = 5 + 5*rand(1)

If x = [1:8], then the expanded output of x in COMMAND WINDOW is: A. x = [1 8] B. x = [1 2 4 8] C. x = [1 2 3 4 5 6 7 8] D. x = error

C. x = [1 2 3 4 5 6 7 8]

Identify the CORRECT statement: A. Linear algebra rules of array multiplication are not valid in MATLAB B. Matrix multiplication in MATLAB is denoted using '×' C. For matrix multiplication in MATLAB: number of columns in left matrix may not be the same as number of rows in right matrix. D. For matrix multiplication in MATLAB: number of columns in left matrix must be the same as number of rows in right matrix.

D. For matrix multiplication in MATLAB: number of columns in left matrix must be the same as number of rows in right matrix.

Identify the INCORRECT statement with respect to xlsread command in MATLAB: A. Stores all data in one variable B. If Excel file has multiple sheets, reads first one C. Can read rectangular section of sheet by specifying range in command D. None of the above

D. None of the above

Identify the INCORRECT statement: A. A scalar is an array B. A vector is an array C. Matrix and array are used synonymously in MATLAB D. The plus '+' can only be used to add two scalars and not two arrays

D. The plus '+' can only be used to add two scalars and not two arrays

Identify the INCORRECT statement for MATLAB workspace: A. MATLAB workspace stores variables defined during a MATLAB session B. MATLAB workspace includes variables defined in the Command Window C. MATLAB workspace includes variables defined in the script files D. You cannot edit or change a variable in the Workspace Window

D. You cannot edit or change a variable in the Workspace Window


Conjuntos de estudio relacionados

cultural diversity section 3 & 4

View Set

Nutrition in Heath: Chapter 3: Basis of a Healthy Diet

View Set

Cell Biology Chapter 5 True or False

View Set

Phil2033- Prof. Harding HW Questions 3a-4d

View Set

Chapter 23 emergency medical procedures

View Set

My Missed Questions (IA Life Ins)

View Set