# MATLAB Questions and Answers – Evaluation – 2

«
»

This set of Basic MATLAB Questions and Answers focuses on “Evaluation – 2”.

1. What is the output of the following code?

`feval[‘round’,123.12]`

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

Explanation: The input arguments to the feval command cannot be given within [], it should be included within parentheses. Hence, an error will be returned. If the input was within parentheses, the output would’ve been 123 only.
Note: Join free Sanfoundry classes at Telegram or Youtube

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

Explanation: The input string argument to the feval command should contain only 1 command. If we give multiple commands to be evaluated, it will give an error.

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

Explanation: The eval command can evaluate multiple commands at the same time and show their answer but it cannot assign to variables.
Take MATLAB Practice Tests - Chapterwise!
Start the Test Now: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

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

Explanation: The input argument to the feval command is given within parentheses. Hence, MATLAB will return an error if we use [].

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

Explanation: The input argument to the evalc command is given within parentheses. Hence, MATLAB will return an error if we use {}.

6. 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

Explanation: The value of ans will keep changing after every expression gets evaluated in the string argument. So the final expression is 123 which will be the last value assigned to the ans variable.
Output: 123

7. What is the output of the following code?

`evalc(‘Laplace(t)’)`

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

Explanation: There is an error in the following code. It would’ve simply evaluated the laplace transform of t which is 1/s2 but t is not defined as symbolic. Hence, MATLAB will return an error.

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

Explanation: The diary command gets disabled when we try to use the evalc command in MATLAB. The commands sin and round work just fine while Inf is not a function.

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

Explanation: The purpose of both the commands is simply to make the commands, provided in the input argument, work. They do not hamper the precision with which the commands evaluate a value.

Sanfoundry Global Education & Learning Series – MATLAB.

To practice basic questions and answers on all areas of MATLAB, here is complete set of 1000+ Multiple Choice Questions and Answers. 