MATLAB Basics set 15

Que.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
Que.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
Que.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
Que.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
Que.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
Que.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’;
Que.What will be the output of the following code?
A=sim(pi)+cod(pi)

a. A=-1
b. Undefined function or variable ‘cod’
c. Undefined function or variable ‘sim’
d. Undefined function or variable ‘sim’ and ‘cod’
Que.What is the output of the following code?
A=[1 2 3]; A^2;

a. [1 4 9]
b. A= 1 4 9
c. A= [1, 4, 9]
d. Inputs must be a scalar or a square matrix
Que.What is the output of the following code?
A=[1 1; 1 1]; A^2

a. A = 2 22 2
b. A = 1 11 1
c. Error using ^ To compute element wise POWER, use POWER (.^) instead
d. No output
Que.What is the output of the following code?
A=[1 2]; B=[1 4]; c=A*B;

a. c= [1 8]
b. c = 18
c. Inner Matrix dimensions must agree
d. No output since we have closed the line of code with a semicolon

Leave a Comment