InterviewSolution
Saved Bookmarks
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.
| 251. |
The AUTO_INCREMENT sequences normally begin at __________(a) 0(b) 1(c) -1(d) 2 |
|
Answer» Right answer is (b) 1 The explanation is: The AUTO_INCREMENT column attribute provides unique numbers for column identification. AUTO_INCREMENT sequences normally begin at 1 and increase monotonically like 1, 2, 3, and so on. |
|
| 252. |
By default, the AUTO_INCREMENT sequences begin at __________(a) 0(b) 1(c) -1(d) 2 |
|
Answer» The correct answer is (b) 1 Explanation: The AUTO_INCREMENT column attribute provides unique numbers for column identification. AUTO_INCREMENT sequences normally begin at 1 and increase monotonically like 1, 2, 3, and so on. |
|
| 253. |
0x61 + 0 results in _____________(a) 0(b) ‘a’(c) 97(d) arbitrary |
|
Answer» The correct choice is (c) 97 The best explanation: The hexadecimal constants are treated as binary strings unless the context indicates a number. In the string contexts, each pair of hexadecimal digits is converted to a character, then the result is used as a string. |
|
| 254. |
The number of rows in the table is 10. Suppose all rows are deleted. The new row starts with sequence number _____________(a) 11(b) 1(c) 100(d) 101 |
|
Answer» Correct choice is (b) 1 To elaborate: When the row containing the largest value in an AUTO_INCREMENT column is deleted, that value is reused the next time a new value is generated. In this case the sequence number is 1. |
|
| 255. |
What does the expression ’12 DIV 5′ evaluate to?(a) 2.4(b) 2(c) error(d) 0 |
|
Answer» Right choice is (b) 2 To explain: The ‘DIV’ operator in MySQL is used to perform the integer divisions. The operator ‘/’ performs the quotient of the operands. If result exceeds the 64-bit range, unpredicted results are shown. |
|
| 256. |
The expression ‘2 BETWEEN 2 AND 5’ results in ____________(a) True(b) False(c) -1(d) 2 |
|
Answer» Correct option is (a) True Easiest explanation: The ‘BETWEEN ……. AND’ clause is used to return a boolean value, if the given operand value lies between the values specified by the ‘AND’ clause. The range endpoints are inclusive. |
|
| 257. |
The expression 12 DIV 5 evaluates to ____________(a) 2.4(b) 2(c) error(d) 0 |
|
Answer» Correct choice is (b) 2 The best I can explain: The ‘DIV’ operator in MySQL is used to perform the integer divisions. The operator ‘/’ performs the quotient of the operands. If result exceeds the 64-bit range, unpredicted results are shown. |
|
| 258. |
Which statement is used to create a trigger?(a) CREATE TRIGGER(b) CREATE TRIGGERS(c) PRODUCE TRIGGER(d) PRODUCE TRIGGERS |
|
Answer» The correct option is (a) CREATE TRIGGER Easy explanation: In order to create a trigger, the CREATE TRIGGER statement is used. The definition indicates the particular type of statement for which the trigger activates and whether it activates before or after the rows are modified. |
|
| 259. |
The datatype best suited to store currency values is ______________(a) INT(b) FLOAT(c) DOUBLE(d) DECIMAL |
|
Answer» The correct option is (d) DECIMAL Explanation: Currency is a numeric information. For monetary calculations, FLOAT and DOUBLE are subject to rounding error and may not be suitable. A DECIMAL(M, 2) type is best suited for it. |
|
| 260. |
Which statement is used to remove a trigger?(a) REMOVE(b) DELETE(c) DROP(d) CLEAR |
|
Answer» Correct choice is (c) DROP Explanation: In order to delete a trigger, the DROP TRIGGER statement is used. The DROP TRIGGER construct is used by writing the phrase ‘DROP TRIGGER’ followed by the scheme name specification. |
|
| 261. |
The datatype best suited to store currency values is __________(a) INT(b) FLOAT(c) DOUBLE(d) DECIMAL |
|
Answer» Correct answer is (d) DECIMAL The explanation is: Currency is a numeric information. For monetary calculations, FLOAT and DOUBLE are subject to rounding error and may not be suitable. A DECIMAL(M, 2) type is best suited for it. |
|
| 262. |
Which data type is best suited to store currency values?(a) INT(b) FLOAT(c) DOUBLE(d) DECIMAL |
|
Answer» Correct answer is (d) DECIMAL Explanation: Currency is a numeric information. For monetary calculations, FLOAT and DOUBLE are subject to rounding error and may not be suitable. A DECIMAL(M, 2) type is best suited for it. |
|
| 263. |
Which datatype is best suited to store currency values?(a) INT(b) FLOAT(c) DOUBLE(d) DECIMAL |
|
Answer» Right option is (d) DECIMAL For explanation I would say: Currency is a numeric information. For monetary calculations, FLOAT and DOUBLE are subject to rounding error and may not be suitable. A DECIMAL(M, 2) type is best suited for it. |
|
| 264. |
For which of the following are triggers not supported?(a) delete(b) update(c) insert(d) views |
|
Answer» Right option is (d) views Explanation: In MySQL, the triggers are run only after the table modifications like insert, update and delete are run. Triggers are not supported for views. In order to create a trigger, the CREATE TRIGGER statement is used. |
|
| 265. |
Triggers are not supported for _____________(a) delete(b) update(c) insert(d) views |
|
Answer» The correct option is (d) views For explanation: In MySQL, the triggers are run only after the table modifications like insert, update and delete are run. Triggers are not supported for views. In order to create a trigger, the CREATE TRIGGER statement is used. |
|
| 266. |
How can the value of recently generated sequence number be obtained?(a) LAST_INSERT_ID()(b) LATEST_INSERT_ID()(c) INITIAL_INSERT_ID()(d) INSERT_ID() |
|
Answer» Correct choice is (a) LAST_INSERT_ID() For explanation I would say: The value of most recently generated sequence number can be obtained by calling the LAST_INSERT_ID() function. This enables to reference the AUTO_INCREMENT value in the subsequent statement. |
|
| 267. |
The facility that allows nesting one select statement into another is ______________(a) nesting(b) binding(c) subquerying(d) encapsulating |
|
Answer» Correct option is (c) subquerying To explain: 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. |
|
| 268. |
The join in which all the rows from the right table appear in the output irrespective of the content of the other table is ___________(a) CARTESIAN JOIN(b) CROSS JOIN(c) INNER JOIN(d) RIGHT JOIN |
|
Answer» The correct option is (d) RIGHT JOIN Best explanation: In a ‘RIGHT JOIN’, the output is produced for every row of the right table, even if it does not exist in the other table. This is the reason why it is called a ‘RIGHT JOIN’. ‘RIGHT JOIN’ and ‘LEFT JOIN’ are a kind of OUTER JOIN. |
|
| 269. |
In which join all the rows from the left table appear in the output irrespective of the content of the other table?(a) RIGHT JOIN(b) LEFT JOIN(c) INNER JOIN(d) OUTER JOIN |
|
Answer» Correct choice is (b) LEFT JOIN Best explanation: In a ‘LEFT JOIN’, the output is produced for every row of the left table, even if it does not exist in the right table. This is the reason it is called a ‘LEFT JOIN’. ‘LEFT JOIN’ is a kind of OUTER JOIN. |
|
| 270. |
Which is the join in which all the rows from the right table appear in the output irrespective of the content of the other table?(a) CARTESIAN JOIN(b) CROSS JOIN(c) INNER JOIN(d) RIGHT JOIN |
|
Answer» The correct option is (d) RIGHT JOIN The explanation: In a ‘RIGHT JOIN’, the output is produced for every row of the right table, even if it does not exist in the other table. This is the reason why it is called a ‘RIGHT JOIN’. ‘RIGHT JOIN’ and ‘LEFT JOIN’ are a kind of OUTER JOIN. |
|
| 271. |
The join in which all the rows from the right table appear in the output irrespective of the content of the other table is ______________(a) CARTESIAN JOIN(b) CROSS JOIN(c) INNER JOIN(d) RIGHT JOIN |
|
Answer» Right option is (d) RIGHT JOIN For explanation I would say: In a ‘RIGHT JOIN’, the output is produced for every row of the right table, even if it does not exist in the other table. This is the reason why it is called a ‘RIGHT JOIN’. ‘RIGHT JOIN’ and ‘LEFT JOIN’ are a kind of OUTER JOIN. |
|
| 272. |
The value of recently generated sequence number can be obtained by ____________(a) LAST_INSERT_ID()(b) LATEST_INSERT_ID()(c) INITIAL_INSERT_ID()(d) INSERT_ID() |
|
Answer» The correct choice is (a) LAST_INSERT_ID() Easiest explanation: The value of most recently generated sequence number can be obtained by calling the LAST_INSERT_ID() function. This enables to reference the AUTO_INCREMENT value in the subsequent statement. |
|
| 273. |
Which program is used as a utility for MyISAM table maintenance?(a) innochecksum(b) myisam_ftdump(c) myisamchk(d) myisamlog |
|
Answer» The correct answer is (c) myisamchk For explanation: The program ‘myisamchk’ is a utility for the table maintenance. ‘innochecksum’ is used for offline InnoDB file checksum utility. To display full text index information ‘myisam_ftdump’ is used. |
|
| 274. |
The data rows of a MyISAM table are stored in __________(a) data file(b) index file(c) log file(d) error file |
|
Answer» Correct choice is (a) data file The explanation is: The data rows of the MyISAM table are stored in a data file and the index values are stored in a separate index file. In MySQL, for a MyISAM table, there can be more than one indexes. |
|
| 275. |
The join where all possible row combinations are produced is called _________(a) INNER JOIN(b) OUTER(c) NATURAL(d) CARTESIAN |
|
Answer» Correct answer is (d) CARTESIAN To explain I would say: In ‘cartesian product’, each row of each table is combined with each row in every other table to produce all possible combination. This produces a very large number of rows since the number is the product of rows. |
|
| 276. |
The option in mysqlshow to show information about indexes in a table is _________(a) –no-data(b) –indexes(c) –keys(d) –flag |
|
Answer» The correct answer is (c) –keys Explanation: The ‘mysqlshow’ command has various flags to provide a lot of options on displaying tables. The ‘–keys’ flag is specifically used to show information about indexes in a table. |
|
| 277. |
Which of these types store the longest length of strings?(a) CHAR(b) VARCHAR(c) TINYTEXT(d) TEXT |
|
Answer» Correct answer is (d) TEXT The explanation: in MySQL, the different string datatypes are used to store different lenghts of the string. Here, the length would refer to the number of characters in the string. TEXT stores longer strings. |
|
| 278. |
Which spatial datatype is used to store a curve?(a) GEOMETRY(b) POINT(c) LINESTRING(d) POLYGON |
|
Answer» The correct option is (c) LINESTRING To explain I would say: In MySQL, there are many spatial datatypes available for use. Some examples are GEOMETRY, POINT, LINESTRING and POLYGON. The LINESTRING type is used to represent a curve. |
|
| 279. |
Which datatype means a variable length non binary string?(a) VARCHAR(b) BINARY(c) VARBINARY(d) BLOB |
|
Answer» Right answer is (a) VARCHAR Explanation: In MySQL, there are a wide variety of string datatypes for use. Strings can even hold image and sound data. All the four options are string type names. VARCHAR represents a variable length non binary string. |
|
| 280. |
Which data and time datatype stores time value in ‘hh:mm:ss’ format?(a) DATE(b) TIME(c) DATETIME(d) TIMESTAMP |
|
Answer» Correct choice is (b) TIME For explanation I would say: MySQL has some variety of date and time datatypes. These datatypes are crucial for representing records in a table. The ‘TIME’ type represents a time value, stored in the ‘hh:mm:ss’ format. |
|
| 281. |
What does comparing a known value with NULL result into?(a) zero(b) a positive value(c) a negative value(d) null |
|
Answer» Correct answer is (d) null For explanation: In MySQL, NULL is not comparable to other known values. It will result in a NULL when compared to any value. The following statement would result in four NULLs: ‘SELECT NULL = 0, NULL < 0, NULL <> 0, NULL > 0’. |
|
| 282. |
What is the creation of a stored program similar to?(a) Trigger(b) Event(c) View(d) Table |
|
Answer» The correct option is (c) View To explain I would say: When a stored program is created, an object is created that is to be executed later. This also the case when a view is defined: It sets up a SELECT statement intended for later invocation. |
|
| 283. |
The NULL value also means ___________(a) value equal to zero(b) unknown value(c) negative values(d) a large value |
|
Answer» The correct answer is (b) unknown value The explanation is: The NULL value in MySQL is a special value. It represents ‘no value’ or an ‘unknown value’. A NULL value can’t be compared like normal known values since it gives undesirable results. |
|
| 284. |
The security context when a user creates a stored program that accesses sensitive data but forgets that other people who can invoke the object have the same access is __________(a) good(b) bad(c) illegal(d) fare |
|
Answer» The correct option is (b) bad Best explanation: The security context is bad if a user creates a stored program that accesses sensitive data but forgets that other people who can invoke the object have the same access to that data as its definer. |
|
| 285. |
Which mode prevents entry of the ‘zero’ date value in strict mode?(a) SUPPRESS(b) NO_ZERO_DATE(c) PREVENT(d) NO_ZERO_IN_DATE |
|
Answer» Right choice is (b) NO_ZERO_DATE For explanation: The ‘NO_ZERO_DATE’ prevents the entry of the ‘zero’ date value in strict mode. In MySQL, to suppress errors, the IGNORE keyword is used with INSERT or UPDATE statements. |
|
| 286. |
When the security context enables carefully written stored programs to be set up that provide controlled access to tables for users, it is called __________(a) bad(b) good(c) illegal(d) fare |
|
Answer» Right choice is (b) good To elaborate: The security context is good if it enables carefully written stored programs to be set up that provide controlled access to tables for users who are not able to access them directly. |
|
| 287. |
Which mode prevents MySQL to perform full checking of date parts?(a) ALLOW_DATES_INVALID(b) ALLOW_INVALID_DATES(c) PREVENT_DATE_CHECK(d) STOP_DATES_CHECK |
|
Answer» Correct option is (b) ALLOW_INVALID_DATES The best explanation: In MySQL, it is also possible to selectively weaken the strict mode at some places. If the ALLOW_INVALID_DATES SQL mode is enabled, MySQL doesn’t perform full checking of the date parts. |
|
| 288. |
When a user creates a stored program that accesses sensitive data but forgets that other people who can invoke the object have the same access, the security context is __________(a) good(b) bad(c) illegal(d) fare |
|
Answer» The correct answer is (b) bad Best explanation: The security context is bad if a user creates a stored program that accesses sensitive data but forgets that other people who can invoke the object have the same access to that data as its definer. |
|
| 289. |
Which operator is used to perform integer divisions in MySQL?(a) /(b)(c) DIV(d) // |
|
Answer» Right answer is (c) DIV The explanation is: The operator ‘DIV’ is used to perform integer divisions in MySQL. ‘//’ is used in languages like Python to do the same. The operator ‘/’ performs floating point divisions and ‘’ is facilitates escape sequences. |
|
| 290. |
What is the generic handle whose meaning depends on context?(a) $dbh(b) $sth(c) $fh(d) $h |
|
Answer» Right option is (d) $h To explain I would say: The variable named ‘$fh’ 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. |
|
| 291. |
The size of the BIT type is ___________(a) 1(b) 2(c) 3(d) variable |
|
Answer» Correct option is (d) variable The explanation: All the numeric datatypes used in MySQL vary over the fields. However the maximum size is fixed. Unlike the other numeric types the size of the BIT datatype depends on the length of the field. |
|
| 292. |
What is the storage size in bytes required for the MEDIUMINT datatype?(a) 1(b) 2(c) 3(d) 4 |
|
Answer» The correct answer is (c) 3 The explanation is: The numeric datatypes used in MySQL vary over ranges. There are a variety of INT types in the type specification. TINYINT requires 1, SMALLINT requires 2 bytes and MEDIUMINT requires 3. |
|
| 293. |
The storage size in bytes required for the MEDIUMINT datatype is ___________(a) 1(b) 2(c) 3(d) 4 |
|
Answer» Right option is (c) 3 Easy explanation: The numeric datatypes used in MySQL vary over ranges. There are a variety of INT types in the type specification. TINYINT requires 1, SMALLINT requires 2 bytes and MEDIUMINT requires 3. |
|
| 294. |
The maximum length of the char columns is ____________(a) 255 bytes(b) 65, 535 bytes(c) 256 bytes(d) None of the mentioned |
|
Answer» The correct choice is (a) 255 bytes The best explanation: None. |
|
| 295. |
The expression ‘HI’ LIKE NULL results in _____________(a) True(b) False(c) NULL(d) 0 |
|
Answer» Right answer is (c) NULL The best explanation: In MySQL, any pattern matching that is performed with the ‘NULL’ operand, fails. Expressions like: ‘abcdef’ LIKE NULL, NULL LIKE ‘%’, all result into the value NULL. NULL is not used to perform comparisons. |
|
| 296. |
Which mode does not remove trailing spaces when CHAR values are retrieved?(a) PAD_CHAR_TO_FULL_LENGTH(b) TO_FULL_LENGTH_CHAR_PAD(c) CHAR_PAD_TO_FULL_LENGTH(d) PAD_CHAR_TO_LENGTH |
|
Answer» Right choice is (a) PAD_CHAR_TO_FULL_LENGTH For explanation: When the CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed unless the SQL mode ‘PAD_CHAR_TO_FULL_LENGTH’ is enabled. |
|
| 297. |
The mode that does not remove trailing spaces when CHAR values are retrieved is _____________(a) PAD_CHAR_TO_FULL_LENGTH(b) TO_FULL_LENGTH_CHAR_PAD(c) CHAR_PAD_TO_FULL_LENGTH(d) PAD_CHAR_TO_LENGTH |
|
Answer» Correct answer is (a) PAD_CHAR_TO_FULL_LENGTH The explanation: When the CHAR values are stored, they are right-padded with spaces to the specified length. When CHAR values are retrieved, trailing spaces are removed unless the SQL mode ‘PAD_CHAR_TO_FULL_LENGTH’ is enabled. |
|
| 298. |
The default storage engine used is ____________(a) EXAMPLE(b) ARCHIVE(c) MyISAM(d) NDB |
|
Answer» Right choice is (c) MyISAM Explanation: MySQL comes with multiple storage engines. The default storage engine used is ‘MyISAM’. ‘EXAMPLE’ is the stub storage engine, NDB is the storage engine for MySQL Cluster. |
|
| 299. |
Which of these is defined to execute when the table is modified only?(a) Stored functions(b) Stored procedures(c) Triggers(d) Events |
|
Answer» Correct choice is (c) Triggers For explanation I would say: In MySQL, triggers are associated with a table. They are defined to execute when the table is modified via INSERT, DELETE or UPDATE statements. MySQL supports objects to be stored on server side. |
|
| 300. |
What executes on a time activated basis according to a schedule?(a) Stored program(b) Events(c) Triggers(d) Stored procedures |
|
Answer» The correct option is (b) Events The best I can explain: In MySQL, the events execute on a time activated basis according to a schedule. Triggers are defined to execute when the table is modified via INSERT, DELETE or UPDATE statements. |
|