Evaluation

MATLAB

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Evaluation – 1”.

1. What is the output of the following code?

[q]=eval(sprintf('23 '))

a) q=23
b) Logical Error
c) Symbolic error
d) No output

2. What is the output of the following code?

[q,r]=eval(‘sprintf('23 45')’)

a) Unexpected MATLAB expression
b) q=23,r=45
c)

   q = 23
   r = 45

d) Error due to eval

3. What is the output of the following code?

p=eval(cos(0));

a) p=1
b)

    p=
      1

c) Syntactical error
d) The eval command does not exist

4. What is the output of the following code?

evalc(‘cos(0)’)

a) No such command
b) Error
c) 1
d) ‘ ans=1 ’

5. What is the size of p from the following code?

P=evalc(‘ ’)

a) 2 bytes
b) 0 bytes
c) Error
d) 6 bytes

6. The for keyword can be used to evaluate expressions using eval().
a) True
b) False

7. The evalc function is different from the eval command ________
a) no difference
b) from precision of output
c) from nature of output
d) from display of output

8. What is common to evalc and the eval commands, apart from the output?
a) The error message is displayed separately
b) The outputs are of different accuracy
c) There is nothing common
d) evalc does not exist

9. What is the output of the following code?

P=eval(‘ ’)

a) P= ‘ ’
b) P will be an empty character array
c) Error
d) No such function

10. What is the output of the following code?

feval(“sum”,1234,1)

a) Syntactical error
b) Logical Error
c) 1235
d) ‘1234’

11. What is the output of the following code?

feval[‘round’,123.12]

a) 123
b) 123.12
c) 123.1
d) Error

12. The feval command can evaluate __________
a) A single command
b) Multiple commands
c) Multiple functions
d) No such function exists

13. The eval command can evaluate __________
a) A single function
b) Only a single command
c) The function does not exist
d) Multiple commands

14. The input to the eval command is given using [].
a) True
b) False

15. The input to the evalc command is given using {}.
a) True
b) False

16. What is the value of ans from the following code?

feval(‘sin(0),cos(0),123’)

a) 123
b) 0,1,123
c) Error
d) 0

17. What is the output of the following code?

evalc(‘Laplace(t)’)

a) Syntactical Error
b) Symbolic error
c) ‘1/s2
d) 1/s2

18. Which function gets disabled while using evalc()?
a) diary
b) sin
c) inf
d) round

19. How much does the precision change while finding sin(x) using evalc and eval?
a) 10%
b) 2%
c) 20%
d) No change

Leave a Reply

Your email address will not be published. Required fields are marked *