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.

“MODIFY” is used with which “Query clause”?(a) ALTER(b) FROM(c) WHERE(d) ORDER BYI had been asked this question at a job interview.My query is from Query Clauses topic in section Query Optimization of MySQL

Answer»

Correct option is (a) ALTER

The best explanation: MODIFY is not a CLAUSE, it just USED with clause Alter.

2.

Which among the following is not a “query clause”?(a) WHERE(b) MODIFY(c) ALTER(d) FROMThe question was asked by my college director while I was bunking the class.My question is taken from Query Clauses in section Query Optimization of MySQL

Answer» RIGHT option is (a) WHERE

For explanation I would say: MODIFY is not a CLAUSE, it just used with clause Alter.
3.

Which clause is used to “Modify the existing field of the table”?(a) ALTER(b) FROM(c) SELECT(d) MODIFYThe question was asked at a job interview.This interesting question is from Query Clauses in division Query Optimization of MySQL

Answer» CORRECT ANSWER is (a) ALTER

Explanation: NONE.
4.

Which clause is used to “sort the rows of the final result set by one or more columns”?(a) HAVING(b) ORDER BY(c) WHERE(d) FROMThis question was addressed to me in class test.This is a very interesting question from Query Clauses topic in chapter Query Optimization of MySQL

Answer»

The correct CHOICE is (B) ORDER BY

Easy explanation: None.

5.

Which clause is used to “filter out unwanted Groups”?(a) HAVING(b) FROM(c) WHERE(d) SELECTI have been asked this question in an internship interview.This is a very interesting question from Query Clauses topic in section Query Optimization of MySQL

Answer» CORRECT CHOICE is (a) HAVING

Easiest EXPLANATION: NONE.
6.

Which clause is used to “group rows together by common columns values”?(a) SELECT(b) GROUP BY(c) FROM(d) WHEREThis question was posed to me during an internship interview.The doubt is from Query Clauses in section Query Optimization of MySQL

Answer»

The CORRECT CHOICE is (B) GROUP BY

Explanation: NONE.

7.

Which clause is used to “Filters out unwanted data”?(a) FROM(b) WHERE(c) SELECT(d) ORDER BYThis question was posed to me by my school teacher while I was bunking the class.The query is from Query Clauses in section Query Optimization of MySQL

Answer» CORRECT ANSWER is (B) WHERE

The EXPLANATION is: NONE.
8.

Which clause is used to “Identifies table from which to draw table and how the table should be joined”?(a) FROM(b) SELECT(c) ORDER By(d) WHEREThis question was posed to me in an interview for job.My question comes from Query Clauses in section Query Optimization of MySQL

Answer» RIGHT OPTION is (a) FROM

For EXPLANATION: NONE.
9.

Which clause is used to determine “which column to include in the query sets”?(a) SELECT(b) FROM(c) WHERE(d) ORDER BYThis question was posed to me in exam.My question is from Query Clauses topic in division Query Optimization of MySQL

Answer» CORRECT OPTION is (a) SELECT

Easy EXPLANATION: NONE.
10.

Select the sequence for how the query mechanism works?(a) Authentication-> DDL->DML->query optimizer->output(b) DDL->DML->query optimizer-> Authentication->output(c) DML->query optimizer-> Authentication-> DDL-> output(d) All of the mentionedThis question was posed to me in my homework.This interesting question is from Query Mechanics topic in section Query Optimization of MySQL

Answer»

Right answer is (a) Authentication-> DDL->DML->query optimizer->output

Best explanation: When we execute any query, the first step is authentication (PASSWORD). Second step for data definition mechanism, the THIRD step is for Data MANIPULATION and the LAST is optimizer for efficient execution.

11.

The users responsible forquery processing in database system are ___________(a) Native users(b) Application programmers(c) Sophisticated users(d) Specialized usersI got this question in examination.The origin of the question is Query Mechanics topic in division Query Optimization of MySQL

Answer»

Correct choice is (c) SOPHISTICATED users

To explain: Sophisticated users interact with the system without writing any application PROGRAMS; they FORM the request in a DATABASE QUERY language.

12.

Which are the two languages used in Mysql?(a) DML/DDL(b) DDL/DCL(c) DML/DDM(d) None of the mentionedI have been asked this question during an interview for a job.The doubt is from Query Mechanics in chapter Query Optimization of MySQL

Answer»

Right option is (a) DML/DDL

To EXPLAIN I would say: DDL (DATA DEFINITION Language)

DML (Data MANIPULATION Language).

13.

What jobs “Query Optimizer” perform in Mysql?(a) Determine the efficient way to execute a query(b) Syntax errors(c) Permissions(d) All of the mentionedI have been asked this question in an interview for internship.My question comes from Query Mechanics in chapter Query Optimization of MySQL

Answer»

Correct OPTION is (a) DETERMINE the efficient way to EXECUTE a query

Explanation: Query OPTIMIZER is used to find the efficient way to execute a query in Mysql.

14.

Query Mechanism performs the following functions?(a) Syntax correction(b) Checking permission for executing the query(c) Checking permission for accessing the desired data(d) All of the mentionedThis question was addressed to me by my school principal while I was bunking the class.This intriguing question originated from Query Mechanics in division Query Optimization of MySQL

Answer» RIGHT option is (d) All of the mentioned

To explain I would SAY: NONE.
15.

Which among the following tags belong to Data Manipulation language?(a) UPDATE(b) ALTER(c) MODIFY(d) All of the mentionedI had been asked this question in an international level competition.I'd like to ask this question from Query Mechanics topic in division Query Optimization of MySQL

Answer» CORRECT CHOICE is (d) All of the mentioned

Explanation: Data MANIPULATION language contains all tags which are USED for manipulating the EXISTING structure in Mysql.
16.

Which among the following tags belong to Data definition language?(a) SELECT(b) FROM(c) WHERE(d) All of the mentionedThe question was posed to me at a job interview.Question is from Query Mechanics topic in chapter Query Optimization of MySQL

Answer»

The CORRECT option is (d) All of the mentioned

The explanation: Data definition LANGUAGE contains all TAGS which are USED for the definition of the structures in MYSQL.

17.

Which compiler is used to execute the structured query language?(a) DCL(b) DDL(c) DML(d) None of the mentionedI had been asked this question during an online interview.This question is from Query Mechanics in division Query Optimization of MySQL

Answer» CORRECT option is (c) DML

Explanation: STRUCTURED query language consists of Data manipulation language as well as data definition language. Therefore DML COMPILER.
18.

Which line of the following statements will produce error?(a) SELECT * FROM person WHERE person_id=1;(b) SELECT pname FROM person;(c) SELECT pname, lname, person_id FROM person;(d) None of the mentionedI got this question in semester exam.My query is from When Good Statements Go Bad in section Query Optimization of MySQL

Answer» RIGHT ANSWER is (d) NONE of the mentioned

To EXPLAIN: None.
19.

Which Key is used to link two tables in Mysql?(a) Primary Key(b) Foreign Key(c) Both Primary and Foreign Key(d) None of the mentionedThis question was posed to me by my school teacher while I was bunking the class.This interesting question is from When Good Statements Go Bad topic in portion Query Optimization of MySQL

Answer»

The CORRECT option is (b) Foreign Key

The BEST I can explain: Foreign Key is only the Key which can LINK two tables.

20.

Which of the following are the valid “database datatypes” in Mysql?(a) Numerical(b) Temporal(c) Text(d) All of the mentionedThe question was asked in a national level competition.Question is taken from When Good Statements Go Bad in section Query Optimization of MySQL

Answer» CORRECT CHOICE is (d) All of the mentioned

The BEST EXPLANATION: NONE.
21.

Which is the correct format to store date in the SQL?(a) DEC-01-1991(b) 01-1991-11(c) 01-DEC-12(d) 1991-11-01The question was asked in an interview for internship.My doubt stems from When Good Statements Go Bad in section Query Optimization of MySQL

Answer» RIGHT CHOICE is (d) 1991-11-01

To ELABORATE: NONE.
22.

Is duplicate entry of other attributes are allowed in SQL?(a) Yes(b) No(c) Depends(d) None of the mentionedThe question was asked in my homework.This interesting question is from When Good Statements Go Bad topic in division Query Optimization of MySQL

Answer» RIGHT ANSWER is (a) Yes

Easiest explanation: Duplicate values are allowed but not for Primary Key ATTRIBUTES.
23.

Is duplicate entry of primary key is allowed in SQL?(a) Yes(b) No(c) Depends(d) None of the mentionedThe question was asked in unit test.This interesting question is from When Good Statements Go Bad topic in chapter Query Optimization of MySQL

Answer»

The CORRECT answer is (b) No

Easy explanation: Primary KEY are used to uniquely define ATTRIBUTED STORED in the table.

24.

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 mentionedThis question was posed to me in an internship interview.Question is from When Good Statements Go Bad topic in portion Query Optimization of MySQL

Answer»

The CORRECT OPTION is (a) SHOW TABLES

Easy EXPLANATION: NONE.

25.

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 mentionedI got this question in class test.This intriguing question originated from When Good Statements Go Bad in chapter Query Optimization of MySQL

Answer» RIGHT ANSWER is (a) DROP TABLE

Easiest EXPLANATION: NONE.
26.

Installing more memory into the machine enables to configure larger values for cache server.(a) True(b) FalseThis question was posed to me during an online interview.This key question is from Administrative-Level Optimizations topic in section Query Optimization of MySQL

Answer»

Correct choice is (a) True

Best explanation: Installing more memory into the machine enables to CONFIGURE LARGER VALUES for the CACHE server and buffer SIZES. This enables it to keep data in memory for longer duration.

27.

Which mode tells cache queries that begin with SELECT SQL_CACHE?(a) 0(b) 1(c) 2(d) 3I got this question in an interview.The question is from Administrative-Level Optimizations topic in chapter Query Optimization of MySQL

Answer»

Correct option is (c) 2

The best explanation: The have_query_cache system variable is used to check whether there is support for query cache. The MODE ‘2’ tells cache only those queries that begin with SELECT SQL_CACHE.

28.

Which mode tells not to cache query results?(a) 0(b) 1(c) 2(d) 3The question was posed to me by my school principal while I was bunking the class.This interesting question is from Administrative-Level Optimizations topic in section Query Optimization of MySQL

Answer»

Right OPTION is (a) 0

Explanation: The have_query_cache system variable is used to check whether there is support for QUERY cache. The MODE ‘0’ tells not to cache the query results or to RETRIEVE the CACHED results.

29.

To determine whether query cache is supported by the server the variable is _________________(a) have_query_cache(b) have_cache_query(c) query_cache_have(d) cache_query_haveI had been asked this question in examination.The doubt is from Administrative-Level Optimizations in section Query Optimization of MySQL

Answer»

Right answer is (a) have_query_cache

For EXPLANATION: In MYSQL, in order to determine whether a server supports the query cache or not, the value of the ‘have_query_cache’ system variable is CHECKED. It returns ‘YES’ if SUPPORT is available.

30.

All queries can be cached.(a) True(b) FalseThis question was posed to me in examination.My question comes from Administrative-Level Optimizations in section Query Optimization of MySQL

Answer»

Right choice is (b) False

Best EXPLANATION: A query is not cached if the query RETURNS non DETERMINISTIC RESULTS. For example, a query that uses the NOW() function returns different results over time. THEREFORE, it cannot be cached.

31.

The system variable to maintain InnoDB log buffer size is _________________(a) innodb_log_buffer_size(b) innodb_buffer_log_size(c) buffer_log_innodb_size(d) log_buffer_innodb_sizeThis question was posed to me during an interview.This question is from Administrative-Level Optimizations topic in section Query Optimization of MySQL

Answer»

The correct choice is (a) innodb_log_buffer_size

To elaborate: The InnoDB storage engine has its own cache used for BUFFERING the data and index VALUES. It MAINTAINS a log buffer. The size for this is CONTROLLED by innodb_log_buffer_size.

32.

In MySQL, the default size of the key buffer in MB is _________________(a) 4(b) 8(c) 16(d) 32The question was posed to me in a job interview.I'm obligated to ask this question of Administrative-Level Optimizations topic in chapter Query Optimization of MySQL

Answer»

The correct ANSWER is (b) 8

For EXPLANATION I would say: The LARGER values allow MySQL to HOLD more index blocks in memory at once. This increases the chances of finding key values in memory without having to read a NEW block from disk.

33.

Which status indicator assesses how effective the table cache is?(a) Open_tables(b) Opened_tables(c) Close_tables(d) Closed_tablesThis question was posed to me during an online interview.This interesting question is from Administrative-Level Optimizations in chapter Query Optimization of MySQL

Answer»

Right option is (B) Opened_tables

Explanation: When the server ACCESSES VARIOUS tables, the table cache fills up. The server closes the tables that have not been used recently in order to make room for OPENING the NEW tables.

34.

Which system variable controls the size of the table cache?(a) table_cache(b) cache_table(c) open_cache(d) cache_openThe question was posed to me in an interview for internship.I want to ask this question from Administrative-Level Optimizations topic in division Query Optimization of MySQL

Answer»

Right OPTION is (a) table_cache

The best I can explain: In MySQL, when the SERVER opens table files it keeps them open to MINIMIZE the NUMBER of file-opening operations. It maintains information about open files in the table cache.

35.

Which table is preferred when there are many updates?(a) MyISAM(b) InnoDB(c) MEMORY(d) MERGEThis question was addressed to me in an online quiz.Question is from Scheduling and Locking Issues in portion Query Optimization of MySQL

Answer»

The correct choice is (b) InnoDB

Explanation: The InnoDB tables can provide better PERFORMANCE when there are many UPDATES. Locking is done at the ROW level rather than at the table level. So the extent of the table that is locked is smaller.

36.

The use of table level locks is always useful in MyISAM tables.(a) True(b) FalseI have been asked this question in a national level competition.I need to ask this question from Scheduling and Locking Issues topic in chapter Query Optimization of MySQL

Answer» CORRECT option is (b) False

Best explanation: MYISAM is extremely fast for retrievals but the use of table level LOCKS can be a problem in environments with mixed retrievals and UPDATES if the retrievals are long RUNNING.
37.

Find the odd one out in terms of scheduling policies.(a) MyISAM(b) InnoDB(c) MEMORY(d) MERGEThe question was posed to me during an interview for a job.Question is taken from Scheduling and Locking Issues in chapter Query Optimization of MySQL

Answer»

The correct OPTION is (b) INNODB

To EXPLAIN: The InnoDB storage engine implements locking at a DIFFERENT level. It has differing performance characteristics in TERMS of contention management. It uses row-level locks.

38.

Reading from a table does not change it.(a) True(b) FalseI have been asked this question in homework.Enquiry is from Scheduling and Locking Issues topic in portion Query Optimization of MySQL

Answer»

The correct option is (a) True

For explanation: READING does not change the table. There is no reason one READER should PREVENT another from accessing the table. So a READ lock enables other clients to read the table at the same time.

39.

Which statement issues a lock on tables?(a) ISSUE LOCK(b) LOCK ISSUE(c) LOCK TABLES(d) ISSUE LOCKSI had been asked this question during an online exam.Question is from Scheduling and Locking Issues topic in section Query Optimization of MySQL

Answer»

Right choice is (c) LOCK TABLES

To explain I would say: LOCKS can be acquired and released explicitly by issuing LOCK TABLES and UNLOCK TABLES statements. Normally the server’s lock manager AUTOMATICALLY ACQUIRES locks as necessary and releases them when they no longer are NEEDED.

40.

To reactivate indexes the command used is _________________(a) DISABLE KEYS(b) DISABLE INDEXES(c) ENABLE KEYS(d) ENABLE INDEXESThis question was posed to me by my college professor while I was bunking the class.The origin of the question is Loading Data Efficiently in section Query Optimization of MySQL

Answer»

Correct answer is (C) ENABLE KEYS

Easiest explanation: In MySQL, the clauses ‘DISABLE KEYS’ and ‘ENABLE KEYS’ are USED to DEACTIVATE and reactivate indexes for the table. The server does the WORK in deactivations and reactivations.

41.

TO enable the compressed client/server protocol the option is _________________(a) –enable(b) –compress(c) –reduce(d) –restrictI got this question in a job interview.My question is based upon Loading Data Efficiently topic in portion Query Optimization of MySQL

Answer»

The correct CHOICE is (B) –compress

Best explanation: The COMPRESSED client/server protocol is used to reduce the amount of data going over the network. For most of the MySQL clients this is specified using the –compress COMMAND line OPTION.

42.

The option which delays index flushing for slave server is _________________(a) –delay-write-key=ALL(b) –delay-key-write=ALL(c) –key-write-delay=NONE(d) –key-delay-write=NONEThe question was posed to me in semester exam.My enquiry is from Loading Data Efficiently topic in chapter Query Optimization of MySQL

Answer»

Right option is (b) –delay-key-write=ALL

The best I can explain: For the replication SLAVE servers, the –delay-key-write=ALL option DELAYS index FLUSHING for all MYISAM tables, REGARDLESS of how they were created originally on the master server.

43.

Which option repairs MyISAM tables automatically after they open?(a) –myisam-recover=FORCE(b) –myisam-recover=STOP(c) –recover-myisam=FORCE(d) –recover-myisam=STOPI had been asked this question in an interview.The query is from Loading Data Efficiently topic in portion Query Optimization of MySQL

Answer»

Correct answer is (a) –myisam-recover=FORCE

The EXPLANATION: In order to make SURE that the REPAIRS happen the server is started with the –myisam-recover=FORCE option. This enables the server to CHECK MyISAM tables when it opens them and REPAIR them automatically.

44.

Which table option for MyISAM tables reduces index flushing?(a) DELAY_KEY_WRITE(b) DELAY_WRITE_KEY(c) KEY_WRITE_DELAY(d) WRITE_KEY_DELAYThis question was addressed to me in an interview for job.Origin of the question is Loading Data Efficiently topic in chapter Query Optimization of MySQL

Answer»

Correct choice is (a) DELAY_KEY_WRITE

Easy explanation: For MYISAM tables a strategy for reducing index FLUSHING is to USE the DELAY_KEY_WRITE table OPTION. With this option the data ROWS are written to the data file immediately.

45.

Which option turns on the –extended-insert?(a) –opt(b) –opti(c) –op(d) –optimizeThis question was addressed to me during an interview.My question is from Loading Data Efficiently in division Query Optimization of MySQL

Answer»

The correct answer is (a) –opt

For explanation: If the –opt option is enabled it TURNS on the –extended-INSERT option, which produces multiple row INSERT statements and some other options that allow the dump FILE to be processed more efficiently.

46.

Without LOCAL, LOAD DATA is _________________(a) more efficient(b) less efficient(c) same speed(d) arbitraryI have been asked this question during an online exam.Query is from Loading Data Efficiently topic in chapter Query Optimization of MySQL

Answer»

The correct answer is (a) more efficient

Explanation: LOAD DATA is more efficient WITHOUT LOCAL. Without LOCAL, the file must be located on the server. The FILE privilege must be GIVEN. The server can READ the file directly from disk.

47.

Bulk loading is less efficient than single row loading.(a) True(b) FalseI had been asked this question in homework.My question comes from Loading Data Efficiently topic in portion Query Optimization of MySQL

Answer»

Right choice is (b) False

Easiest explanation: In MYSQL, BULK loading is more efficient than the single row loading. The key cache does not NEED to be flushed after each input record is LOADED. It can also be flushed at the end of the batch of records.

48.

Loading is faster when a table has no indexes than when it is indexed.(a) True(b) FalseI had been asked this question in exam.The origin of the question is Loading Data Efficiently topic in chapter Query Optimization of MySQL

Answer»

Correct answer is (a) True

Easiest explanation: LOADING is faster when a table has no indexes. If there are indexes, the contents of the row should be ADDED to the table and each index MUST also be modified to NOTIFY the ADDITION of the new row.

49.

Which of these can be used to generate hash values?(a) MS5()(b) MA5()(c) MF5()(d) MD5()This question was addressed to me in an internship interview.The query is from Choosing Data Types for Efficient Queries topic in section Query Optimization of MySQL

Answer»

The correct ANSWER is (d) MD5()

Easiest explanation: The hash values can be generated by using the function: MD5(). SHA1() or CRC32() can ALSO be used to do the same. Custom hash values can also be created using LOGIC within the application.

50.

IP numbers can be represented as _________________(a) both integers and a string(b) a stringbut not integers(c) integers but not a string(d) neither a string nor integersThe question was asked in an online quiz.Query is from Choosing Data Types for Efficient Queries topic in chapter Query Optimization of MySQL

Answer»

Correct choice is (a) both integers and a string

Best explanation: The IP ADDRESSES like 192.168.0.1 can be either stored as a string or a group of integers. Both of these forms would have their own benefits. For example, STORING as a string would facilitate PATTERN MATCHING.