MATLAB Questions and Answers – Limits – 2

This set of MATLAB test focuses on “Limits – 2”.

1. What will be the output of the following code?

syms x;limit('(sin(x)/x)',x,Inf,'left')

a) 0
b) Nan
c) Inf
d) 1
View Answer

Answer: a
Explanation: We will get a warning since we have given our function as string input to our limit command. But the output will be 0. This is because as x approaches infinity, the function will approach zero because sin(x) has a finite value though we are not sure of the value it still is a finite value.
Output: 0
advertisement
advertisement

2. What will be the output of the following code?

sym x; limit(ans^2\sin(ans),Inf)

a) 0
b) Error
c) Nan
d) Cannot be determined
View Answer

Answer: a
Explanation: When we declare a variable with the sym command, the carriable is assigned to ans variable and it is a symbolic variable. Hence we can use ans as our variable which points to the symbolic variable x. Now we see the ‘ \ ‘ operator which will divide the operand on the left-hand side by the right-hand side. Hence, the output will be 0. The output is a specific number hence it will not be Nan.

3. The condition for removal discontinuity is ____________
a) Left hand limit = right hand limit ≠ function value
b) Left hand limit ≠ right hand limit = function value
c) Right hand limit ≠ left hand limit = function value
d) Left hand limit ≠ right hand limit ≠ function value
View Answer

Answer: a
Explanation: The condition of removal discontinuity is given by option Left hand limit = right hand limit ≠ function value only. Rest are incorrect because the two conditions of removal discontinuity is limn→n0 f(n) < ∞ and f(n0) < ∞. So the function should have equal values while reaching the limiting value from both directions and it should have a finite value at the limiting value. But since there is a discontinuity at the limiting value, the values after approaching the function from both directions is not equal to the function value at the limiting value.
advertisement

4. Can we perform infinite series summation in MATLAB?
a) Yes
b) No
c) Cannot be determined
d) Sometimes
View Answer

Answer: d
Explanation: Symbolic summations is available in MATLAB. This allows us to find sum of series expansions. We can do infinite series summation in MATLAB. We can calculate the series to n terms and then make n approaching infinity.

5. Negative limiting values cannot be applied to logarithmic functions in MATLAB.
a) True
b) False
View Answer

Answer: b
Explanation: If we give negative limiting values to logarithmic functions, they will return imaginary numbers. These can be treated as solutions to such problems. MATLAB is a very powerful computing tool that can be used to solve such problems.
advertisement

6. The result of the following code?

syms x;limit(sin(x)/x,Inf,’right’)

a) Error due to symbolic argument
b) Error due to direction of approach of limiting value
c) 1
d) 0
View Answer

Answer: a
Explanation: MATLAB breaks the computation as soon as it finds an error. Since the first error it gets is that we haven’t given ‘x’ as a symbolic input, MATLAB will show this as an error. Had x been introduced as a symbolic argument, the error would have been in the given direction to approach the limiting value (∞). If we had given ‘left’ instead of right, the answer would have been 0.

7. To do double limits, we can use __________
a) limit(limit())
b) limit( multiple inputs)
c) cannot be done in MATLAB
d) lim()
View Answer

Answer: a
Explanation: Double limits can be done in MATLAB. This can be done by placing limits within limits as in option limit(limit()). We cannot give multiple arguments within one lim() command. There is no command called lim() in MATLAB.

8. What is the output of the following code?

syms x y;limit(y*x,1,x,'left','left')

a) Error
b) Error due to symbolic argument y
c) Error due to multiple inputs
d) y
View Answer

Answer: c
Explanation: We cannot give multiple inputs to the limit command. Thus the above code will give this error. We know that we have give ‘y’ as a symbolic input- but MATLAB will see this error first. Hence it will give this as an error.

9. What is the output of the following code?

syms n;limit((1+1/n)^n,Inf,’right’)

a) Nan
b) Inf
c) Error
d) e(1)
View Answer

Answer: d
Explanation: We cannot approach infinity from the right hand side. Hence MATLAB will show an error. If we had given the direction as left or if we had not given any direction, the answer would have been e(1).

10. We cannot calculate continuity at infinity in MATLAB.
a) True
b) False
View Answer

Answer: b
Explanation: We can calculate the continuity of a function at infinity. If the function is continuous, we will get a result after using the limit() command. Else MATLAB will give Inf as a result.

Sanfoundry Global Education & Learning Series – MATLAB.

To practice all areas of MATLAB for tests, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.