ADDIS ABABA UNIVERSITY
ADDIS ABABA INSTITUTE OF TECHNOLOGY
SCHOOL OF CIVIL AND ENVIRONMENTAL ENGINEERING
CEng-2081: Computer Programming
Assignment 1
PART I: Multiple choice questions
1. What does MATLAB stand for?
a) Math Laboratory
b) Matrix Laboratory
c) Mathworks
d) none of the above
2. The Matlab command clears all data and variables stored in memory:
a) clc b) clear c) Delete d) none of the above
3. What is the function of (;) symbol in MATLAB?
a) to write a comment with no action
b) used as a row separator in a matrix
c) to suppress output
d) specify range
e) b and c
4. Executing in the Command Window the following code, the displayed result is
a= 1:2; size[a]
a) error message b) 1 2 c) 2 1 d) none of the above
5. Executing the following script file in MATLAB, what is the result after this program
executes?
y= a + b,
a = 2 ; b = sqrt(‐4) ;
a) error message b) 2+2i c) 2-2i d) none of the above
6. Executing in the Command Window the following code, the displayed result is
A = [1:5; 2:6]; size(A)
a) 2 5 b) 5 2 c) 3 5 d) none of the above
Computer Programming Page 1
7. After executing the following script file in MATLAB
x = 3i; y = x+2*SQRT(‐1);
z = x + y, the displayed result is
a) 0+8i b) 0+5i c) error message d) none of the above
8. What is the array operator (.^) symbol in MATLAB?
a) Exponentiation
b) Multiplication and exponentiation
c) Element-by-element exponentiation
d) None of the above
9. Consider the following two-dimensional MATLAB array, stored in the variable
A= [10 12 20 15; 15 36 33 42; 12 -8 -9 -7]. How can we index and retrieve the value 33
from this array?
a) A[2,3] b) A(2,3) c) A(3,2) d) none of the above
10. How do we represent the exponential function in MATLAB?
a) Exp(x) b) Expt(x) c) e(x) d) exp(x)
Abrham G. (P.hD)
Computer Programming Page 2