0% found this document useful (0 votes)
121 views

Attempt The Following Questions and Assume Any Missing Data

This document contains exam questions for a programming languages course. It includes multiple questions asking students to: 1) Determine the size and contents of various arrays defined with different indexing and mathematical operations. 2) Write a MATLAB program to evaluate a user-defined function for any two input values. 3) Evaluate the output of a MATLAB code segment containing a nested for loop with if/elseif/else conditional logic and printing statements.

Uploaded by

Anonymous 2h5lIe
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
121 views

Attempt The Following Questions and Assume Any Missing Data

This document contains exam questions for a programming languages course. It includes multiple questions asking students to: 1) Determine the size and contents of various arrays defined with different indexing and mathematical operations. 2) Write a MATLAB program to evaluate a user-defined function for any two input values. 3) Evaluate the output of a MATLAB code segment containing a nested for loop with if/elseif/else conditional logic and printing statements.

Uploaded by

Anonymous 2h5lIe
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

Minia University Third Year Time allowed: 2 Hrs.

Faculty of Engineering Programming Lang.

CSE Department First Exam., 3rd April, 2012 Degree: 25

Attempt the following questions and assume any missing data Question (I) : Determine the size and contents of the following arrays. Note that the later arrays may depend on the definitions of arrays defined earlier in this 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-specified values x and y. The function f (x, y) is defined as follows:

Question(III): Evaluate the output of the following MATLAB segment,


% question for ii = 1 a = 0; for jj if 3, exam #1 April,2012 : 2 : 4

= 1 : ii jj == 3 a = ii*jj; elseif jj == 2 a = ii^2; continue else a = jj^3; end fprintf('ii = %d,

jj =

%d and a =

%d\n',ii,jj,a)

end end

You might also like