MySQL Questions and Answers – Compiling and Linking Client Programs

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Compiling and Linking Client Programs”.

1. Which option is necessary to compile a C program havin math functions?
a) -lm
b) -ln
c) -lp
d) -lq
View Answer

Answer: a
Explanation: To compile a program written in the C language, it is compiled by issuing the option ‘-lm’. The examples of some math functions found in ‘math.h’ are floor(), sqrt(), pow(), log().

2. The option for specifying the executable name while compiling with gcc is _____________
a) -e
b) -o
c) -a
d) -b
View Answer

Answer: b
Explanation: When a C program is compiled with gcc, the option -o is issued in order to specify the name of the executable that is created after compilation. The default name given is ‘a.out’.

3. Which file can be used to execute multiple compile statements?
a) makefile
b) dofile
c) putfile
d) pushfile
View Answer

Answer: a
Explanation: The Makefile is used to write multiple commands in there. The file is executed by prefixing the command ‘make’ with the command to run the file script containing the statements.
advertisement
advertisement

4. Which flag is used to compile client programs that use MySQL header files?
a) -O
b) -I
c) -U
d) -A
View Answer

Answer: b
Explanation: The ‘-I’ option is specified when the client programs are compiled that use the MySQL header files. The compiler can easily find these header files when the ‘-I’ option is used.

5. The MySQL clients are linked with _____________
a) -lmysqlclient
b) -cmysqlclient
c) -dmysqlclient
d) -vmysqlclient
View Answer

Answer: a
Explanation: MySQL clients should be linked using the ‘-lmysqlclient’ option in the link command. A ‘-L’ option also needs to be specified to tell the linker where to find the library for it.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. On Unix, linking uses dynamic libraries by default.
a) True
b) False
View Answer

Answer: a
Explanation: On Unix, the linking process uses the dynamic libraries by default. In order to link to the static client library instead, its path name should be added to the link command to do the job.

7. What can be used as an alternative to mysqlconfig?
a) pkg-config
b) dkg-config
c) rkg-config
d) qkg-config
View Answer

Answer: a
Explanation: The ‘pkg-config’ statement can be used as an alternative to the ‘mysql_config’ statement for obtaining information like compiler flags or to link libraries required to compile some MySQL applications.
advertisement

8. Which of these has a smaller memory footprint?

Perl, PHP

a) Perl
b) PHP
c) Same
d) Machine dependent
View Answer

Answer: b
Explanation: A clearly significant difference between Perl and PHP is that Perl has a bigger memory footprint than PHP. Apache processes are larger with ‘mod_perl’ linked in than with ‘mod_php’.
advertisement

9. The static C library client in Windows is _____________
a) mysqlclient.lib
b) mysqlclient.lb
c) mysqlclient.lm
d) myclient.lib
View Answer

Answer: a
Explanation: The code can be linked with either the dynamic or static C client library. On Windows, the static library is named ‘mysqlclient.lib’ and the dynamic library is named ‘libmysql.dll’.

10. Which of the following is used on Solaris?
a) gcc
b) clang
c) Sun Studio
d) FreeBSD
View Answer

Answer: c
Explanation: The program ‘gcc’ is generally used on Unix. ‘clang’ is used on ‘OSX’ or ‘FreeBSD’. The ‘Sun Studio’ is used on Solaris. However, ‘gcc’ on Unix is a widely popular choice for client programs.

Sanfoundry Global Education & Learning Series – MySQL Database.

To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.

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.