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.

The file that can be used to execute multiple compile statements is _________________(a) makefile(b) dofile(c) putfile(d) pushfileI have been asked this question by my school principal while I was bunking the class.I want to ask this question from Comment Syntax topic in chapter SQL Syntax of MySQL

Answer»

The correct ANSWER is (a) makefile

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

2.

Which option is used for specifying the executable name while compiling with gcc?(a) -e(b) -o(c) -a(d) -bThis question was addressed to me in an interview for internship.This key question is from Comment Syntax in division SQL Syntax of MySQL

Answer» CORRECT CHOICE is (b) -o

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

The option that is necessary to compile a C program having math functions is _____________(a) -lm(b) -ln(c) -lp(d) -lqThis question was addressed to me in an interview for internship.This intriguing question originated from Comment Syntax in division SQL Syntax of MySQL

Answer»

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

4.

The option that executes all SQL statements in a SQL script irrespective of the number of errors is _____________(a) –force(b) –run(c) –ensure(d) –violentThe question was asked in a job interview.This intriguing question originated from Comment Syntax in portion SQL Syntax of MySQL

Answer»

Correct OPTION is (a) –force

Easy 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.

5.

Input handling can be customized with MySQL.(a) True(b) FalseThe question was posed to me at a job interview.My question is taken from Comment Syntax in portion SQL Syntax of MySQL

Answer» CORRECT ANSWER is (b) False

For explanation: With MYSQL, raw SQL statements can be entered. With MySQL programs input methods can be PROVIDED for the user that is more intuitive and easier to be USED. So input handling is customized.
6.

The statement that exits a labeled flow-control construct is _____________(a) DESCRIBE(b) LEAVE(c) LOOP(d) RETURNThe question was posed to me during an interview for a job.The doubt is from Comment Syntax in portion SQL Syntax of MySQL

Answer»

The correct option is (B) LEAVE

For explanation I would say: The ‘LEAVE’ statement is used to EXIT a labeled flow-control construct. This statement must appear WITHIN the construct that has the GIVEN LABEL. The syntax of the statement is ‘LEAVE label’.

7.

What sets the association between one or more MyISAM tables and the named key cache?(a) BEGIN(b) CACHE INDEX(c) ALTER DATABASE(d) ALTER EVENTThe question was posed to me in homework.This key question is from Comment Syntax topic in division SQL Syntax of MySQL

Answer»

Correct choice is (b) CACHE INDEX

The explanation is: ‘CACHE INDEX’ SETS up an association between one or more MyISAM tables and the named key cache which MUST already exist. The INDEX PRIVILEGE is NEEDED for each table named in the statement.

8.

The MySQL double dashed comment style is the same as the SQL standard.(a) True(b) FalseI got this question during an online exam.This intriguing question originated from Comment Syntax topic in section SQL Syntax of MySQL

Answer»

Right answer is (b) False

The explanation is: The MySQL double-dash (–) comment style is different from the comment style of STANDARD SQL, which begins with just two dashes. It does not require the SPACE before any following TEXT.

9.

Which of these is not a comment specifying construct?(a) #(b) /* */(c) —(d) !#I got this question in an international level competition.The query is from Comment Syntax in section SQL Syntax of MySQL

Answer»

Correct option is (d) !#

Easiest explanation: The MySQL SERVER UNDERSTANDS three types of comments. The single LINE ‘#’ construct, the multiline /*…*/ construct and the — COMMENT construct. MySQL conforms to the comment standards of SQL.

10.

What can be used interchangeably with MYSQL_VERSION_ID?(a) LIBMYSQL_VERSION(b) LIBMYSQL_VERSION_ID(c) MYSQL_VERSION_ID(d) MYSQL_IDI had been asked this question in examination.My question is taken from Compound Statement Syntax topic in chapter SQL Syntax of MySQL

Answer»

Right CHOICE is (B) LIBMYSQL_VERSION_ID

Easy 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.

11.

What can be used in place of MYSQL_SERVER_VERSION?(a) LIBMYSQL_VERSION(b) LIBMYSQL_VERSION_ID(c) MYSQL_VERSION_ID(d) MYSQL_IDThe question was posed to me in my homework.The question is from Compound Statement Syntax in section SQL Syntax of MySQL

Answer»

The CORRECT CHOICE is (a) LIBMYSQL_VERSION

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

12.

When linking to a static MySQL C client library, the client library and the client application can use different compiler options.(a) True(b) FalseThis question was addressed to me during an internship interview.My query is from Compound Statement Syntax in portion SQL Syntax of MySQL

Answer»

Right choice is (b) False

For 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.

13.

What does ‘mysql_query()’ return on failure?(a) 0(b) 1(c) -1(d) a non-zero valueThe question was posed to me in final exam.The doubt is from Compound Statement Syntax in chapter SQL Syntax of MySQL

Answer» CORRECT choice is (d) a non-ZERO value

For explanation: 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.
14.

What is the exec_stmt_ssl written in?(a) C++(b) C(c) Python(d) PerlThis question was addressed to me during an interview for a job.My enquiry is from Compound Statement Syntax in section SQL Syntax of MySQL

Answer»

The correct choice is (b) C

To EXPLAIN I would SAY: In MySQL, the ‘sampdb’ distribution CONTAINS a source FILE named ‘exec_stmt_ssl.c’ from which the client PROGRAM ‘exec_stmt_ssl’ can be built. There is a procedure to build this file.

15.

Which statement exits a labeled flow-control construct?(a) DESCRIBE(b) LEAVE(c) LOOP(d) RETURNThis question was posed to me in an internship interview.Query is from Compound Statement Syntax in chapter SQL Syntax of MySQL

Answer» RIGHT OPTION is (b) LEAVE

To explain: The ‘LEAVE’ statement is used to exit a labeled flow-control CONSTRUCT. This statement must appear within the construct that has the given label. The syntax of the statement is ‘LEAVE label’.
16.

Association between one or more MyISAM tables and the named key cache is set by _____________(a) BEGIN(b) CACHE INDEX(c) ALTER DATABASE(d) ALTER EVENTThe question was asked in exam.I'm obligated to ask this question of Compound Statement Syntax topic in chapter SQL Syntax of MySQL

Answer»

The correct choice is (b) CACHE INDEX

Easy explanation: ‘CACHE INDEX’ sets up an association between one or more MYISAM tables and the named key cache which must already EXIST. The INDEX privilege is NEEDED for each table named in the statement.

17.

Which statement terminates the execution of a function?(a) BEGIN…END(b) RETURN(c) ITERATE(d) LOOPThis question was addressed to me in my homework.My question is taken from Compound Statement Syntax in section SQL Syntax of MySQL

Answer»

The CORRECT answer is (b) RETURN

Easiest explanation: The ‘RETURN’ STATEMENT is used only within stored functions, not stored procedures, triggers, or events. When this statement is executed it TERMINATES execution of the function.

18.

The statement that constructs a branching flow-control construct is _____________(a) BEGIN…END(b) CASE(c) ITERATE(d) LEAVEThe question was posed to me by my college professor while I was bunking the class.I need to ask this question from Compound Statement Syntax in section SQL Syntax of MySQL

Answer» RIGHT choice is (b) CASE

The best I can explain: The ‘CASE’ statement PROVIDES a BRANCHING flow-control construct. When the initial expression, ‘expr’, is PRESENT, CASE compares it to the expression following each ‘WHEN’.
19.

What does mysql_init() return?(a) integer(b) float(c) structure(d) pointer to a structureI got this question in my homework.The above asked question is from SQL Statement Syntax (Non-Compound Statements) topic in chapter SQL Syntax of MySQL

Answer»

Correct choice is (d) POINTER to a structure

To elaborate: When NULL is passed to mysql_init() it AUTOMATICALLY allocates an MYSQL structure, initializes it, and RETURNS a pointer to it. The MYSQL data type is a structure CONTAINING information about a connection.

20.

The header that should be included first is ________________(a) my_global.h(b) my_sys.h(c) mysql.h(d) my_local.hI had been asked this question by my school principal while I was bunking the class.The doubt is from SQL Statement Syntax (Non-Compound Statements) in section SQL Syntax of MySQL

Answer»

Correct choice is (a) my_global.h

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

21.

The clause that is used to display information that matches a given pattern is _____________(a) WHERE(b) IS(c) SAME(d) LIKEI got this question during a job interview.The above asked question is from SQL Statement Syntax (Non-Compound Statements) topic in section SQL Syntax of MySQL

Answer»

Correct choice is (d) LIKE

For explanation I would SAY: The ‘LIKE’ clause FILTERS information that matches a given pattern. ‘WHERE’ clause selects information that is SPECIFIED by a condition. ‘IS’ is used to match the EXACT condition specified.

22.

The option that executes all SQL statements in a SQL script irrespective of the number of errors is _______________(a) –run(b) –ensure(c) –force(d) –violentI have been asked this question during an internship interview.This is a very interesting question from SQL Statement Syntax (Non-Compound Statements) in chapter SQL Syntax of MySQL

Answer»

The correct answer is (c) –force

Easy 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.

23.

Converting a client/server application to embedded server is difficult.(a) True(b) FalseI have been asked this question by my college director while I was bunking the class.My query is from SQL Statement Syntax (Non-Compound Statements) topic in chapter SQL Syntax of MySQL

Answer»

The CORRECT option is (a) True

Best explanation: Writing an application that USES the embedded server is different from writing one that operates in a client/server CONTEXT. A program that is written as a client/server application can easily be CONVERTED to use the embedded server.

24.

Which statement can produce the same output as ‘SHOW COLUMNS’?(a) DESCRIBE(b) DISPLAY(c) SEE(d) GETThis question was posed to me during a job interview.Asked question is from SQL Statement Syntax (Non-Compound Statements) topic in chapter SQL Syntax of MySQL

Answer»

The CORRECT choice is (a) DESCRIBE

Explanation: The ‘DESCRIBE’ statement with a table name or VIEW name produces the same kind of output as the ‘SHOW COLUMNS’ statement. The ‘SHOW’ entry can be referred to for further INFORMATION.

25.

What sets up an association between one or more MyISAM tables and the named key cache?(a) BEGIN(b) CACHE INDEX(c) ALTER DATABASE(d) ALTER EVENTThis question was posed to me in semester exam.My query is from SQL Statement Syntax (Non-Compound Statements) in division SQL Syntax of MySQL

Answer»

Right choice is (b) CACHE INDEX

The BEST I can explain: ‘CACHE INDEX’ sets up an association between one or more MYISAM tables and the named KEY cache which MUST already exist. The INDEX PRIVILEGE is needed for each table named in the statement.

26.

The statement that alters an existing event to have the given definition is _____________(a) ALTER EVENT(b) ALTER DATABASE(c) ALTER FUNCTION(d) ALTER DATABASEThis question was posed to me by my college director while I was bunking the class.Asked question is from SQL Statement Syntax (Non-Compound Statements) in chapter SQL Syntax of MySQL

Answer»

Correct option is (a) ALTER EVENT

For EXPLANATION: The STATEMENT ‘ALTER EVENT’ alters an existing event to have the given definition. The ‘RENAME TO’ clause RENAMES the event. The other clauses are described in the entry for ‘CREATE EVENT’.

27.

Which statement upgrades the database directory name encoding?(a) ALTER DATABASE(b) ALTER SERVER(c) ALTER EVENT(d) ALTER FUNCTIONI have been asked this question during a job interview.My enquiry is from SQL Statement Syntax (Non-Compound Statements) topic in division SQL Syntax of MySQL

Answer»

Correct option is (a) ALTER DATABASE

Easiest explanation: The STATEMENT ‘ALTER DATABASE’ changes database attributes or UPGRADES the database directory name encoding. It REQUIRES the ‘ALTER’ PRIVILEGE for the database to be given.