MySQL Questions and Answers – MySQL Data Types – 4

This set of Tough MySQL Interview Questions & Answers focuses on “MySQL Data Types – 4”.

1. The datatype for single precision floating point number is ____________
a) FLOAT
b) DOUBLE
c) INT
d) BIGINT
View Answer

Answer: a
Explanation: There are various numeric datatypes in MySQL. Some of them are TINYINT, SMALLINT, BIGINT, FLOAT, DOUBLE and BIT. ‘FLOAT’ is for single precision floating point numbers unlike DOUBLE.

2. Which datatype is used for a fixed length binary string?
a) VARCHAR
b) BINARY
c) VARBINARY
d) BLOB
View Answer

Answer: b
Explanation: MySQL has a variety of string datatypes for use. Strings can hold arbitrary binary data. All the four options are string type names. BINARY is used for a fixed length binary string.

3. Which datatype means a variable length non binary string?
a) VARCHAR
b) BINARY
c) VARBINARY
d) BLOB
View Answer

Answer: a
Explanation: In MySQL, there are a wide variety of string datatypes for use. Strings can even hold image and sound data. All the four options are string type names. VARCHAR represents a variable length non binary string.
advertisement
advertisement

4. Which data and time datatype stores time value in ‘hh:mm:ss’ format?
a) DATE
b) TIME
c) DATETIME
d) TIMESTAMP
View Answer

Answer: b
Explanation: MySQL has some variety of date and time datatypes. These datatypes are crucial for representing records in a table. The ‘TIME’ type represents a time value, stored in the ‘hh:mm:ss’ format.

5. Which spatial datatype is used to store a curve?
a) GEOMETRY
b) POINT
c) LINESTRING
d) POLYGON
View Answer

Answer: c
Explanation: In MySQL, there are many spatial datatypes available for use. Some examples are GEOMETRY, POINT, LINESTRING and POLYGON. The LINESTRING type is used to represent a curve.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. How many of the following attributes are allowed only for numeric types?

UNSIGNED, ZEROFILL, CHARACTER SET, COLLATE

a) 1
b) 2
c) 3
d) 4
View Answer

Answer: b
Explanation: UNSIGNED and ZEROFILL are allowable only for numeric types, and CHARACTER SET and COLLATE are allowable only for non-binary string types. These are type specific attributes.
advertisement

7. A DEFAULT value cannot be supplied to spatial types.
a) True
b) False
View Answer

Answer: a
Explanation: For every data type except the BLOB and TEXT types, spatial types, or columns with the AUTO_INCREMENT attribute, a DEFAULT def_value clause can be specified to keep a default value for a column.

8. A DEFAULT value cannot be supplied to TEXT types.
a) True
b) False
View Answer

Answer: a
Explanation: The DEFAULT def_value clause can be specified for every data type except the BLOB and TEXT types, spatial types, or columns with the AUTO_INCREMENT attribute. The def_value holds the default.
advertisement

9. The datatype INT stores ___________
a) 16 bit
b) 32 bit
c) 48 bit
d) 64 bit
View Answer

Answer: b
Explanation: Numeric datatypes in MySQL are many. Each numeric datatype used in MySQL have their own ranges in terms of bits. The INT datatype stores signed and unsigned values of 32 bits.

10. The datatype SMALLINT stores ___________
a) 16 bit
b) 32 bit
c) 48 bit
d) 8 bit
View Answer

Answer: a
Explanation: In MySQL, the numeric datatypes are many. A numeric datatype used in MySQL has its own range in terms of bits. The SMALLINT datatype stores signed and unsigned values of 16 bits.

Sanfoundry Global Education & Learning Series – MySQL Database.

To practice all tough interview questions on MySQL, 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.