This PowerPoint helps students to consider the concept of infinity.
MSc_I_Sem_End_Sem_Paper_1.pdf
1. Name:
Reg. No.:
END TERM EXAMINATION - JANUARY 2022
SEMESTER-I
(M.Sc.)
Subject Code: 21MAMS106 Duration: 3 hours
Subject: Computer Programming using Max. Marks: 100
MATLAB
Instructions
• All Questions are compulsory
• The Question paper consists of 2 sections - Part A contains 10 questions of 2 marks
each. Part B consists of 5 questions of 16 marks each.
• There is no overall choice. Only Part B question include internal choice.
PART - A
(2 * 10 = 20 Marks)
1. What are the types of loops does MATLAB provides?
2. What is the output of the following code?
A=[1 2 3..
];
3. Which command is used to clear the workspace?
4. Which command will give the square of elements of A = [1 3 5 7]?
5. Write short note on Workspace.
6. Distinguish between array multiplication and matrix multiplication.
7. Summarize the main difference between Scripts and Functions.
8. List out the Relational Operators.
9. What is the error in the following code
x = −1 : 0.1 : 1; y = −10 : 2 : 10; plot(x, y)
10. What are basic conditional statements available in MATLAB?
PART - B
(16 * 5 = 80 Marks)
11. (a) (i) Solve the following system of linear equations with MATLAB in both
ways:
x + y − z = 5; −x − y = 3; y + z = 4.
(ii) Create a 3 × 4 matrix A in which all the elements are 1, and create a
2 × 2 matrix B in which all the elements are 5. Then, add elements to
the matrix A by appending the matrix B such that A will be:
A =
1 1 1 0 0
1 1 1 0 0
1 1 1 0 0
0 0 0 5 5
0 0 0 5 5
OR
(b) What are different major tools within or accessible from the desktop in MAT-
LAB and explain each tool.
12. (a) If
A =
1 2 −1
0 1 1
1 −4 −7
then, write the commands
(i) to extract the sub-matrix with last two-columns of matrix A.
(ii) to delete the second column of matrix A.
(iii) to interchange the rows 1 and 2, of matrix A.
(iv) to find the size of the matrix A.
(v) to extract the diagonal of matrix A.
OR
(b) For matrix
A =
1 4 0
3 −1 −9
0 12 8
Execute the following:
(i)A(2, 1) (ii) A(1, :) = [] (iii) B = A([2, 3], [1, 2])
(iv) C = A([3 1 2], :) (v)A(end : −1 : 1, end)
13. (a) Using a nested for loop, write a MATLAB code to display all the prime num-
bers from 1 to 100.
OR
(b) Using While loop, write a MATLAB Code to calculate factorial (n); n is an
integer. Hence find factorial (7).
14. (a) If f1(x) = x3
− 2x2
+ 12x − 4 and f2(x) = 2x3
− x2
+ 5x − 3, then evaluate
2f1(x) + 4f2(x) on [0, 4]. Also, plot the output.
OR
2. (b) Determine the real roots of g(x) = x5
− 3x4
− 10x3
+ 27x2
+ 10x − 24 and then
plot the polynomial over the appropriate interval to verify that the polynomial
crosses the x-axis at the real root locations.
15. (a) Discuss in detail the Debugging process.
OR
(b) (i) Write a MATLAB code for plotting the functions y1 = 2e−2x
, y2 =
cos x − sin 3x on the interval [0, 5π] with step size π/10.
(ii) Determine the number of consecutive integer numbers which when added
together will give a value equal to or just less than 210.