MATLAB Questions and Answers – Calling External Functions

This set of MATLAB Multiple Choice Questions & Answers (MCQs) focuses on “Calling External Functions”.

1. What is the function of the mexext command?
a) Reveals the version of the MEX file
b) Reveals the package in which the MEX file is stored
c) Returns the extension of the MEX file for the system
d) Error
View Answer

Answer: c
Explanation: The MEX file, generated in MATLAB will have an extension which depends on system configurations. Hence, the above code returns the extension of the MEX file when generated from the current system.

2. What is the output of the following code?

Mexext(all)

a) Error
b) Returns a structure of arrays of MEX extensions
c) Returns an array of structures of MEX extensions
d) Returns the system version of MEX file
View Answer

Answer: a
Explanation: The mexext file is misspelled with the ‘M’, it should’ve been small. The MEX extensions would’ve been shown if the command was written properly.
advertisement
advertisement

3. What is the output of the following code snippet?

Note: Join free Sanfoundry classes at Telegram or Youtube
computer

a) Shows the system version
b) Shows the MATLAB version
c) Shows the previous MATLAB versions in the current system
d) Error
View Answer

Answer: a
Explanation: It shows the version of the system where MATLAB is installed currently.
advertisement

4. What is the output of the following code?

loadlibrary()

a) Load a C library
b) Load a C function
c) Load a C header file
d) Load a C file
View Answer

Answer: a
Explanation: The above command typically loads a C library with all the header files and the functions so that they can be used in the MATLAB code.
advertisement

5. The callib command implements the function from a _________
a) library loaded by the loadlibrary() command
b) .h file loaded by the loadlibrary() command
c) c-file loaded by the loadlibrary() command
d) function loaded by the loadlibrary() command
View Answer

Answer: a
Explanation: The callib command is defined in MATLAB to use a function which is in a pre-loaded C library. The function can be called by giving the function name and the arguments as an input to the callib command.

6. What is the working of the following command?

libfunctions()

a) Returns the pre-loaded libraries
b) Returns the libraries in a pre-loaded library
c) Returns the header-files in a pre-loaded C library
d) Returns the functions in a pre-loaded library
View Answer

Answer: d
Explanation: The above command returns the functions, in a library- the library name is given as an input to the command. The library is to be pre-loaded with the loadlibrary() command.

7. What is the working of the following command?

libfunctions(libname,'-full')

a) Returns the functions of a shared library
b) Returns the functions of a shared library and it’s signatures
c) Returns the signatures of the functions of a shared library
d) Error
View Answer

Answer: b
Explanation: The above command returns both the set of functions present in the shared C library and the signature of each function in the pre-loaded library.

8. What is the working of the following command?

libfunctionsview

a) Displays the signatures of the function in an image window
b) Displays the signature of the functions in a graphical window
c) Displays the signature of the functions in the workspace window
d) Displays the signature of the function in a separate window
View Answer

Answer: d
Explanation: The above command returns the signatures of the functions present in a library. The library name is given as an input to the command.

9. The libfunctionsview command shows the signature of the functions present in the ___________
a) pre-loaded library
b) any library
c) Java library
d) Not present
View Answer

Answer: a
Explanation: The libfunctionsview command works only on a library that has been pre-loaded into MATLAB with the loadlbrary() command.

10. What is the working of the following command?

libisloaded()

a) Checks the version of the loaded library
b) Checks whether a library is working in the system
c) Checks whether a library is loaded in the system
d) Checks whether a library is present in the system
View Answer

Answer: c
Explanation: The above command returns a 1 if it finds that the library, given as an input to the command, is pre-loaded in the system.

11. Which of the following command unloads a library from the system?
a) unldlibrary()
b) unloadlibrary()
c) unloadlibrary{}
d) unldlibrary[]
View Answer

Answer: b
Explanation: The correct command to unload a library is unloadlibrary(). It is syntactically correct and no misspelling.

12. The isjava command returns?
a) 1 if the input is a java file
b) 1 if the input is not a java object
c) 1 if the input is a java object
d) 0 if the input is a java object
View Answer

Answer: c
Explanation: The isjava command will return a 1 if the input to the command is a java object. It would return a 0 otherwise.

13. The input to the isjava command is given within _________
a) ()
b) []
c) {}
d) Doesn’t exist
View Answer

Answer: a
Explanation: The input to the isjava command should be given within parentheses. It would return an error otherwise.

14. The isobject(A) returns a 1 if the _________
a) A is a MATLAB class
b) A is a JAVA class
c) A is a C file
d) A is not a MATLAB class
View Answer

Answer: a
Explanation: The above command checks if the input given to it belongs to the MATLAB class. If it’s so, it’ll return a 1- else it’ll return a 0.

15. Python files cannot be used in MATLAB.
a) True
b) False
View Answer

Answer: b
Explanation: Python files can be used in MATLAB. Python commands cannot run in MATLAB without Python in the system.

16. Python commands can be run in MATLAB without Python in the system.
a) True
b) False
View Answer

Answer: b
Explanation: A version of C python is required to be present in the system for python commands to run. Hence, the above statement is false.

Sanfoundry Global Education & Learning Series – MATLAB.

To practice all areas of 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.