MATLAB Questions and Answers – System Commands – 2

This set of MATLAB Questions & Answers for Exams focuses on “System Commands – 2”.

1. Which of the following command can be used for DOS commands?
a) msdos
b) dos
c) ds
d) not possible in MATLAB
View Answer

Answer: b
Explanation: The correct command to work on DOS commands is dos in MATLAB. This is because it is pre-defined in the libraries of MATLAB.

2. The input to the unix command should be within _________
a) ()
b) {}
c) []
d) Is not available in MATLAB
View Answer

Answer: a
Explanation: The unix command is defined in MATLAB to run unix based codes. The input to this command should always be within parentheses. Thus only () is allowed.

3. If the command, given as an input to the system command, gets executed, MATLAB returns a _________
a) 0
b) 1
c) True
d) False
View Answer

Answer: a
Explanation: This the default return value of the system command. It will return a 0 if the command gets successfully executed. If not, it’ll return 1 and hence, only MATLAB will only return a 0.
advertisement
advertisement

4. What is the output of the following code?

system(date)

a) It shows the date but MATLAB returns 1
b) It doesn’t show the date and MATLAB returns 0
c) It doesn’t show the date but MATLAB returns 1
d) It shows the date but MATLAB returns 0
View Answer

Answer: a
Explanation: The code din’t work properly since it wasn’t included within ‘’. But the date, updated in the system, does get printed. Due to the aforementioned error, it shows a 1 and the dat.

5. The input to the system command is not necessarily given within ‘’.
a) True
b) False
View Answer

Answer: b
Explanation: The input to the system() command has to be within ‘’. This is because the input has to be a command name and the command name is a string.
advertisement

6. All system commands take input within parentheses.
a) True
b) False
View Answer

Answer: a
Explanation: There isn’t a single system command in MATLAB which takes input within anything but parentheses. Hence, the above statement is true.

7. Windows Registry can be accessed by ___________
a) winqueryreg
b) winreg
c) windowsregistry
d) not possible
View Answer

Answer: a
Explanation: The correct command to gain access to the windows registry is winqueryreg. The rest of the commands don’t exist.
advertisement

8. How can we check the history of commands used?
a) By only clicking the up direction button
b) Using the commandhist command
c) Using the commandhistory command
d) Using the cmdhstry command
View Answer

Answer: c
Explanation: It is not that we can check the history of the commands used, only, by clicking the upward direction button. It can be also checked by using the commandhistory function. Hence, using the commandhistory command is correct.

Sanfoundry Global Education & Learning Series – MATLAB.

To practice all exam questions on MATLAB, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.