This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “Date and Time Data Types”.
1. Which of these has special automatic update behavior?
a) DATE
b) TIME
c) TIMESTAMP
d) YEAR
View Answer
Explanation: The date and time types for representing temporal values are ‘DATE’, ‘TIME’, ‘DATETIME’, ‘TIMESTAMP’ and ‘YEAR’. Each temporal type has a range of valid values and a ‘zero’ value.
2. To disallow zero month or day parts in dates, the option used is _____________
a) NO_ZERO_IN_DATE
b) NO_DATE_WITH_ZERO
c) ZERO_IN_DATE
d) DATE_WITH_ZERO
View Answer
Explanation: MySQL permits to store the dates where the day or month and day are zero in a DATE or DATETIME column. This is helpful for applications that need to store birthdates for which the exact date is unknown.
3. 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
View Answer
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.
4. MySQL automatically converts a date or time value to a number if the value is used in a numeric context.
a) True
b) False
View Answer
Explanation: MySQL automatically converts a date or time value into a number if the value is used in a numeric context and vice versa. A ‘zero’ value can also be represented in MySQL.
5. The functions in Perl DBI 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’.
6. The variable used as a handle to an open file is ______________
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.
7. Which variable is a handle to a database object?
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.
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.
- Apply for Programming Internship
- Check Information Technology Books
- Practice Programming MCQs
- Check MySQL Books