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

Good Luck: Professor M. Moness

This document contains a final exam for a programming languages course. It consists of 6 questions assessing various MATLAB programming skills. Question I involves plotting different relations. Question II evaluates assignment statements and built-in functions. Question III uses a switch structure to output month names. Question IV designs a function to calculate pi using a series. Question V creates and manipulates matrices, including converting to sparse format. Question VI contains a for loop and evaluates outputs. The exam tests a range of core MATLAB topics.

Uploaded by

Anonymous 2h5lIe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
51 views

Good Luck: Professor M. Moness

This document contains a final exam for a programming languages course. It consists of 6 questions assessing various MATLAB programming skills. Question I involves plotting different relations. Question II evaluates assignment statements and built-in functions. Question III uses a switch structure to output month names. Question IV designs a function to calculate pi using a series. Question V creates and manipulates matrices, including converting to sparse format. Question VI contains a for loop and evaluates outputs. The exam tests a range of core MATLAB topics.

Uploaded by

Anonymous 2h5lIe
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Good Luck: Professor M.

Moness Page 1 of 3

Minia University Faculty of Engineering
CSE Department First Year
Programming Languages(2), CSE211 Time allowed: 3 Hours.
Final Exam. (May, 11 2014) Max. Degree: 90

Attempt the following questions and assume any missing data

Question (I): 20 points
Plot the following relation in the shown locations:
(1) Figure 1: () ()


(2) Figure 2: () ()


(3) Figure 3: () () ()


(4) Figure 4: ( )

()


(5) Figure 5:
( ) ()

() ()

()

I n each case illustrate titles, labels and any necessary information.





Good Luck: Professor M. Moness Page 2 of 3


Question (II): 20 points
(2.1) Given the following assignment statements:
ch1 = Samir ; ch2 = First Year ; ch3 = Programming Language ;
What are the outputs of the following statements:
a = char(ch1 , ch2 , ch3) b = a(1,:)
c = size(b) d = strcat(ch1 , ch2 , ch3)
e = strvcat(ch1 , ch2 , ch3) f = isstrprop(ch3, upper)
(2.2) Evaluate the following assignment statements:
(i) x = real(2 + 3j) (ii) y = conj(5*i 15)
(iii) z = [1 : 3 : 11].*[5 :-1:2] (iv) L = 5>= [ 7 -4 2 ; 0 8 5]
(v) M = ( 6 >=7 || 2 ~=3 && 5<=6) (vi) N = ceil(-4.99) + floor(2.6)
(vii) Q = 4\8*2^3/4 (viii) R = eye(3)*diag( [2 -5 7] )

Question (III) :15 points
Design a MATLAB, using the switch structure to display the name of the
month (January, February, .., December), corresponding to a given
positive integer n (n=1, 2, , and 12).You must check your inputs.

Question (IV): 16 points
Design a MATLAB function to compute the approximate value of using n-
terms of the following infinite series ( you must check your inputs):



Question (V): 12 points
(1) Write MATLAB statements to create the following nxn matrix

(


(2) Convert the matrix A to a sparse matrix As and find the following
matrices using sparse matrix function:
(a) ()

(b) () (c) ()



Good Luck: Professor M. Moness Page 3 of 3

Question (VI): 20 points
(1) How many times fprintf may be executed in the following MATLAB
segment?
(2)What are the outputs of executing this MATLAB segment (n , m, b, and
c?
a = [ 1 0 3 ; -1 2 0]; m = 1;
b = m*a ;
for k = a
for n = 1:length(a)
if n = m
continue
end
c = a.^n ;
fprintf(n = %6.3f m = %f6.3 and c = %f8.3\n ,n , m , c)
end
m = m+1 ;
fprintf(b = %f6.3 n = %f6.3 m = %f6.3\n b , m)
end

You might also like