1. To determine whether an input is MATLAB keyword, command is?
b) key word
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;
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
c) The MATLAB folder
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.
b) disp 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?
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.
7. To add comments in MATLAB, use _________
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
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
c) 3 1
d) 3 3
Explanation: Executing the command iskeyword size returns 0, i.e., size is not a MATLAB keyword. Same command should not be used as a variable in MATLAB, so there is a error message.
10. Executing in the command window the following code returns.
a = [1:3]’ ;size(a)
b) 1 3
c) 3 1
Explanation: It forms a 2×1 matrix of 3 and 1 because transpose condition is there, so size(a) returns transposed value.