MySQL Questions and Answers – Using Perl DBI in Web Applications

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 ______________
a) CGI.pn
b) CGI.pem
c) CGI.pm
d) CGI.po
View Answer

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

Answer: b
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
View Answer

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

4. CGI.pm also supports an object oriented style of use.
a) True
b) False
View Answer

Answer: a
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.
a) True
b) False
View Answer

Answer: b
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 __________
a) 0
b) 1
c) -1
d) 2
View Answer

Answer: b
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?
a) 2.4
b) 2
c) error
d) 0
View Answer

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

8. What does ‘abc’ || ‘xyz’ result in if the PIPES_AS_CONCAT is disabled?
a) 1
b) 0
c) error
d) -1
View Answer

Answer: b
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 ______________
a) FLOAT
b) INT
c) CHARACTER
d) DOUBLE
View Answer

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

10. The datatype best suited to store currency values is ______________
a) INT
b) FLOAT
c) DOUBLE
d) DECIMAL
View Answer

Answer: d
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.

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.