This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Perl DBI Overview – 1”.
1. In Perl DBI, functions are called ______________
a) functions
b) procedures
c) methods
d) programs
View Answer
Explanation: In the DBI API, functions are called and pointers to structures are used. The functions are called ‘methods’, pointers are called ‘references’, pointer variables are called ‘handles’.
2. Which variable is used as a handle to an open file?
a) $dbh
b) $sth
c) $fh
d) $h
View Answer
Explanation: 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.
3. The variable that is a handle to a database object is ______________
a) $dbh
b) $sth
c) $fh
d) $h
View Answer
Explanation: 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.
4. Which variable returns code from operations that return true or false?
a) $rc
b) $rv
c) $rows
d) $ary
View Answer
Explanation: The Perl Non-handle variable ‘$rc’ returns code from operations that return true or false. ‘$rv’ returns value from operations that return an integer. ‘$rows’ returns value from operations that return a row count.
5. The statement to remove indexes on tables is ______________
a) DROP INDEX
b) DELETE INDEX
c) REMOVE INDEX
d) FLUSH INDEX
View Answer
Explanation: MySQL provides statements to change the structure of tables. To add or remove the indexes on the existing database tables, the ‘CREATE INDEX’ and ‘DROP INDEX’ tables are used.
6. What allows nesting one select statement into another?
a) nesting
b) binding
c) subquerying
d) encapsulating
View Answer
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.
7. The operator that does not perform relative-value comparisons is ______________
a) =
b) ==
c) <=
d) >=
View Answer
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.
8. The key declares that an index in one table is related to that in another is called _____________
a) primary
b) secondary
c) foreign
d) cross
View Answer
Explanation: In MySQL, a foreign key is the one that facilitates index relations across tables. It declares that an index in one table is related to that in another and place constraints.
9. Foreign keys can handle deletes and updates.
a) True
b) False
View Answer
Explanation: A foreign key is the one which declares that an index in one table is related to that in another and place constraints. It is useful for handling deletes and updates along with row entries.
Sanfoundry Global Education & Learning Series – MySQL Database.
To practice all areas of MySQL Database, here is complete set of 1000+ Multiple Choice Questions and Answers.
- Check MySQL Books
- Check Information Technology Books
- Apply for Programming Internship
- Practice Programming MCQs