# Sums and Products

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Sums and Products”.

1. We can generate the summation of a series, formed with a character, using ________
a) symsum
b) sum
c) symssum
d) int

2. If the result of our summation is Infinity, what will MATLAB show?
a) Infinity
b) Nan
c) Inf
d) Error

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

`sin(symsum(k^2,1,Inf));`

a) Nan
b) Inf
c) Error
d) Output is suppressed

4. How does MATLAB get the symbolic character in the function, if it is not mentioned in symsum() command?
a) It cannot
b) It uses symvar()
c) It uses symsvar()
d) It uses symbvar()

5. The sum() command cannot do ____________
a) Infinite summation
b) Numeric summation
c) Long summation
d) signed summation

6. To calculate the sum of only absolute variables in a series, we use _________
a) sum(abs())
b) abssum()
c) sumabs()
d) abs(sum())

7. What is the output of the following code?

`sumsqr([1 2; NaN 4])`

a) 21
b) Nan
c) Error
d) Inf

8. What is the output of the following code:

`sumsqr([Inf Inf; Inf Inf])`

a) Inf
b) Nan
c) 0
d) Error

9. What is the output of the following code?

`sumabs([Inf Inf; Inf Inf])`

a) Inf
b) 0
c) Nan
d) Error

10. To find the absolute value of the sum of squares of numbers in a series, we use_________
a) abs(sumsqr())
b) sumsqr()
c) sumsqr(abs())
d) abs(sqrsum())

11. We can find the mean value of a series (upto n) using _________
a) meanabs()
b) mean()
c) sumabs()
d) sum()/n

12. We can find the summation of an A.G.P. series using __________
a) sum()
b) symsum()
c) Depends on the series
d) Cannot be done

13. We need to define a function separately to find the factorial of a number.
a) True
b) False

14. The function to evaluate the following series is

`12+22+32+42+52+…832`

a) sqr()
b) sqrsum()
c) sumsqr()
d) sumsqr[]

15. What is the output of the following code?

`mean[1:10]`

a) Syntactical Error
b) 4.5
c) 5.5
d) Parse Error

16. What is the output of the following code?

`meansqr(NaN)`

a) 0
b) NaN
c) Error
d) 1

17. What is the output of the following code?

`meanabs(1,2,-1)`

a) 1.33
b) 1
c) 0
d) .666

18. What is the output of the following code?

`A=[1:3:7;2:3:8;3:3:9]; prod(A,1)`

a) Error
b) 6 20 504
c)

```    6
20
504```

d) 28 80 162

19. What is the output of the following code?

`prod(1:NaN)`

a) 0
b) 1
c) NaN
d) Error

20. What is the output of the following code?

`cumsum([1,2,3,4,NaN])`

a) 1 3 6 10 NaN
b) NaN
c)

```    1
3
6
10
NaN```

d) Error

21. What is the output of the following code?

`cumsum[NaN]`

a) NaN
b) 0
c) Error due to NaN
d) Syntactical Error

22. The product of a set of elements is always greater than it’s the cumulative sum.
a) True
b) False

23. The function to find the R.M.S value is __________
a) sqrt(meansqr())
b) sqrt[meansqr[]]
c) sqrt(meansqr[])
d) sqrt[meansqr()]

24. What is the output of the following code?

`A=[1:3:7;2:3:8;3:3:9]; prod(A,2)’`

a) 28 80 162
b)

```    20
80
162```

c) Error
d) NaN

25. Which function does cumulative summation of elements?
a) sumcum[]
b) sumcum()
c) cumsum[]
d) cumsum()

26. What is the output of the following code?

`cumsum(1,2,-1)`

a) 1 3 2
b) 2
c) Error due to input
d) Error due to syntax

27. The sum function will return a NaN if any of the element in the input vector is NaN.
a) True
b) False

28. The result of cumsum([1,2,3]) and sum([3,3]) are ____________
a) Same
b) Different
c) Absolute numbers
d) Signed numbers

29. What is the output of the following code?

`syms a,k; symsum(a^k, 1, Inf)`

a) Error
b) -1/(a-1) -1
c) -1/(a-1)
d) Inf

30. What is the output of the following code shown?

`syms a k; symsum(a^k, 0, Inf)`

a) 1/1-a
b) Inf
c) Error due to Inf
d) Error due to an unmentioned value of a