MySQL Multiple Choice Questions on “MySQL Datatypes”.
1. Which data type is used to store data and time in Mysql?
a) Numeric data type
b) Text data type
c) Temporal data type
d) Char/Varchar
Answer: c
Clarification: Temporal data are used for storing Date, Time, TimeStamp or Datetime.
2. What is the default format for “Date” data type?
a) YYYY-MM-DD
b) MM-YYYY-DD
c) DD-MM-YYYY
d) None of the mentioned
Answer: a
Clarification: Default means values that are assumed by the server.
3. What is the default format for “Datetime” data type?
a) YYYY-MM-DD HH:MI:SS
b) MM-YYYY-DD HH:MI:SS
c) DD-YYYY-MM MI:HH:SS
d) None of the mentioned
Answer: a
Clarification: Default means values that are assumed by the server.
4. What is the default format for “Timestamp” data type?
a) YYYY-MM-DD HH:MI:SS
b) MM-YYYY-DD HH:MI:SS
c) DD-YYYY-MM MI:HH:SS
d) None of the mentioned
Answer: a
Clarification: Default means values that are assumed by the server.
5. What is the default format for “Year” data type?
a) YYYY
b) YYYY-DD-MM
c) MM-YYYY-DD
d) None of the mentioned
Answer: a
Clarification: Default means values that are assumed by the server.
6. What is the default format for “Time” data type?
a) HHH:MI:SS
b) SS:MI:HHH
c) MI:SS:HHH
d) None of the mentioned
Answer: a
Clarification: Default means values that are assumed by the server.
7. Is “Datetime” and “Timestamp” are same data type?
a) Yes
b) No
c) Depends
d) None of the mentioned
Answer: a
Clarification: “Timestamp” column will automatically be populated with current Date/time by the Mysql server, when any row modified.
8. Which value will show an error when stored in float(4,2)?
a) 12.11
b) 13.1
c) 1.12
d) 123.44
Answer: d
Clarification: “Float(4,2)” cannot store more than 4 digits.
