1. Minia University
Third Year
Faculty of Engineering
Programming Lang.
CSE Department
First Exam.,3rd April, 2012
Time allowed: 2 Hrs.
Degree: 25
Attempt the following questions and assume any missing data
Question (I):Determine the size and contents of the following arrays. Note
that thelater arrays may depend on the definitions of arrays defined earlier
inthis exercise.
(a) a = 2:3:8;
(b) b = [a' a' a'];
(c) c = b(1:2:3,1:2:3);
(d) d = a + b(2,:);
(e) w = [zeros(1,3) ones(3,1)' 3:5'];
(f )b([1 3],2) = b([3 1],2);
(g) e = 1:-1:5;
Question (III)Write a MATLAB program to evaluate a function f(x, y) for any two
user-specifiedvalues x and y. The function f (x, y) is defined as follows:
Question(III): Evaluate the output of the following MATLAB segment,
% question 3, exam #1 April,2012
for ii = 1 : 2 : 4
a = 0;
forjj = 1 : ii
ifjj == 3
a = ii*jj;
elseifjj == 2
a = ii^2;
continue
else
a = jj^3;
end
fprintf('ii = %d, jj = %d and a =
end
end
%dn',ii,jj,a)