This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on ” Using Perl DBI in Web Applications”.
1. The module that links DBI to the web is ______________
Explanation: The CGI.pm module is used to write scripts that use the ‘Common Gateway Interface’ protocol. It defines how a web server communicates with other programs. It provides an easy link.
2. CGI stands for ______________
a) Computer Gateway Interface
b) Common Gateway Interface
c) Computer Generated Interface
d) Common Generated Interface
Explanation: The ‘CGI.pm’ module is so called because it helps write scripts that use the ‘Common Gateway Interface’ protocol which defines how a web server communicates with other programs.
3. Which line is written at the top of the script to write a Perl script using CGI.pm?
a) use this CGI
b) put CGI
c) use CGI
d) include CGI
Explanation: In order to write a Perl script that uses the ‘CGI.pm’ module, a ‘use CGI’ statement is included near the beginning of the script that imports the function names of the module.
4. CGI.pm also supports an object oriented style of use.
Explanation: ‘CGI.pm’ supports an object oriented style of use which allows to invoke its functions without importing the names. To do this, a use statement is included and a CGI object is created.
5. There can be more than one column per table with the AUTO_INCREMENT attribute.
Explanation: In MySQL, there can only be one column per table with the AUTO_INCREMENT attribute. It should also have an integer data type. The AUTO_INCREMENT is also allowed for floating point types.
6. By default, the AUTO_INCREMENT sequences begin at __________
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.
7. What does the expression ’12 DIV 5′ evaluate to?
Explanation: 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.
8. What does ‘abc’ || ‘xyz’ result in if the PIPES_AS_CONCAT is disabled?
Explanation: When the SQL mode PIPES_AS_CONCAT is disabled, the SQL standard ‘||’ operation for string concatenation is not valid in MySQL. Both operands are converted to zero. So the result is zero.
9. The AUTO_INCREMENT column attribute is best used with ______________
Explanation: The AUTO_INCREMENT is a column attribute and it is best used with the integer datatypes. It automatically assigns monotonically increasing values to the AUTO_INCREMENT columns.
10. The datatype best suited to store currency values is ______________
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.
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.