Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

51.

Which option is supplied to ensure TCP/IP connection to local server?(a) –localhost(b) –host(c) –hostlocal(d) –connectlocalThe question was posed to me in an international level competition.This question is from Connecting to the Server topic in division MySQL Programs Using C of MySQL

Answer»

Correct option is (b) –host

To EXPLAIN I would say: In order to ENSURE that the client MAKES a TCP/IP connection to the local SERVER, the ‘–host’ or ‘-H’ option is used to specify a host name value of 127.0.0.1 or the IP address of the local server.

52.

Which of the following can be used interchangeably with MYSQL_VERSION_ID?(a) LIBMYSQL_VERSION(b) LIBMYSQL_VERSION_ID(c) MYSQL_VERSION_ID(d) MYSQL_IDThe question was asked in exam.Query is from Connecting to the Server topic in portion MySQL Programs Using C of MySQL

Answer» CORRECT choice is (b) LIBMYSQL_VERSION_ID

The best explanation: The ‘LIBMYSQL_VERSION’ and ‘LIBMYSQL_VERSION_ID’ macros have the same values as ‘MYSQL_SERVER_VERSION’ and ‘MYSQL_VERSION_ID’ and the two SETS of macros can be USED INTERCHANGEABLY.
53.

Which of these can be used in place of MYSQL_SERVER_VERSION?(a) LIBMYSQL_VERSION(b) LIBMYSQL_VERSION_ID(c) MYSQL_VERSION_ID(d) MYSQL_IDI have been asked this question during a job interview.This intriguing question comes from Connecting to the Server topic in chapter MySQL Programs Using C of MySQL

Answer»

The CORRECT ANSWER is (a) LIBMYSQL_VERSION

Easiest EXPLANATION: The macros ‘LIBMYSQL_VERSION’ and ‘LIBMYSQL_VERSION_ID’ have the same values as ‘MYSQL_SERVER_VERSION’ and ‘MYSQL_VERSION_ID’ and the two sets of macros can be used in PLACE of each other.

54.

When linking to a static MySQL C client library, the client library and the client application must use the same compiler option.(a) True(b) FalseI got this question by my school teacher while I was bunking the class.Enquiry is from Connecting to the Server in division MySQL Programs Using C of MySQL

Answer»

Right answer is (a) True

The best explanation: Generally, when LINKING to a static MySQL C client LIBRARY, the client library and the client application must use the same compiler option when it is REQUIRED to link the C RUNTIME.

55.

mysql_init() returns a _____________(a) integer(b) float(c) structure(d) pointer to a structureThe question was asked in exam.The doubt is from Connecting to the Server topic in portion MySQL Programs Using C of MySQL

Answer»

The correct choice is (d) pointer to a structure

Explanation: When NULL is PASSED to mysql_init() it automatically allocates a MYSQL structure, initializes it, and RETURNS a pointer to it. The MYSQL DATA type is a structure containing INFORMATION about a connection.

56.

Which header should be included first?(a) my_global.h(b) my_sys.h(c) mysql.h(d) my_local.hI have been asked this question in exam.The query is from Connecting to the Server in section MySQL Programs Using C of MySQL

Answer»

Right choice is (a) my_global.h

For explanation: The file ‘my_global.h’ takes care of INCLUDING several other header files that are likely to be GENERALLY useful, like ‘stdio.h’. It also INCLUDES Windows COMPATIBILITY INFORMATION.

57.

Which library file contains various portability macros and definitions?(a) my_global.h(b) my_sys.h(c) mysql.h(d) my_local.hI had been asked this question in an international level competition.Asked question is from Connecting to the Server in portion MySQL Programs Using C of MySQL

Answer»

The correct OPTION is (b) my_sys.h

Explanation: The ‘my_sys.h’ header FILE CONTAINS a variety of portability MACROS and definitions required for STRUCTURES and functions. These structures and functions are used by the client library.

58.

Which of the following is used on Solaris?(a) gcc(b) clang(c) Sun Studio(d) FreeBSDThe question was posed to me in exam.Asked question is from Compiling and Linking Client Programs in division MySQL Programs Using C of MySQL

Answer»

The correct CHOICE is (c) Sun STUDIO

The BEST I can explain: 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.

59.

The static C library client in Windows is _____________(a) mysqlclient.lib(b) mysqlclient.lb(c) mysqlclient.lm(d) myclient.libThis question was posed to me in an online interview.The above asked question is from Compiling and Linking Client Programs topic in section MySQL Programs Using C of MySQL

Answer»

Right option is (a) mysqlclient.lib

The 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’.

60.

What can be used as an alternative to mysqlconfig?(a) pkg-config(b) dkg-config(c) rkg-config(d) qkg-configI have been asked this question in exam.Query is from Compiling and Linking Client Programs in chapter MySQL Programs Using C of MySQL

Answer»

The correct CHOICE is (a) pkg-config

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.

61.

On Unix, linking uses dynamic libraries by default.(a) True(b) FalseI have been asked this question during an online interview.Enquiry is from Compiling and Linking Client Programs in chapter MySQL Programs Using C of MySQL

Answer»

Correct choice is (a) True

The best I can explain: 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.

62.

The MySQL clients are linked with _____________(a) -lmysqlclient(b) -cmysqlclient(c) -dmysqlclient(d) -vmysqlclientI have been asked this question in homework.I want to ask this question from Compiling and Linking Client Programs in portion MySQL Programs Using C of MySQL

Answer»

Correct answer is (a) -lmysqlclient

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.

63.

Which flag is used to compile client programs that use MySQL header files?(a) -O(b) -I(c) -U(d) -AThis question was posed to me in an online interview.The doubt is from Compiling and Linking Client Programs in portion MySQL Programs Using C of MySQL

Answer» CORRECT answer is (b) -I

To explain I would say: 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.
64.

Which file can be used to execute multiple compile statements?(a) makefile(b) dofile(c) putfile(d) pushfileThe question was asked in a national level competition.I would like to ask this question from Compiling and Linking Client Programs in chapter MySQL Programs Using C of MySQL

Answer» CORRECT choice is (a) makefile

The BEST 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.
65.

The option for specifying the executable name while compiling with gcc is _____________(a) -e(b) -o(c) -a(d) -bThe question was asked by my school principal while I was bunking the class.My question is from Compiling and Linking Client Programs in chapter MySQL Programs Using C of MySQL

Answer»

Right choice is (B) -o

The explanation is: 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’.

66.

Which option is necessary to compile a C program havin math functions?(a) -lm(b) -ln(c) -lp(d) -lqThis question was posed to me in a job interview.Enquiry is from Compiling and Linking Client Programs topic in portion MySQL Programs Using C of MySQL

Answer»

Right option is (a) -lm

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().