250+ TOP MCQs on Connecting to the Server and Answers

MySQL Database Multiple Choice Questions on “Connecting to the Server”.

1. Which library file contains various portability macros and definitions?
a) my_global.h
b) my_sys.h
c) mysql.h
d) my_local.h

Answer: b
Clarification: 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.

2. Which header should be included first?
a) my_global.h
b) my_sys.h
c) mysql.h
d) my_local.h

Answer: a
Clarification: 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.

3. mysql_init() returns a _____________
a) integer
b) float
c) structure
d) pointer to a structure

Answer: d
Clarification: 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.

4. 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) False

Answer: a
Clarification: 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.

5. 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_ID

Answer: a
Clarification: 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.

6. 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_ID

  250+ TOP MCQs on Processing SQL Statements and Answers

Answer: b
Clarification: 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.

7. Which option is supplied to ensure TCP/IP connection to local server?
a) –localhost
b) –host
c) –hostlocal
d) –connectlocal

Answer: b
Clarification: 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.

8. Connections to remote servers always use TCP/IP.
a) True
b) False

Answer: a
Clarification: The connections to remote servers always use TCP/IP. To connect to the server running on remote.example.com using the default port number (3306) this command is used: mysql –host=remote.example.com.

9. The –protocol value ‘TCP’ runs on which operating systems?
a) all
b) unix only
c) windows only
d) none

Answer: a
Clarification: The connection protocol used by the option ‘–protocol = TCP’ indicates TCP/IP connection to the local or the remote server. Each –protocol value has the set of permissible OS.

10. The ‘SOCKET’ protocol is permitted on which operating systems?
a) all
b) unix only
c) windows only
d) none

Answer: b
Clarification: The connection protocol used by the option ‘–protocol = SOCKET’ indicates the unix socket file connection to the local server. Each –protocol value has the set of permissible OS.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top