MATLAB
Programming task
•Prepared By:
•Omar Mohammed Ibrahim Ahmed
•Hossam Samy Ahmed Mansour
•Yousef Abdelmenem Salama Rezk
•Mostafa Mohammed AbdelMawgood
Hamad
•Hamdy Khaled Hamdy Alshazly
•Ismail Ahmed Ismail AbdelGawad
•Department: Petroleum Refining
and Petrochemicals
• 1. What is the result of the expression
`3 + 5 * 2` in MATLAB?
• A) 16
• B) 13 (Correct)
• C) 11
• D) 15
• 2. Which command in MATLAB is used
to display the contents of a variable?
• A) show
• B) display
• C) disp (Correct)
• D) print
•3. What is the result of the following
code in MATLAB?
•x = [1 2 3];
•y = [4 5 6];
•z = [7 8 9];
•a = [x; y; z];
• A) [1 2 3; 4 5 6; 7 8 9] (Correct)
• B) [1 4 7; 2 5 8; 3 6 9]
• C) [1 2 3 4 5 6 7 8 9]
• D) [1 2 3; 4 5 6; 7 8 9;]
• 4. Which command is used to round a number up
to the nearest integer?
• A) ceil (Correct)
• B) floor
• C) round
• D) int
• 5. Which command is used to calculate the
square root of a number?
• A) sqrt (Correct)
• B) square
• C) squareroot
• D) root
• 6. Which command calculates the inverse of a
matrix?
• A) inverse
• B) inv (Correct)
• C) transpose
• D) invert
7. What is the result of the following code in
MATLAB?
x = 1:5;
y = x.^2;
• A) x = [1 2 3 4 5], y = [1 4 9 16 25] (Correct)
• B) x = [1 2 3 4 5], y = [2 4 6 8 10]
• C) x = [1 2 3 4 5], y = [1 2 3 4 5]
• D) x = [1 2 3 4 5], y = [1 3 5 7 9]
8. Which command creates a matrix with all
elements set to 0?
• A) Zeros (Correct)
• B) ones
• C) eye
• D) rand
9. Which
stateme A) while
nt
creates B) do-while
a for
loop in
MATLAB C) for (Correct)
?
D) repeat-until
10.
What is A) .mat
the
default B) .m (Correct)
extensio
n of a
MATLAB C) .md
script
file? D) .txt
•
• 3- Solving simultaneous linear
equations: Solve the following
set of simultaneous linear
algebraic equations.
• X+ 3y - Z =2
• x-y +z= 3
• 3x - 5y =4
• Find value of x,y,z USING
SCRIPT .
Thank You
Questions?