SlideShare a Scribd company logo
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)
Ad

More Related Content

What's hot (20)

Lecture two
Lecture twoLecture two
Lecture two
Mahmoud Hussein
 
Doc 20180130-wa0006
Doc 20180130-wa0006Doc 20180130-wa0006
Doc 20180130-wa0006
HarithaRanasinghe
 
유한요소법(FEM)을 이용한 구조해석
유한요소법(FEM)을 이용한 구조해석유한요소법(FEM)을 이용한 구조해석
유한요소법(FEM)을 이용한 구조해석
chimco.net
 
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -4 notes
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -4 notesVTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -4 notes
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -4 notes
Jayanth Dwijesh H P
 
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-4 notes(15...
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-4 notes(15...VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-4 notes(15...
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-4 notes(15...
Jayanth Dwijesh H P
 
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-5 notes(15...
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-5 notes(15...VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-5 notes(15...
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-5 notes(15...
Jayanth Dwijesh H P
 
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -5 notes
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -5 notesVTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -5 notes
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -5 notes
Jayanth Dwijesh H P
 
Math unit29 using graphs to solve equations
Math unit29 using graphs to solve equationsMath unit29 using graphs to solve equations
Math unit29 using graphs to solve equations
eLearningJa
 
Math unit30 functions
Math unit30 functionsMath unit30 functions
Math unit30 functions
eLearningJa
 
Assignment 1
Assignment 1Assignment 1
Assignment 1
Ciaran Cox
 
Week7
Week7Week7
Week7
Ashutosh Singh
 
Two Dimentional Array
Two Dimentional ArrayTwo Dimentional Array
Two Dimentional Array
Sonya Akter Rupa
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
Mohammad Vaseem Akaram
 
First Partial Review
First Partial ReviewFirst Partial Review
First Partial Review
Carlos Vázquez
 
Matrix Multiplication(An example of concurrent programming)
Matrix Multiplication(An example of concurrent programming)Matrix Multiplication(An example of concurrent programming)
Matrix Multiplication(An example of concurrent programming)
Pramit Kumar
 
Assignment premier academic writing agency with industry
Assignment premier academic writing agency with industry Assignment premier academic writing agency with industry
Assignment premier academic writing agency with industry
Nicole Valerio
 
Fuzzy Sequencing Problem Using Generalized Triangular Fuzzy Numbers
Fuzzy Sequencing Problem Using Generalized Triangular Fuzzy NumbersFuzzy Sequencing Problem Using Generalized Triangular Fuzzy Numbers
Fuzzy Sequencing Problem Using Generalized Triangular Fuzzy Numbers
IJERA Editor
 
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
 
Machine Learning Basics
Machine Learning BasicsMachine Learning Basics
Machine Learning Basics
Humberto Marchezi
 
Gate-Cs 1995
Gate-Cs 1995Gate-Cs 1995
Gate-Cs 1995
Ravi Rajput
 
유한요소법(FEM)을 이용한 구조해석
유한요소법(FEM)을 이용한 구조해석유한요소법(FEM)을 이용한 구조해석
유한요소법(FEM)을 이용한 구조해석
chimco.net
 
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -4 notes
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -4 notesVTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -4 notes
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -4 notes
Jayanth Dwijesh H P
 
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-4 notes(15...
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-4 notes(15...VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-4 notes(15...
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-4 notes(15...
Jayanth Dwijesh H P
 
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-5 notes(15...
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-5 notes(15...VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-5 notes(15...
VTU E&C,TCE CBCS[NEW] 5th Sem Information Theory and Coding Module-5 notes(15...
Jayanth Dwijesh H P
 
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -5 notes
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -5 notesVTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -5 notes
VTU CBCS E&C 5th sem Information theory and coding(15EC54) Module -5 notes
Jayanth Dwijesh H P
 
Math unit29 using graphs to solve equations
Math unit29 using graphs to solve equationsMath unit29 using graphs to solve equations
Math unit29 using graphs to solve equations
eLearningJa
 
Math unit30 functions
Math unit30 functionsMath unit30 functions
Math unit30 functions
eLearningJa
 
Directed Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocksDirected Acyclic Graph Representation of basic blocks
Directed Acyclic Graph Representation of basic blocks
Mohammad Vaseem Akaram
 
Matrix Multiplication(An example of concurrent programming)
Matrix Multiplication(An example of concurrent programming)Matrix Multiplication(An example of concurrent programming)
Matrix Multiplication(An example of concurrent programming)
Pramit Kumar
 
Assignment premier academic writing agency with industry
Assignment premier academic writing agency with industry Assignment premier academic writing agency with industry
Assignment premier academic writing agency with industry
Nicole Valerio
 
Fuzzy Sequencing Problem Using Generalized Triangular Fuzzy Numbers
Fuzzy Sequencing Problem Using Generalized Triangular Fuzzy NumbersFuzzy Sequencing Problem Using Generalized Triangular Fuzzy Numbers
Fuzzy Sequencing Problem Using Generalized Triangular Fuzzy Numbers
IJERA Editor
 
Parallel algorithms
Parallel algorithmsParallel algorithms
Parallel algorithms
guest084d20
 

Similar to Exam matlab1 (20)

2nd mid term daa paper
2nd mid term daa paper2nd mid term daa paper
2nd mid term daa paper
Mansi Puri
 
lecture 2.2.2 2D array.pptx IUGLFHLHFJFY
lecture 2.2.2 2D array.pptx IUGLFHLHFJFYlecture 2.2.2 2D array.pptx IUGLFHLHFJFY
lecture 2.2.2 2D array.pptx IUGLFHLHFJFY
gargh4711
 
09 a1ec01 c programming and data structures
09 a1ec01 c programming and data structures09 a1ec01 c programming and data structures
09 a1ec01 c programming and data structures
jntuworld
 
Sp 1418794917
Sp 1418794917Sp 1418794917
Sp 1418794917
lakshmi r
 
selfstudys_com_file (4).pdfjsjdcjjsjxjdnxjj
selfstudys_com_file (4).pdfjsjdcjjsjxjdnxjjselfstudys_com_file (4).pdfjsjdcjjsjxjdnxjj
selfstudys_com_file (4).pdfjsjdcjjsjxjdnxjj
AntarikshGarg
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
chinthala Vijaya Kumar
 
Aerospace Engineering (AE) - Gate Previous Question Paper 2011 Download
Aerospace Engineering (AE) - Gate Previous Question Paper 2011 DownloadAerospace Engineering (AE) - Gate Previous Question Paper 2011 Download
Aerospace Engineering (AE) - Gate Previous Question Paper 2011 Download
Rakesh Bhupathi
 
CS Sample Paper 1
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1
kvs
 
D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S J N T U M O D E L...
D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S  J N T U  M O D E L...D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S  J N T U  M O D E L...
D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S J N T U M O D E L...
guest3f9c6b
 
R05010303 C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...
R05010303  C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...R05010303  C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...
R05010303 C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...
guestd436758
 
Computer Science Sample Paper 2
Computer Science Sample Paper 2Computer Science Sample Paper 2
Computer Science Sample Paper 2
kvs
 
Gate-Cs 1994
Gate-Cs 1994Gate-Cs 1994
Gate-Cs 1994
Ravi Rajput
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdf
ahmed8651
 
Mca 104
Mca 104Mca 104
Mca 104
smumbahelp
 
ComputerScience-SQP.pdffhtu h kya hua hai ap ka school
ComputerScience-SQP.pdffhtu h kya hua hai ap ka schoolComputerScience-SQP.pdffhtu h kya hua hai ap ka school
ComputerScience-SQP.pdffhtu h kya hua hai ap ka school
ravita44554455
 
Mathematica model test paper
Mathematica model test paperMathematica model test paper
Mathematica model test paper
Luckshay Batra
 
Computer science ms
Computer science msComputer science ms
Computer science ms
B Bhuvanesh
 
matlab example
matlab examplematlab example
matlab example
BirukTigistu
 
Math paper class 12 maths paper class 12
Math paper class 12 maths paper class 12Math paper class 12 maths paper class 12
Math paper class 12 maths paper class 12
nsridevi1405
 
Gate-Cs 2006
Gate-Cs 2006Gate-Cs 2006
Gate-Cs 2006
Ravi Rajput
 
2nd mid term daa paper
2nd mid term daa paper2nd mid term daa paper
2nd mid term daa paper
Mansi Puri
 
lecture 2.2.2 2D array.pptx IUGLFHLHFJFY
lecture 2.2.2 2D array.pptx IUGLFHLHFJFYlecture 2.2.2 2D array.pptx IUGLFHLHFJFY
lecture 2.2.2 2D array.pptx IUGLFHLHFJFY
gargh4711
 
09 a1ec01 c programming and data structures
09 a1ec01 c programming and data structures09 a1ec01 c programming and data structures
09 a1ec01 c programming and data structures
jntuworld
 
Sp 1418794917
Sp 1418794917Sp 1418794917
Sp 1418794917
lakshmi r
 
selfstudys_com_file (4).pdfjsjdcjjsjxjdnxjj
selfstudys_com_file (4).pdfjsjdcjjsjxjdnxjjselfstudys_com_file (4).pdfjsjdcjjsjxjdnxjj
selfstudys_com_file (4).pdfjsjdcjjsjxjdnxjj
AntarikshGarg
 
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
CBSE Class 12 Computer Science(083) Sample Question Paper 2020-21
chinthala Vijaya Kumar
 
Aerospace Engineering (AE) - Gate Previous Question Paper 2011 Download
Aerospace Engineering (AE) - Gate Previous Question Paper 2011 DownloadAerospace Engineering (AE) - Gate Previous Question Paper 2011 Download
Aerospace Engineering (AE) - Gate Previous Question Paper 2011 Download
Rakesh Bhupathi
 
CS Sample Paper 1
CS Sample Paper 1CS Sample Paper 1
CS Sample Paper 1
kvs
 
D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S J N T U M O D E L...
D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S  J N T U  M O D E L...D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S  J N T U  M O D E L...
D E S I G N A N D A N A L Y S I S O F A L G O R I T H M S J N T U M O D E L...
guest3f9c6b
 
R05010303 C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...
R05010303  C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...R05010303  C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...
R05010303 C O M P U T E R P R O G R A M M I N G A N D N U M E R I C A L M E ...
guestd436758
 
Computer Science Sample Paper 2
Computer Science Sample Paper 2Computer Science Sample Paper 2
Computer Science Sample Paper 2
kvs
 
MATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdfMATLAB Questions and Answers.pdf
MATLAB Questions and Answers.pdf
ahmed8651
 
ComputerScience-SQP.pdffhtu h kya hua hai ap ka school
ComputerScience-SQP.pdffhtu h kya hua hai ap ka schoolComputerScience-SQP.pdffhtu h kya hua hai ap ka school
ComputerScience-SQP.pdffhtu h kya hua hai ap ka school
ravita44554455
 
Mathematica model test paper
Mathematica model test paperMathematica model test paper
Mathematica model test paper
Luckshay Batra
 
Computer science ms
Computer science msComputer science ms
Computer science ms
B Bhuvanesh
 
Math paper class 12 maths paper class 12
Math paper class 12 maths paper class 12Math paper class 12 maths paper class 12
Math paper class 12 maths paper class 12
nsridevi1405
 
Ad

Exam matlab1

  • 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)