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

1. How many expressions are there in the following mathematical relation?

a=sqrt(log(sqrt(x+y)))

a) 2

b) 3

c) 1

d) 4

View Answer

Explanation: The given relation has 3 functions but it has 4 expressions in itself. sqrt(x+y) is an expression while sqrt() is the function. log(sqrt(x+y)) is a separate expression while log() is the function. sqrt(log(sqrt(x+y))) is entirely an expression. The entire mathematical relation is an expression used to describe that a is equal to sqrt(log(sqrt(x+y))); this is important since we are sure about the nature of the relationship between a,x and y. Hence, there are 4 expressions which successfully describe the mathematical relation between the variables a,x and y.

2. How many functions are there in the following mathematical relation?

p=sin(pi*(log(x))

a) 2

b) 3

c) 1

d) 0

View Answer

Explanation: There are only 2 functions used to describe a meaningful relationship between p and x. They are the sin() and log(x). Now, the expression ‘pi*log(x)’ is not to be confused as a function since we have not created a function i.e. we have not made a self-containing block of statements with an algorithm to compute the value after multiplying pi with log(x). The ‘*’ operator is used directly to the expression does not serve as a function, it shows an operation. Hence there are only 2 functions.

3. What are the minimum numbers of expressions which will be required to express a mathematical relation?

a) At least 1

b) At least 2

c) At most 1

d) Depends on the number of variables

View Answer

Explanation: If we have a very big expression relating a variable y with any no. of variables x

_{1},x

_{2}…x

_{n}we can put the entire expression on the right hand side within a function and reduce the expression to

y=func(x

_{1},x

_{2},x

_{3}…x

_{n})

This contains two expressions only. The function, ‘func’, may contain a set of 10000 statements. But we have simplified the expression to demonstrate a mathematical relation between y and all the other variables of the right-hand side, provided we are sure about the nature of the function ‘func’.

4. Is it possible to reduce the number of expressions in the following mathematical relation?

a=sin(pi*log(x))

a) Yes

b) No

c) Maybe

d) Impossible

View Answer

Explanation: We can define a function, say func, which contains the block of statements, required, to compute the given relation and return the value. Then we can say

a=func(x)

We have 2 expressions now while the previous statement had 4 expressions. Hence, we have reduced the number of expressions.

5. Is it possible to reduce the number of functions in the following mathematical relation?

l=cos(2*pi*sin(n/x))

a) Yes

b) No

c) Maybe

d) Obviously

View Answer

Explanation: We cannot reduce the number of functions which are required to express a mathematical relation amongst variables. This is because those functions compute the value of the dependent variable for any value of the independent variable. In some cases, we may approximate the values of the dependent variable- but we are approximating the functional operation, we are not deleting the function.

6. The teacher has given the assignment to find the sum of 2 numbers. But the code should not contain the ‘+’ operator. What is to be done?

a) Use a function

b) Add the values and print the sum directly

c) Use an expression

d) Cannot be done

View Answer

Explanation: The power of a function is to hide the statements which are used to complete our task. So the student can create a function file to add two numbers. Hence, the code will not show the ‘+’ operator but it will be used implicitly.

7. How many expressions are used to describe a mathematical relation between a, b and c?

b=9; c=4; a=b+c;

a) 4

b) 2

c) 3

d) 1

View Answer

Explanation: The code has 4 expressions, ‘b=9’, ‘c=4’, ‘b+c’, and ‘a=b+c’. The mathematical relation is described by ‘a=b+c’ only which contains 2 expressions. Hence, there are two expressions that has been used to describe a mathematical relation between a, b and c.

8. A mathematical statement is a combination of functions and variables only.

a) True

b) False

View Answer

Explanation: An expression is a combination of variables, operators and functions. It is not necessary that only functions and variables are present in a mathematical expression. The statement ‘a=b+c’ contains no functions, but it only performs the addition operation between b and c and assigns the value to a. The statement a=sum(b,c) shows no mathematical operation explicitly since the operation is done by the function itself.

9. What is the command which can be used to see the expressions within a user-defined function in MATLAB?

a) help

b) look for

c) echo on

d) cannot be seen

View Answer

Explanation: A user-defined function is a function file. The commands ‘help’ and ‘look for’ will only return the nature of in-built function. If the function file has ‘echo on’, it will display the expressions in the function file while executing. This is because function files, though they are different from script files, are inherently M-files.

10. What are mathematical expressions?

a) Any mathematical relation

b) Any mathematical operation

c) Any mathematical conversation

d) Any mathematical function

View Answer

Explanation: A mathematical function is used to relate a dependent variable with an independent variable so it is used to operate on the independent variable. Similarly, any mathematical relation is used to relate an independent variable with a dependent variable. This is also an operation since based on the value of the independent variable, we comment on the value of the dependent variable. Hence a mathematical expression is simply any mathematical operation.

**Sanfoundry Global Education & Learning Series – MATLAB.**

To practice all areas of MATLAB, __here is complete set of 1000+ Multiple Choice Questions and Answers__.

**Next Steps:**

- Get Free Certificate of Merit in MATLAB
- Participate in MATLAB Certification Contest
- Become a Top Ranker in MATLAB
- Take MATLAB Tests
- Chapterwise Practice Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
- Chapterwise Mock Tests: Chapter 1, 2, 3, 4, 5, 6, 7, 8, 9, 10

**Related Posts:**