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.

1.

What does mysql_query() return on failure?(a) 0(b) 1(c) -1(d) a non-zeroI got this question in an internship interview.This key question is from User-Defined Variables in division System, Status and User Variables of MySQL

Answer»

Correct option is (d) a non-zero

To ELABORATE: Both of the functions named ‘mysql_query()’ and ‘mysql_real_query()’ return zero for statements that SUCCEED. They return non zero for failure. A STATEMENT is successfully executed if the SERVER accepts it.

2.

The option that enables multiple-statement execution is ____________(a) CLIENT_MULTI_STATEMENTS(b) CLIENT_STATEMENTS_MULTI(c) MULTI_STATEMENTS_CLIENT(d) MULTI_CLIENTS_STATEMENTSThe question was posed to me in a national level competition.I want to ask this question from User-Defined Variables in division System, Status and User Variables of MySQL

Answer»

The correct choice is (a) CLIENT_MULTI_STATEMENTS

For explanation I would say: There are two WAYS to enable the multiple-statement execution. The FIRST is to add the ‘CLIENT_MULTI_STATEMENTS’ OPTION in the FLAGS argument to ‘mysql_real_connect()’ at connect TIME.

3.

Multiple statement execution is disabled by default.(a) True(b) FalseI got this question during an internship interview.My question is taken from User-Defined Variables topic in chapter System, Status and User Variables of MySQL

Answer»

The correct CHOICE is (a) True

Easy explanation: The ‘multiple-statement’ EXECUTION is not enabled by DEFAULT, so the server must be told that it is INTENDED to be used. There are two WAYS to tell the server to enable the execution.

4.

What is the type of Audit_log_events system variable?(a) string(b) integer(c) float(d) doubleThe question was asked during an online interview.Question is taken from User-Defined Variables topic in chapter System, Status and User Variables of MySQL

Answer» RIGHT option is (B) INTEGER

To explain: The SYSTEM variable ‘Audit_log_events’ is of type integer. The variable scope if GLOBAL, that is, it can be viewed by issuing the statement ‘SHOW GLOBAL STATUS’, instead of ‘SESSION’.
5.

Hexadecimal values assigned to user variables are treated as _____________(a) strings(b) non binary strings(c) binary strings(d) integersThis question was posed to me in class test.I would like to ask this question from User-Defined Variables topic in section System, Status and User Variables of MySQL

Answer» CORRECT choice is (c) binary strings

Best explanation: The hexadcimal or bit VALUES ASSIGNED to user variables are treated as binary strings. In ORDER to assign a hexadecimal or bit value as a number to a user variable, it is used in a NUMERIC context.
6.

User defined variables are session specific.(a) True(b) FalseI got this question during a job interview.Question is from User-Defined Variables in portion System, Status and User Variables of MySQL

Answer»

Right choice is (a) True

For explanation I would say: The user defined variables are session specific. A user variable defined by ONE client cannot be seen or used by other CLIENTS. A user with access to the PERFORMANCE Schema user_variables_by_thread table can see all user variables for all SESSIONS is an exception.

7.

The columns containing a binary value that include null bytes will print properly using the %s printf() format specifier.(a) True(b) FalseI have been asked this question during an interview.My question is taken from Status Variables topic in section System, Status and User Variables of MySQL

Answer»

Correct option is (b) False

For explanation: The columns containing binary value including null BYTES do not print properly using the %s printf() FORMAT SPECIFIER. printf() EXPECTS a null terminated string. It prints the column value only up to the first null byte.

8.

What does mysql_fetch_row() return?(a) integer(b) float(c) structure(d) pointerThe question was posed to me during an interview for a job.The doubt is from Status Variables topic in division System, Status and User Variables of MySQL

Answer» RIGHT answer is (d) pointer

Explanation: ‘mysql_fetch_row()’ returns a MYSQL_ROW value, a pointer to an ARRAY of VALUES. If the return value is assigned to a variable named row each value WITHIN the row is accessed as row[i].
9.

The option that executes all SQL statements in a SQL script irrespective of the number of errors is ____________(a) –ensure(b) –force(c) –violent(d) –runThis question was posed to me during an interview.My enquiry is from Status Variables topic in section System, Status and User Variables of MySQL

Answer»

The correct choice is (b) –force

Best explanation: If SQL queries in a file are run using mysql in batch mode, mysql either QUITS after the FIRST error. If the –force OPTION is specified all the queries are EXECUTED indiscriminately.

10.

mysql_next_result() does not return a status.(a) True(b) FalseThe question was asked in an online interview.I want to ask this question from Status Variables in chapter System, Status and User Variables of MySQL

Answer»

Right ANSWER is (b) False

Easiest EXPLANATION: The FUNCTION ‘mysql_next_result()’ returns a status and initiates retrieval of the next SET if more results are available. The status is zero if more results are available and -1 if not.

11.

The Audit_log_events system variable is of type _____________(a) string(b) integer(c) float(d) doubleThis question was posed to me in my homework.This interesting question is from Status Variables in section System, Status and User Variables of MySQL

Answer»

Right option is (B) integer

To elaborate: The system variable ‘Audit_log_events’ is of type integer. The variable SCOPE if GLOBAL, that is, it can be viewed by issuing the STATEMENT ‘SHOW GLOBAL STATUS’, INSTEAD of ‘SESSION’.

12.

What is the synonym for last_insert_id session variable?(a) insert_id(b) identity(c) sql_auto_is_null(d) sql_big_selectsThis question was addressed to me in unit test.The origin of the question is Status Variables in chapter System, Status and User Variables of MySQL

Answer»

The CORRECT option is (b) identity

The explanation: The SESSION only system VARIABLE ‘identity’ is a synonym for the ‘last_insert_id’ session variable. Setting ‘last_insert_id’ specifies the VALUE to be returned by the function ‘LAST_INSERT_ID()’.

13.

Which keyword inserted in the SHOW STATUS statement shows the values for the current connection?(a) GLOBAL(b) SESSION(c) LOCAL(d) DEFAULTI got this question by my school principal while I was bunking the class.This intriguing question originated from Status Variables in section System, Status and User Variables of MySQL

Answer»

The CORRECT option is (b) SESSION

Explanation: The OPTIONAL ‘GLOBAL’ keyword in the statement SHOW [GLOBAL | SESSION] STATUS statement aggregates the values over all connections and ‘SESSION’ SHOWS the values for the current connection.

14.

The statement that views status variables by aggregating the values over all connections is _____________(a) SHOW SESSION STATUS(b) SHOW LOCAL STATUS(c) SHOW GLOBAL STATUS(d) SHOW STATUSI have been asked this question in class test.Query is from Status Variables in chapter System, Status and User Variables of MySQL

Answer»

The correct CHOICE is (c) SHOW GLOBAL STATUS

For explanation: The MYSQL server MAINTAINS various status variables that provide INFORMATION about its operations. These variables and their values can be viewed by using the SHOW [GLOBAL | SESSION] STATUS statement.

15.

What returns a string containing an error message?(a) mysql_error()(b) mysql_errno()(c) mysql_sqlstate()(d) mysql_close()This question was posed to me in an online quiz.This intriguing question originated from Session-Only System Variables topic in portion System, Status and User Variables of MySQL

Answer»

Right choice is (a) mysql_error()

For explanation: The API call NAMED ‘mysql_error()’ RETURNS a string containing an error message. ‘mysql_close()’ does not RETURN any value at all. ‘mysql_errno()’ returns a MySQL-specific NUMERIC code.

16.

When building from source, the embedded server library is enabled by what?(a) –with-embedded-server(b) –with-server-embedded(c) –with-embedded-library(d) –with-library-embeddedThis question was addressed to me during an internship interview.This intriguing question originated from Session-Only System Variables in division System, Status and User Variables of MySQL

Answer»

Right ANSWER is (a) –with-embedded-SERVER

Easy explanation: While building from the source, the embedded server library is enabled by USING the option ‘–with-embedded-server’ while running ‘configure’. This applies equally to MySQL 5.0 and 5.1.

17.

The synonym for last_insert_id session variable is _____________(a) insert_id(b) identity(c) sql_auto_is_null(d) sql_big_selectsI got this question during an online interview.Enquiry is from Session-Only System Variables in portion System, Status and User Variables of MySQL

Answer»

Correct CHOICE is (B) identity

To explain I would say: The session only system variable ‘identity’ is a synonym for the ‘last_insert_id’ session variable. Setting ‘last_insert_id’ specifies the VALUE to be returned by the FUNCTION ‘LAST_INSERT_ID()’.

18.

Which variable when set to 1 would enable foreign key checking for InnoDB tables?(a) error_count(b) identity(c) foreign_key_checks(d) autocommitThis question was addressed to me in an online quiz.My question is based upon Session-Only System Variables topic in portion System, Status and User Variables of MySQL

Answer» CORRECT choice is (c) foreign_key_checks

Best explanation: SETTING the variable ‘foreign_key_checks’ to 0 or 1 DISABLES or enables the foreign key checking for InnoDB tables. The default is to perform checking. DISABLING key checks can also be helpful.
19.

Which of these is a read only variable?(a) error_count(b) big_tables(c) autocommit(d) foreign_key_checksThe question was asked in an online interview.Enquiry is from Session-Only System Variables topic in chapter System, Status and User Variables of MySQL

Answer»

The correct choice is (a) error_count

The EXPLANATION: The SESSION only system variable ‘error_count’ is a read only variable that indicates the number of errors generated by the last statement that can generate errors. The others are writable.

20.

What is the shebang line?(a) #!(b) !#(c) #$(d) $#This question was posed to me in exam.This interesting question is from System Variables in division System, Status and User Variables of MySQL

Answer» CORRECT OPTION is (a) #!

The best explanation: The Perl scripts are text files, which can be ceated USING any text editor. All Perl scripts generally begin with a #! (shebang) line. A script is a file containing a SEQUENCE of commands.
21.

The line that is written at the top of the script to write a Perl script using CGI.pm is ___________(a) use this CGI(b) put CGI(c) use CGI(d) include CGIThis question was addressed to me by my college professor while I was bunking the class.My doubt stems from System Variables in division System, Status and User Variables of MySQL

Answer» CORRECT choice is (c) use CGI

The explanation: In order to WRITE a Perl script that uses the ‘CGI.pm’ MODULE, a ‘use CGI’ statement is included NEAR the BEGINNING of the script that imports the function names of the module.
22.

What does CGI stand for?(a) Computer Gateway Interface(b) Common Gateway Interface(c) Computer Generated Interface(d) Common Generated InterfaceI had been asked this question in my homework.This is a very interesting question from System Variables topic in chapter System, Status and User Variables of MySQL

Answer»

Correct CHOICE is (b) Common Gateway Interface

The explanation is: The ‘CGI.pm’ module is so called because it HELPS WRITE scripts that use the ‘Common Gateway Interface’ protocol which defines how a web server communicates with other PROGRAMS.

23.

Which module links DBI to the web?(a) CGI.pn(b) CGI.pem(c) CGI.pm(d) CGI.poThis question was addressed to me in a job interview.My question is from System Variables topic in portion System, Status and User Variables of MySQL

Answer»

Right choice is (C) CGI.pm

Best explanation: The CGI.pm module is used to write SCRIPTS that use the ‘Common GATEWAY Interface’ protocol. It defines how a WEB server communicates with other programs. It provides an easy link.

24.

Which string function returns the index of the first occurrence of substring?(a) INSERT()(b) INSTR()(c) INSTRING()(d) INFSTR()This question was addressed to me by my school principal while I was bunking the class.My doubt stems from System Variables in section System, Status and User Variables of MySQL

Answer»

Right choice is (b) INSTR()

The best I can explain: The string funtion ‘INSTR()’ is used to return the index of the FIRST occurrence of the substring. The FUNCTION ‘INSERT()’ is used to insert a substring at the SPECIFIED POSITION up to the specified number of characters.

25.

‘character_set_database’ represents the character set used by the default database.(a) True(b) FalseI got this question by my college director while I was bunking the class.The doubt is from System Variables in portion System, Status and User Variables of MySQL

Answer»

The correct answer is (a) True

For explanation I would say: ‘character_set_database’ is the character SET used by the DEFAULT database. The server sets the VARIABLE WHENEVER the default database changes. If there is no default database the variable has the same value as ‘character_set_server’.

26.

The permitted value type for the variable ‘character_set_client’ is _____________(a) integer(b) float(c) double(d) stringI got this question during an online interview.My enquiry is from System Variables topic in division System, Status and User Variables of MySQL

Answer»

The correct option is (d) string

Best explanation: ‘character_set_client’ is the character SET for STATEMENTS that arrive from the client. The session value of this VARIABLE is set using the character set requested by the client when client CONNECTS to server.

27.

Which system variable when set to 1, makes all temporary tables to get stored on disk rather than in memory?(a) basedir(b) back_log(c) big_tables(d) bind_addressThis question was posed to me in an interview for internship.Question is taken from System Variables in portion System, Status and User Variables of MySQL

Answer»

Correct answer is (C) big_tables

Easy explanation: The variable ‘big_tables’ if SET to 1, all temporary tables are stored on disk rather than in memory. This is a little slower but the error ‘The table tbl_name is full’ does not occur for SELECT OPERATIONS that require a large temporary table.