250+ TOP MCQs on Performance and Memory – 2 and Answers

Advanced MATLAB Questions and Answers on “Performance and Memory – 2”.

1. Which of the following contains the memory for the virtual address space given to MATLAB?

a) Error
b) p
c) There’s no virtual space for MATLAB
d) q
Answer: d
Clarification: The amount of memory allotted to the Virtual Address Space of MATLAB is given as an array to q. Hence, q is correct.

2. The function handle given to the timeit command cannot be defined within the timeit function.
a) True
b) False
Answer: b
Clarification: The function handle can be given as an input to the timeit() command. It’s not necessary that we need a separate variable to declare a function handle.

3. The timeit function returns the time in ms.
a) True
b) False
Answer: a
Clarification: The timeit function returns the time in seconds. Hence, the above statement is false.

4. What is the output of the following code?

syms x;
timeit(@()sin(x))

a) The time required to compute the value of a sin(x)
b) Error due to sin(x)
c) Syntactical Error
d) Time required to initialize sin(x) as a vector of symbolic elements
Answer: d
Clarification: Since x is declared as symbolic, the function sin(x) will only initialize itself as sin(x), It doesn’t compute a specific value and hence the time required for initializing sin(x) as a vector of symbolic elements is correct.

5. What is the output of the following code?

a) Syntactical Error
b) Logical Error
c) .0012
d) .0016
Answer: a
Clarification: The function handle has been declared with an error. A set of parentheses is missing. TH e function handle is defined as @()sin(x). Hence, the above code will give an error.

  250+ TOP MCQs on User Input and Screen Output – 2 and Answers

6. Which of the following method increases the performance of operation?
a) Preallocation
b) Postallocation
c) It’s not possible to increase performance
d) Characterization
Answer: a
Clarification: The method of preallocation helps in increasing the performance of memory. It can be used to specifically increase the speed of the operation.

7. Is a==c?

>>a=timeit(@()sin(x));
>>b=cputime;
>>sin(x);
>>c=cputime-b;

a) No
b) Yes
c) Almost
d) Error
Answer: a
Clarification: The time calculated and assigned to c is usually more than that in a. This is because the cpu time increases in the third statement only. Hence the option, which says that a is not equal to c is correct.

8. What is the output of the following code?

a) Error
b) .0012s
c) 12ms
d) .0016s
Answer: a
Clarification: There is an error in the above code. The function handle has been wrongly decalred since the ‘@’ is missing. Hence the option, which says there will be an error, is correct.

9. The amount of memory saved for swap files is more than the physical memory allotted for MATLAB.
a) True
b) False
Answer: b
Clarification: The latter is always greater than the former. This is because the physical memory is getting used up during operations.

10. The tick command starts a timer.
a) True
b) False
Answer: b
Clarification: The command is misspelled. The correct command is tic only. Hence, the above statement is false.

advanced questions and answers on ,

  250+ TOP MCQs on Time Response of Control Systems – 1 and Answers

Scroll to Top