MATLAB Multiple Choice Questions on “Limits – 1”.
1. Can we check the continuity of a function in MATLAB?
a) Yes
b) No
c) Sometimes
d) Rarely
Answer: a
Clarification: With the help of the limit function, we can check the left-hand limit and right-hand limit for a function approaching a limiting value. We can also check the value of the function at the limiting value. Thus, we can check the continuity of a function at the limiting value.
2. What is the output of the following code?
limit(x^2,x,1,’left’)
a) 1
b) 0
c) x should be declared symbolic
d) Cannot be determined
Answer: c
Clarification: We haven’t initialized x as a symbolic variable. But the command limit() requires an argument which will initialize the function variables as symbolic. We have given x as an input to our command but we haven’t declared it as a symbolic variable. Hence MATLAB will show an error. If we had written syms x, the answer would have been 1.
3. What is the error in the following code?
a) The function
b) The symbolic argument
c) Left should’ve been without
d) No error
Answer: b
Clarification: Our function does not have the character y. Hence, when we introduce y as an argument, MATLAB will show an error. If we had written limit(x^2,x,1,’left’)- the answer would’ve been 1.
4. How can we check whether the limn→3+ n-1 exists?
a) limit(n-1,n,3)
b) syms n;limit(n-1,n,3,’right’)
c) syms n;limit(n-1,3,’right’)
d) syms n;limit(n-1,3,n,’right’)
Answer: b
Clarification: We have to give our symbolic argument before our limit command. Hence, syms n;limit(n-1,n,3,’right’) has the right order, and not syms n;limit(n-1,3,n,’right’). syms n;limit(n-1,n,3,’right’) is not same as limit(n-1,n,3) since there we are calculating the value of the function at the limiting value, 3, but we need to find it at the right-hand side of the limiting value- plus, limit(n-1,n,3) does not declare n as symbolic- this will give an error. syms n;limit(n-1,3,’right’) will give an error since the symbolic argument is not provided into the command.
5. What is the output of the following code?
syms n;limit(n-1,n,Inf,’right’)
a) Inf
b) Nan
c) 0
d) Error
Answer: d
Clarification: We cannot approach the limiting value Infinity from the right-hand side. So, MATLAB will return an error while trying to run the code. The answer would have been Inf if the limiting value was approached from the left hand side.
6. What is the output of the following code?
syms n;limit(n-1,n,nan,'left')
a) 0
b) Inf
c) Nan
d) Error
Answer: c
Clarification: Nan in MATLAB signifies Not a number. If we give Nan as a limiting value argument to our limit command, it will not give an error. Instead, it will return Nan as the result. The result is not helpful at all. The result would have been 0 if the limiting value was 1.
Output: Nan
7. What is the output of the following code?
syms x;limit(((1-cos(x))/(x^2)),x,0)
8. What is the output of the following code?
syms x;limit(((1-cos(x))/(x^2)),x,Inf)
