Managing Variables

MATLAB

1. What will be the output when the following code is written in MATLAB?

 u=sin(10);v=pi;whos

a) u and v are double with 8 bytes
b) u and v are symbolic objects
c) error
d) u and v are double arrays


2. What is the disadvantage of the whos function in MATLAB?

a) It does not show the values of the variable

b) It does not show the size of the variable

c) It does not show the class of the variable

d) It does not show the name of the variable

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

A=100; if(A>99) clear A; end

a) A never gets stored in MATLAB
b) A is first stored and then removed from workspace
c) Error
d) A is retained in the workspace

4. What is the replacement for the whos function?
a) Workspace window
b) Command window
c) Current folder window
d) Remembering all the variables used

5. What does the Workspace show?
a) Attributes of variables, functions from command window
b) Attributes of variables, script files from command window
c) Attributes of variables, script files, functions from command window
d) Attributes of variables from command window

6. What is the output of the following code?

 a=10; b=10; c=’pi’; whos

a) The output will show all double variables
b) The output will show a and b as double and c as symbolic object
c) The output will show a and b as symbolic object and c as char
d) The output will show a and b as double variables and c as char variables

7. From the following desktop view of workspace, choose the correct code.

a) a=10;b=’pi’;syms c; d=[1,2;0;4];
b) a=10;b=’pi’;syms c; d=[1,2;0,4];
c) a=10;b=pi;syms (c); d=[1,2;0,4];
d) a=10;b=’pi’;syms c; d=[1,2;0,4];

8. What is the size of double and symbolic variables holding integer constants?
a) 8 bytes and 16 bytes
b) 16 bytes and 112 bytes
c) 32 bytes and 26 bytes
d) 23 bytes and 112 bytes

9. Choose the correct option as an inference from the following workspace view.

a) ‘ans’, ‘p’ and ‘ap’ are double variables
b) ‘ans’ and ‘p’ are double variables while ‘c’ is a character variable
c) ‘ap’ is symbolic object, ‘c’ is a double variable
d) ‘c’ is a symbolic character

10. What is the difference between who and whos command?
a) The former shows the names of the variables being used while the latter shows the details of the variables in the ongoing program
b) The latter shows the the names of the variables being used while the former shows the details of the variables in the ongoing program
c) No difference at all
d) There is no such function as who and whos

11. What is the conclusion from the following code?

 >>whos
 Name     Size         Bytes    Class     Attributes
 ans      1x1            8      double              
 ap       1x1          112  	sym              
 c        1x2            4      char
 p        1x1            8      double

a) The function ‘whos’ doesn’t show the values of the variables being used
b) The value of each variable is 0
c) The function ‘who’ is more effective than ‘whos’
d) Nothing can be concluded

12. What are Max and Min in the Workspace shown below?

a) They show the maximum and minimum value of the variable
b) The show the maximum and minimum length of the variable
c) They show the maximum and minimum value present in an array
d) They show the median and mode of the variable

13. How would you express a pi as a character and an integer? Choose the correct code.
a) a=pi;b=’pi’;
b) a=22/7; b=pi;
c) a=3.1415; b=22/7;
d) a=3.1429;b=’pi’;

Leave a Reply

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