Examveda

How many among the following use NULL to indicate failure?
mysql_init(), mysql_real_connect()

A. 0

B. 1

C. 2

D. 3

Answer: Option C

Solution (By Examveda Team)

This question is asking about how functions in MySQL handle errors. In particular, it wants to know if they use NULL to signal that something went wrong.

Let's look at the two functions:

* mysql_init(): This function initializes a MySQL connection. It doesn't directly interact with the database. If it fails, it will usually return NULL, indicating an error.
* mysql_real_connect(): This function attempts to establish a connection to a MySQL server. If it fails to connect, it will also return NULL.

Therefore, the correct answer is Option C: 2. Both mysql_init() and mysql_real_connect() use NULL to indicate a failure.

This Question Belongs to MySQL >> MySQL Miscellaneous

Join The Discussion

Related Questions on MySQL Miscellaneous