MySQL Questions and Answers – Perl DBI Overview – 1

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

Answer: c
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

Answer: c
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

Answer: a
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.
advertisement
advertisement

4. Which variable returns code from operations that return true or false?
a) $rc
b) $rv
c) $rows
d) $ary
View Answer

Answer: a
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

Answer: a
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

Answer: c
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

Answer: b
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.
advertisement

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

Answer: c
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

Answer: a
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.
advertisement

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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.