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.

301.

SELECT on a MERGE table is like _____________(a) UNION ALL(b) UNION(c) UNION DISTINCT(d) JOIN

Answer» The correct answer is (a) UNION ALL

Easiest explanation: Performing a ‘SELECT’ operation on a ‘MERGE’ table is like performing ‘UNION ALL’. This means that duplicate row results are not removed. ‘SELECT DISTINCT’ is like ‘UNION’ or ‘UNION DISTINCT’.
302.

The statement to change the table name is __________(a) CHANGE(b) CHANGENAME(c) CHANGENM(d) RENAME

Answer» The correct choice is (d) RENAME

Easy explanation: To change the name of a table, the keyword ‘RENAME’ can be used. It can be used with the ‘ALTER TABLE’ clause. It can also be used as a statement in itself like ‘RENAME TABLE old_tbl new_tbl’.
303.

What is the name of the format file for a table named my_tbl?(a) my_tbl.fmt(b) my_tbl.frm(c) my_tbl.fmr(d) my_tbl.ftm

Answer» Correct answer is (b) my_tbl.frm

To elaborate: Every time a table is created in MySQL, it creates a disk file containing the format of the table. It has two components, namely, base name (here, ‘my_tbl’) and an extension (here, ‘frm’).
304.

Which keyword is used to create a table as a temporary copy of itself?(a) TEMP(b) TEMPO(c) TEMPR(d) TEMPORARY

Answer» Correct option is (d) TEMPORARY

To explain: The ‘CREATE TABLE’ clause has a very vast formal format, although its usage is extremely simple and intuitive. One of the many ways is to create a table as a temporary copy of itself.
305.

Which of these is also known as a virtual table?(a) SCHEMA(b) DATABASE(c) JOIN(d) VIEW

Answer» Correct answer is (d) VIEW

The explanation: In MySQL, a ‘View’ is also called a virtual table. It does not contain any data but only appears as a table. It is an alternative way to show or describe a table similar to the original table.
306.

Which case does InnoDB store database names in?(a) lower(b) upper(c) mixed(d) random

Answer» Right answer is (a) lower

The best I can explain: In InnoDB, all the database names as well as all the table names are stored in lowercase internally. There is no random case assignment to the database elements when the engine is set as InnoDB.
307.

The variable used to set table alias names as non case sensitive is ______________(a) lower_case_table_names(b) lower_case_all(c) lower_case_alias(d) lower_case_aliases

Answer» The correct choice is (a) lower_case_table_names

Easy explanation: In MySQL, by default the alias names are case sensitive. An alias can hence be specified in any letter case, upper, lower or mixed. If the variable ‘lower_case_table_names’ is non zero, the alias names of tables are not case sensitive.
308.

Which variable is used to set table alias names as non-case sensitive?(a) lower_case_table_names(b) lower_case_all(c) lower_case_alias(d) lower_case_aliases

Answer» The correct option is (a) lower_case_table_names

The best I can explain: In MySQL, by default the alias names are case sensitive. An alias can hence be specified in any letter case, upper, lower or mixed. If the variable ‘lower_case_table_names’ is non zero, the alias names of tables are not case sensitive.
309.

If $a represents an array with numeric indices in PHP, the first element accessed by ______________(a) $a[1](b) $a[0](c) $a.1(d) $a.0

Answer» The correct option is (b) $a[0]

The best I can explain: If $a represents an array with numeric indices, its elements are accessed as $x[0], $x[1], and so on. In general terms, each element at the position i is accessed and used as $a[i – 1].
310.

What is the synonym for REAL?(a) FLOAT(b) INT(c) DOUBLE(d) BIT

Answer» Correct answer is (c) DOUBLE

Easy explanation: The REAL datatype, by default, is for the DOUBLE type. Floating point types can be defined as UNSIGNED. This eliminates the negative end of the type ranges. MySQL has a variety of default types.
311.

Which statement terminates the execution of a function?(a) BEGIN…END(b) RETURN(c) ITERATE(d) LOOP

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

The default index type for MEMORY tables is __________(a) HASH(b) SPATIAL(c) FULLTEXT(d) UNIQUE

Answer» The correct option is (a) HASH

The best explanation: The ‘HASH’ index is the default index type for ‘MEMORY’ tables. ‘SPATIAL’ can only be used with ‘MyISAM’ tables for the spatial data types. ‘FULLTEXT’ is used for performing full-text searches.
313.

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_address

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

A view can refer to multiple tables via __________(a) UNION(b) JOIN(c) GROUP(d) SELECT

Answer» Right option is (b) JOIN

Best explanation: In MySQL, a ‘View’ can refer to multiple tables. This makes it a lot simpler to execute the queries involving joins. When a selection is made from the view, the join is executed producing the results.
315.

If a column contains 7 values and 6 distinct values, the cardinality is __________(a) 7(b) 6(c) 13(d) 1

Answer» Right choice is (b) 6

Best explanation: In MySQL, the cardinality of a column is the number of distinct values that it contains. A column that contains the values 1, 2, 3, 4, 4, 5, 6 has a cardinality of six and not seven.
316.

MySQL uses security based on ACL. What does it stand for?(a) Access Control Language(b) Access Control Lists(c) Automatic Control Lists(d) Automatic Control Language

Answer» Correct option is (b) Access Control Lists

The explanation: MySQL uses security based on Access Control Lists (ACLs) for all connections, queries and other operations that users can attempt to perform. There is support for SSL encrypted connections.
317.

In PHP, if $a represents an array with numeric indices, how is the first element accessed?(a) $a[1](b) $a[0](c) $a.1(d) $a.0

Answer» Correct answer is (b) $a[0]

Best explanation: If $a represents an array with numeric indices, its elements are accessed as $x[0], $x[1], and so on. In general terms, each element at the position i is accessed and used as $a[i – 1].
318.

What is the output from PHP?(a) statically generated(b) dynamically generated(c) not generated(d) no output

Answer» Correct option is (b) dynamically generated

To explain: The interpreter switches between code mode back and text mode when it sees another special tag that signals the end of the code. This enables the mix of static text with dynamically generated results.
319.

For a table having 4 columns, the number of columns to which hash function is applied when using hash indexes is __________(a) 1(b) 2(c) 3(d) 4

Answer» Right answer is (d) 4

To elaborate: In MySQL, for the hash indexes, a hash function is applied to each of the column values. The resulting hash values are stored in the index and used to perform lookups on it.
320.

The maximum number of indexes on MyISAM table is __________(a) 0(b) 1(c) 2(d) more than 1

Answer» Correct choice is (d) more than 1

To elaborate: In MySQL, for a MyISAM table, there can be more than one indexes. The data rows of the MyISAM table are stored in a data file and the index values are stored in a separate index file.
321.

PHP variables are preceded by __________(a) _(b) @(c) $(d) &

Answer» Correct choice is (c) $

Explanation: All the PHP scripts that use variables have variable names preceded by the dollar sign (‘$’). The variables are signified by this identifier, irrespective of the value it stores.
322.

In PHP, which operator is used to access property of an object?(a) .(b) *(c) ->(d) @

Answer» Right answer is (c) ->

For explanation I would say: If $a represents an object, the properties it has can be accessed as $a->property-name. For instance, $a->white, $a->black, $a->blue, $a->red can be the properties of $a and accessed in this way.
323.

MySQL uses security based on ACL which stands for ______________(a) Access Control Language(b) Access Control Lists(c) Automatic Control Lists(d) Automatic Control Language

Answer» The correct choice is (b) Access Control Lists

Easiest explanation: MySQL uses security based on Access Control Lists (ACLs) for all connections, queries and other operations that users can attempt to perform. There is support for SSL encrypted connections.
324.

In PHP, how is the first element accessed if $a represents an array with numeric indices?(a) $a[1](b) $a[0](c) $a.1(d) $a.0

Answer» Correct option is (b) $a[0]

Easy explanation: If $a represents an array with numeric indices, its elements are accessed as $x[0], $x[1], and so on. In general terms, each element at the position i is accessed and used as $a[i – 1].
325.

Which of these exports table definitions and contents?(a) mysqldump(b) mysqladmin(c) mysqlimport(d) mysqlexport

Answer» Right choice is (a) mysqldump

Best explanation: In MySQL, some distributions include a set of some client programs. ‘mysqldump’ exports the table definitions and the contents. ‘mysqladmin’ performs adminisitrative tasks.
326.

Which command is used to display all the existing tables in a database?(a) SHOW TABLES(b) SHOW TABLE(c) SHOW(d) None of the mentioned

Answer» The correct option is (a) SHOW TABLES

Easy explanation: None.
327.

Which command is used to remove existing tables or database?(a) DROP TABLE(b) DELETE(c) Either DROP TABLE or DELETE(d) None of the mentioned

Answer» Right answer is (a) DROP TABLE

Easiest explanation: None.
328.

What is the variable that is a handle to a database object?(a) $dbh(b) $sth(c) $fh(d) $h

Answer» The correct option is (a) $dbh

To explain: The variable named ‘$dbh’ is a handle to an open file. ‘$h’ is a generic handle and the meaning depends on context. ‘$dbh’ is a handle to a database object. ‘$sth’ is a handle to a query object.
329.

Which among the following is the correct syntax for showing all tables in the database?(a) SHOWS TABLES(b) SHOW TABLE(c) SHOW(d) SHOWS TABLES;

Answer» Right choice is (d) SHOWS TABLES;

Explanation: None.
330.

Which language is the core for APIs and communication in MySQL?(a) C(b) C++(c) Python(d) Ruby

Answer» Correct choice is (a) C

To elaborate: In order to provide application development, MySQL provides a client library written in the C programming language. It enables the access of MySQL databases from a C program.
331.

Which command is used to show all tables that are stored in a database?(a) SHOWS(b) SHOW(c) SHOWES(d) None of the mentioned

Answer» The correct answer is (d) None of the mentioned

For explanation: None.
332.

What is the facility that allows nesting one select statement into another?(a) nesting(b) binding(c) subquerying(d) encapsulating

Answer» The correct choice is (c) subquerying

Best explanation: The ‘subquerying’ support provided by MySQL is a capability that allows writing one ‘SELECT’ statement within parentheses and nesting within another. This allows logically selecting content from tables.
333.

The operator that does not perform relative-value comparisons is ______________(a) =(b) ==(c) =

Answer» Right answer is (b) ==

The best explanation: The operators =, <>, >, >=, <, and <= perform relative value comparisons in MySQL. ‘==’ is not a valid comparison operator in MySQL. Such operators are useful in filtering information from a table.
334.

Which is the MySQL instance responsible for data processing?(a) MySQL client(b) MySQL server(c) SQL(d) Server daemon program

Answer» Correct answer is (b) MySQL server

To explain: MySQL uses client-server architecture. The MySQL server program runs on the machine where databases are stored. SQL is a query language used for querying the tables and information retrieval.
335.

The facility that allows nesting one select statement into another is called __________(a) nesting(b) binding(c) subquerying(d) encapsulating

Answer» The correct answer is (c) subquerying

Easiest explanation: The ‘subquerying’ support provided by MySQL is a capability that allows writing one ‘SELECT’ statement within parentheses and nesting within another. This allows logically selecting content from tables.
336.

What does mysql_real_connect() return if it fails?(a) integer(b) float(c) structure(d) NULL

Answer» The correct answer is (d) NULL

The explanation is: The function ‘mysql_real_connect()’ must complete successfully before any other API functions that require a valid MYSQL connection handler structure can be executed. It returns NULL on failure.
337.

The MySQL server used in its client/server architecture is _______________(a) mysqla(b) mysqlb(c) mysqlc(d) mysqld

Answer» Right option is (d) mysqld

Best explanation: mysqld is the MySQL server program. It serves the incoming client requests by accessing the database. The others are not valid MySQL programs. MySQL implements a client/server architecture wherein mysqld is the server program.
338.

The argument to the function mysql_error() is _______________(a) integer(b) float(c) structure(d) pointer

Answer» Correct answer is (d) pointer

To explain: The argument to the API functions ‘mysql_error()’, ‘mysql_errno()’ and ‘mysql_sqlstate()’ is a pointer to the connection handler. These should be called after an error occurs.
339.

The embedded server library containing the MySQL server linkable into applications is _______________(a) libmysqla(b) libmysqlb(c) libmysqlc(d) libmysqld

Answer» Correct choice is (d) libmysqld

To elaborate: MySQL includes an embedded server library, libmysqld, containing the MySQL server in a way that can be linked into applications. This enables the production of MySQL-based standalone applications.
340.

Which command is used for showing current date and time in Mysql command line tool?(a) select now()(b) SELECT now();(c) SELECT now()(d) None of the mentioned

Answer» Correct choice is (b) SELECT now();

To explain: None.
341.

The “Mysql command line tool” formats are bounded by ______________(a) +-|(b) +-*(c) +-/(d) +-}

Answer» Right answer is (a) +-|

To elaborate: None.
342.

Which command is used for taking “server side help” in Mysql command line tool?(a) /h(b) /c(c) /e(d) None of the mentioned

Answer» Right option is (a) /h

The best explanation: /h represents help contents for Mysql.
343.

Which command is used in Mysql command line tool to return to window command shell?(a) exit;(b) quit;(c) both exit; and quit;(d) only exit;

Answer» The correct choice is (c) both exit; and quit;

Explanation: None.
344.

For what can the FULLTEXT indexes be created for?(a) MyISAM(b) InnoDB(c) MEMORY(d) TRANSITION

Answer» Right option is (a) MyISAM

For explanation: Full-text searches are based on the FULLTEXT indexes. They can be created for MyISAM tables only. In MySQL, a full text search enables to look for words or phrases without using pattern-matching operations.
345.

Which parameter determines the shortest words to index in FULLTEXT indexes?(a) ft_min_word_len(b) ft_min_len_word(c) ft_word_min_len(d) ft_word_len_word

Answer» Right option is (a) ft_min_word_len

Easy explanation: There are many full-text parameters that are configurable. They can be modified by setting the system variables accordingly. The ‘ft_min_word_len’ parameter determines the shortest words to index in FULLTEXT indexes.
346.

Which statement exits a labeled flow-control construct?(a) DESCRIBE(b) LEAVE(c) LOOP(d) RETURN

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

FULLTEXT indexes can be created only for ____________(a) MyISAM(b) InnoDB(c) MEMORY(d) TRANSITION

Answer» Right option is (a) MyISAM

For explanation I would say: Full-text searches are based on the FULLTEXT indexes. They can be created for MyISAM tables only. In MySQL, a full text search enables to look for words or phrases without using pattern-matching operations.
348.

What does mysql_fetch_row() return?(a) integer(b) float(c) structure(d) pointer

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].
349.

For which language is the engine specific interface PDO defined?(a) Python(b) Perl(c) PHP(d) C

Answer» The correct answer is (c) PHP

Easy explanation: Like DBI, PHP includes support for accessing several database engines in addition to MySQL. It has engine specific interfaces, and interfaces that are more engine independent.
350.

What is the general statement-issuing routine?(a) mysql_real_query()(b) mysql_query_real()(c) mysql_image_query()(d) mysql_query_image()

Answer» Correct choice is (a) mysql_real_query()

To elaborate: The general statement-issuing routine is mysql_real_query(). The statement is provided as a counted string (a string plus a length). The length of the statement string must be kept track of.