## MATLAB Questions and Answers Part-1

1. To determine whether an input is MATLAB keyword, command is?
a) iskeyword
b) key word
c) inputword
d) isvarname

Explanation: Command iskeyword uses the MATLAB command format. iskeyword returns a list of all MATLAB keywords. It gives output in the form of 1 and 0.

2. Executing in the editor window the following code returns.
a = 1; sin(a) a = 2;
a) 0.4815
b) 0.8415
c) 1
d) 0.9093

Explanation: It chooses the value of a is 1 because it follows line pattern as it neglects 2 because this command is written after sin command.

3. MATLAB stands for?
a) math library
b) matric library
c) matrix library
d) matrix laboratory

Explanation: MATLAB stands for matrix laboratory which is multi-paradigm numerical computing environment and fourth-generation programming language.

4. Where do we need to store a function to call it in other programs?
a) The bin folder
b) Anywhere
c) The MATLAB folder
d) Desktop

Explanation: M-files containing only a function has to be written separately and has to be stored as .m files in the bin folder. If it stored in any other folder, MATLAB won’t be able to access the function file.

5. Command used to display the value of variable x.
a) displayx
b) disp x
c) disp(x)
d) vardisp(‘x’)

Explanation: disp(X) displays the value of variable X without printing the variable name. Another way to display a variable is to type its name, but this displays a leading “X =”, which is not always ideal. If a variable contains an empty array, disp returns without displaying anything.

6. Which is the invalid variable name in MATLAB?
a) x6
b) last
c) 6x
d) z

Explanation: A valid variable name starts with a letter, followed by letters, digits, or underscores. MATLAB is case sensitive, so A and a are not the same variables, and in 6x digit is followed by a letter which is invalid.

a) //
b) %/
c) /%
d) %

Explanation: The only format for adding and storing comments in MATLAB is to use the % symbol. One can choose to end a comment using %, but it is not needed.

8. MATLAB allows modelling of different control systems using ___________
b) Control System Toolbox
c) Not available in MATLAB as of yet
d) ezplot

Explanation: Simulink is a separate package which is present in MATLAB. It helps to model and analyze a control system which makes MATLAB a very powerful tool for simulating dynamic systems.

9. Which of the following statements shows the result of executing the following line in the editor window?
size = [1 3]’ ;size(size)
a) 1 3
b) error
c) 3 1
d) 3 3