0
0
MATLABdata~20 mins

Arithmetic operators in MATLAB - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Arithmetic Operators Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
Predict Output
intermediate
2:00remaining
Output of mixed arithmetic operations
What is the output of the following MATLAB code?
MATLAB
a = 5;
b = 3;
c = a^2 - 4*b + 7;
disp(c);
A19
B18
C25
D20
Attempts:
2 left
💡 Hint
Remember the order of operations: powers first, then multiplication and subtraction.
Predict Output
intermediate
2:00remaining
Division and modulus output
What is the output of this MATLAB code snippet?
MATLAB
x = 17;
y = 5;
q = floor(x / y);
r = mod(x, y);
disp([q, r]);
A[4 1]
B[3 1]
C[3 2]
D[4 2]
Attempts:
2 left
💡 Hint
Use floor division for quotient and mod for remainder.
Predict Output
advanced
2:30remaining
Result of element-wise vs matrix multiplication
What is the output of this MATLAB code?
MATLAB
A = [1 2; 3 4];
B = [2 0; 1 3];
C = A .* B;
D = A * B;
disp(C);
disp(D);
A
[2 0; 3 12]
[4 6; 10 12]
B
[2 0; 3 12]
[2 0; 1 3]
C
[3 2; 4 7]
[4 6; 10 12]
D
[3 2; 4 7]
[2 0; 1 3]
Attempts:
2 left
💡 Hint
Remember that .* is element-wise multiplication and * is matrix multiplication.
Predict Output
advanced
2:00remaining
Output of combined arithmetic and logical operations
What is the output of this MATLAB code?
MATLAB
x = 4;
y = 7;
z = (x > 3) + (y < 5) * 10;
disp(z);
A11
B1
C10
D0
Attempts:
2 left
💡 Hint
Logical expressions return 1 for true and 0 for false. Multiplication has higher precedence than addition.
Predict Output
expert
2:30remaining
Output of chained arithmetic with parentheses
What is the output of this MATLAB code?
MATLAB
a = 2;
b = 3;
c = 4;
d = a + b * c ^ a - (b + c) * a;
disp(d);
A36
B10
C2
D-4
Attempts:
2 left
💡 Hint
Remember the order: parentheses, exponentiation, multiplication/division, addition/subtraction.