wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

ECE404L - Long Test

Total questions: 98

Worksheet time: 49mins

Name
Class
Date
1.

What does MATLAB stand for?

a)

Matrix Laboratory

b)

Math Library Tool

c)

Mathematical Language Tool

d)

Matrix Language Toolkit

2.

Which window in the MATLAB interface is primarily used to enter commands directly?

a)

Editor Window

b)

Workspace Window

c)

Command Window

d)

Figure Window

3.

How do you suppress output of a command in MATLAB?

a)

Put a comma at the end of the line

b)

Put a semicolon at the end of the line

c)

Use the keyword silent

d)

Use parentheses around the command

4.

Which command clears all variables from the workspace?

a)

clear all

b)

reset

c)

clc

d)

close all

5.

What is returned by typing who in the MATLAB command window?

a)

A list of all open figure windows

b)

A list of all functions in the path

c)

A list of variables currently in workspace

d)

A list of built-in MATLAB commands

6.

How do you get detailed help on the function sin?

a)

? sin

b)

help sin

c)

info sin

d)

docs sin

7.

Which file extension is standard for MATLAB script files?

a)

.m

b)

.mat

c)

.mdl

d)

.mlx

8.

What happens if you try to use a variable that has not been defined yet?

a)

MATLAB assigns it a default value of zero

b)

MATLAB throws an error

c)

MATLAB assumes it is symbolic

d)

MATLAB ignores it

9.

The Command clc in MATLAB:

a)

Clears command window contents

b)

Deletes all workspace variables

c)

Closes all figure windows

d)

Clears breakpoints

10.

The Command clear x does what?

a)

Sets variable x to zero

b)

Removes x from the workspace

c)

Clears the screen and resets x

d)

Overwrites x with an empty matrix

11.

What's the result of 5 + 3 * 2 in MATLAB, without parentheses?

a)

16

b)

11

c)

10

d)

13

12.

How do you comment a single line in a MATLAB script?

a)

// this is a comment

b)

# this is a comment

c)

% this is a comment

d)

/* this is a comment */

13.

If you want to run a script file named myscript.m, how do you do it?

a)

Type run myscript.m

b)

Type myscript (assuming it's in the path or current folder)

c)

Double-click on the file in Current Folder window

d)

All of the above

14.

Which key-binding or menu option would you use to stop a running MATLAB script?

a)

CTRL+C in Command Window

b)

CTRL+Z

c)

ESC

d)

SHIFT+Q

15.

What data type does MATLAB use for numbers by default?

a)

symbolic

b)

single precision floating-point

c)

double precision floating-point

d)

integer

16.

Which command shows you list of all variables along with their sizes and types?

a)

whos

b)

vars

c)

info

d)

workspace

17.

What is the result of pi in MATLAB?

a)

3.14 exactly

b)

The literal string "pi"

c)

A variable storing π to double precision

d)

An undefined variable unless declared

18.

The command load datafile will do what assuming datafile.mat exists?

a)

Display its contents

b)

Load variables saved in that file into workspace

c)

Import data as a text file

d)

Create a new file named datafile

19.

If you type a = 10; b = a + 1; what is the value of b?

a)

10

b)

11

c)

1

d)

Undefined

20.

What is the effect of type myfile.m in the Command Window?

a)

Executes myfile.m

b)

Deletes myfile.m

c)

Displays the contents of myfile.m on screen

d)

Edits myfile.m in the editor

21.

Which operator is used for element-wise multiplication of vectors or matrices?

a)

*

b)

.*

c)

x

d)

dot

22.

How do you compute symbolic power of a symbolic expression x to the n?

a)

x ^ n (numeric)

b)

power(x, n) with symbolic

c)

x .^ n

d)

sympower(x,n)

23.

What does ./ do in MATLAB?

a)

Division, treating vectors/matrices normally

b)

Left matrix division

c)

Element-wise division

d)

Not a valid operator

24.

Which function returns the remainder after division?

a)

divide

b)

mod

c)

rem

d)

Both B and C

25.

What is the difference between mod(a,b) and rem(a,b)?

a)

No difference

b)

Sign of result differs when a is negative

c)

mod works only with integers, rem works with floats

d)

mod returns symbolic, rem returns numeric

26.

Which operator is used for matrix multiplication?

a)

.*

b)

*

c)

dot

d)

/

27.

If a and b are symbolic variables, which command is correct to create them?

a)

a = sym a; b = sym b;

b)

syms a b

c)

declare symbolic a, b

d)

symvar a b

28.

What happens if you try element-wise division of incompatible sized arrays?

a)

MATLAB automatically broadcasts

b)

Error due to dimension mismatch

c)

It truncates to smallest dimension

d)

Fills with zeros where no match

29.

In symbolic arithmetic, how do you simplify the expression (x^2 - y^2)/(x-y)?

a)

Use expand

b)

Use factor

c)

Use simplify

d)

Use subs

30.

Which of the following is NOT an arithmetic operator in MATLAB?

a)

+

b)

-

c)

#

d)

^

31.

Suppose a = [1 2 3] and b = [4 5 6]. What does a .* b produce?

a)

[4 10 18]

b)

[5 7 9]

c)

dot(a,b)

d)

Error

32.

Suppose x is symbolic. What is the result of x * x vs x .* x?

a)

Both same if x is scalar symbolic

b)

.* is needed only when x is numeric array

c)

* does matrix multiplication even for symbolic

d)

.* is invalid for symbolic

33.

Which of the following commands gives element-wise power raising?

a)

.^

b)

^

c)

power (numeric)

d)

mpower

34.

How do you represent exponentials symbolically (e.g., e^x)?

a)

exp(x)

b)

e^x

c)

sym('e^x')

d)

Both A and C

35.

What's the result of sym(1/3) vs 1/3 (without sym)?

a)

Same result numerically

b)

sym(1/3) gives exact rational representation while 1/3 is approximate in floating point

c)

1/3 gives rational, sym(1/3) gives symbolic float

d)

MATLAB error

36.

Which function would you use to convert a symbolic expression to numeric (double)?

a)

double(expr)

b)

num(expr)

c)

real(expr)

d)

vpa(expr)

37.

If a = sym('a'); b = sym('b');, what is a + b?

a)

Numeric sum (error)

b)

Symbolic expression a + b

c)

Undefined

d)

Zero

38.

What is the result of 2 ^ sym(3)?

a)

8 (numeric double)

b)

2^3 symbolic

c)

Error

d)

9

39.

Which operator is used for matrix power (i.e. square of a matrix)?

a)

.^

b)

^

c)

mpower

d)

Both B and C

40.

In symbolic arithmetic, what does nthroot(a, n) do?

a)

Returns the nth power of a

b)

Returns the nth root of symbolic a

c)

Error for non-integer n

d)

Same as a^(1/n) always

41.

Which of the following is a valid variable name in MATLAB?

a)

2ndVar

b)

temp_val

c)

my-var

d)

count.

42.

What is the result of executing x = 5; x = x + 2;?

a)

Throws an error

b)

x = 5

c)

x = 7

d)

x remains undefined

43.

What is the difference between sym var = sym('var') and syms var?

a)

No difference

b)

syms clears previous assumptions; sym('var') can preserve some assumptions

c)

sym always numeric, syms always symbolic

d)

syms requires toolbox, sym does not

44.

What does MATLAB do if you assign a new value to an existing variable?

a)

Errors out

b)

Changes the variable's value (overwrites)

c)

Creates a new variable

d)

Keeps both versions

45.

Which command displays the current value of a variable a?

a)

disp(a)

b)

Just typing a in command window

c)

display a

d)

All of the above

46.

How do you check whether a variable z exists in workspace?

a)

exist('z')

b)

isvar z

c)

hasvar z

d)

variable_exists(z)

47.

Which command clears a specific variable named x?

a)

clear all x

b)

clear x

c)

delete x

d)

erase x

48.

What is the effect of doing global g; g = 10; inside a function?

a)

Makes g accessible in base workspace and other functions that declare it global

b)

Only within that function

c)

Errors if g already exists

d)

Makes g permanent

49.

Which MATLAB statement assigns a 3×3 identity matrix to variable I?

a)

I = eye(3);

b)

I = ones(3);

c)

I = zeros(3);

d)

I = eye;

50.

What happens if you try to concatenate variables of mismatched dimensions without proper operators?

a)

MATLAB auto adjusts sizes

b)

Error due to dimension mismatch

c)

Truncation or padding with zeros

d)

Warning only

51.

After a = 2; b = a; a = 5;, what is value of b?

a)

2

b)

5

c)

undefined

d)

MATLAB error

52.

Which type of variable stores text?

a)

double

b)

char or string

c)

symbolic

d)

logical

53.

What is the purpose of who vs whos?

a)

Both same

b)

who gives names only; whos gives names + size + type etc.

c)

whos deletes variables

d)

who clears workspace

54.

How do you make a variable persistent inside a function?

a)

Use persistent keyword

b)

Use global keyword

c)

Use declare persistent

d)

MATLAB does this by default

55.

What is stored in a variable declared as logical?

a)

Only true (1) or false (0) values

b)

Boolean text strings

c)

Numeric floats only

d)

Characters

56.

Which of these is NOT allowed as part of a variable name?

a)

Letters (a-z, A-Z)

b)

Digits, but not as the first character

c)

Underscore _

d)

Spaces

57.

What happens if you refer to a function name as a variable (e.g. sin = 5)?

a)

Overwrites built-in function temporarily

b)

MATLAB errors immediately

c)

It auto-renames the function

d)

Not allowed

58.

If syms x y is executed, what are x and y?

a)

Numeric variables of default type double

b)

Symbolic variables

c)

Strings

d)

Functions

59.

Which of the following is the natural logarithm function in MATLAB?

a)

log

b)

ln

c)

log10

d)

log_e

60.

Which function computes sine of an angle in radians?

a)

sind

b)

sin

c)

sinr

d)

sine

61.

What does the function exp(x) compute?

a)

x raised to the power e

b)

e raised to the power x

c)

logarithm base e of x

d)

exponential integral

62.

How do you compute the derivative of a symbolic expression f(x)?

a)

diff(f,x)

b)

deriv(f,x)

c)

d(f)/dx

d)

symbolicdiff(f)

63.

Which function returns the integral of a symbolic expression?

a)

int(f,x)

b)

integral(f,x)

c)

integrate(f,x)

d)

symbolicint(f,x)

64.

What is sqrt(x)?

a)

Square of x

b)

Square root of x

c)

Error for negative x (numeric)

d)

Both B and C depending on x

65.

How to compute sin(x)^2 + cos(x)^2 symbolically and simplify?

a)

sin(x)^2 + cos(x)^2 and then simplify(...)

b)

Use identity function

c)

MATLAB automatically simplifies

d)

Use expand(...)

66.

Which of the following returns absolute value (numeric)?

a)

abs(z)

b)

magnitude(z)

c)

mag(z)

d)

modulus(z)

67.

How do you compute log base 10 in MATLAB?

a)

log10(x)

b)

log(x)/log(10)

c)

log10f(x)

d)

Both A and B

68.

If f = sym('x^3 + 2*x');, what is subs(f, x, 5)?

a)

f remains symbolic expression

b)

Replaces x by 5 → returns 5^3 + 2*5 = 135 symbolic

c)

135 (numeric double)

d)

Error

69.

What does factor(x^2 - 1) do when x is symbolic?

a)

Converts to expanded form

b)

Factorizes to (x-1)*(x+1)

c)

Numeric root finding

d)

Simplifies to x^2 - 1

70.

Which function gives the inverse of sine (arcsine)?

a)

asin

b)

arcsin

c)

inv_sin

d)

sin-1

71.

How does MATLAB compute symbolic trigonometric functions with exactness?

a)

Always numeric approx

b)

Using symbolic engine so expressions like sin(pi) simplify exactly

c)

It cannot simplify trigonometric symbolic functions

d)

Only for rational multiples of pi

72.

What is the result of log(sym(exp(1)))?

a)

1

b)

log(e) symbolic

c)

Numeric value 1.0000

d)

Error

73.

Which command plots a function f(x) over interval [0,2π]?

a)

plot(f,0,2*pi)

b)

fplot(f, [0, 2*pi])

c)

plot(f(x), 0:2*pi)

d)

symbolicplot(f, [0,2*pi])

74.

To compute the Taylor expansion of exp(x) around x=0 up to 5th order, which function is used?

a)

taylor(exp(x), x, 0, 'Order',5)

b)

series(exp(x),5)

c)

maclaurin(exp(x),5)

d)

expand(exp(x))

75.

The numeric function floor(x) does what?

a)

Rounds x toward negative infinity

b)

Rounds x toward zero

c)

Rounds x to nearest integer

d)

Rounds x toward infinity

76.

What does ceil(x) do?

a)

Round down to integer

b)

Round up to nearest integer

c)

Round toward zero

d)

Round to nearest

77.

What is returned by round(3.7)?

a)

3

b)

4

c)

3.7

d)

Error

78.

For a symbolic f = sym('sin(x)/x'), what does limit(f, x, 0) return?

a)

Undefined

b)

1 (because limit of sin(x)/x as x → 0 is 1)

c)

0

d)

Error

79.

In MATLAB, what are i and j?

a)

Variables like any other

b)

Constants for imaginary unit sqrt(−1)

c)

Functions

d)

Matrix indices

80.

What is the real part of 3 + 4i?

a)

4

b)

3

c)

real(3 + 4i) returns 3

d)

imag(3 + 4i)

81.

What is the magnitude (absolute value) of 3 + 4i?

a)

7

b)

5

c)

sqrt(3+4)

d)

25

82.

What does conj(z) do to complex z?

a)

Returns the real part

b)

Returns the imaginary part

c)

Returns the complex conjugate

d)

Returns magnitude

83.

How do you compute the phase angle of a complex number z in MATLAB?

a)

phase(z)

b)

angle(z)

c)

arg(z)

d)

atan(imag(z)/real(z))

84.

If z = complex(3,4);, what is real(z)?

a)

4

b)

3

c)

Error

d)

complex(3,4)

85.

If z = 5 + 12i, what is abs(z)^2?

a)

13

b)

169

c)

25 + 144 = 169

d)

Both B and C

86.

Which of the following gives an error?

a)

i^2

b)

1i + 2j

c)

i + j

d)

Using i after redefining it as a variable

87.

For complex z = −1 + i*0, what does isreal(z) return?

a)

true (logical 1)

b)

false (logical 0)

c)

error

d)

depends on workspace

88.

What is the result of complex(0,1)^2?

a)

−1

b)

1

c)

i

d)

−i

89.

Which command creates a complex number 2 + 3i symbolically?

a)

sym(2 + 3*i)

b)

2 + 3*1i

c)

complex(2,3) (numeric)

d)

Both A and C

90.

How does MATLAB treat i if you assign i = 5; later?

a)

i stays imaginary unit always

b)

The variable i shadows built-in imaginary unit

c)

MATLAB prevents overriding i

d)

Generates error

91.

What is the result of angle(1 + 1i)?

a)

π/4 (in radians)

b)

1

c)

45 degrees numeric only

d)

0

92.

Which of these computes the complex conjugate transpose of matrix A?

a)

A.'

b)

A'

c)

ctranspose(A)

d)

Both B and C

93.

What does unwrap(angle(z)) do?

a)

Restricts the angle to [−π, π]

b)

Removes discontinuities in phase angle vector

c)

Computes magnitude

d)

Error if z is symbolic

94.

If z1 = 3 + 4i; z2 = 1 - 2i;, what is z1 * z2?

a)

Numeric multiplication

b)

Complex multiplication: (3 + 4i)(1 − 2i) = 11 + 2i

c)

31 − 42 + i(3(−2)+4*1)

d)

Both B and C

95.

How do you plot complex numbers in MATLAB graphically?

a)

Using plot(real(z), imag(z))

b)

complexplot(z)

c)

plot_complex(z)

d)

plot3(z)

96.
  1. What is the output of imag(5 + 6i)?

a)

5

b)

6

c)

i

d)

0

97.

If z = sym('z');, what is abs(z)?

a)

Simplified as abs(z) symbolic

b)

x if assumed real

c)

error until assumptions made

d)

Always z

98.

What is cplxpair([1+2i, 1-2i, 2+0i]) used for?

a)

Sorts and pairs complex conjugates

b)

Computes magnitude pairs

c)

Returns phase angle pairs

d)

Makes matrix pairs