MySQL Questions and Answers – String Data Types

This set of MySQL Database Multiple Choice Questions & Answers (MCQs) focuses on “String Data Types”.

1. The maximum value that can be specified to the size of VARCHAR is _____________
a) 0
b) 127
c) 1023
d) 65535
View Answer

Answer: d
Explanation: The values in ‘VARCHAR’ columns are variable length strings. The length can be a value from 0 to 65,535. The effective maximum length of a VARCHAR is subject to the maximum row size.

2. The storage in bytes required for VARCHAR(4) type ‘abcd’ is _____________
a) 1
b) 3
c) 5
d) 8
View Answer

Answer: c
Explanation: ‘VARCHAR’ values are not padded when they are stored. The trailing spaces are retained when values are stored and retrieved in conformance with standard SQL. The given size is 5 bytes.

3. Which mode does not remove trailing spaces when CHAR values are retrieved?
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

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

4. What is the minimum value stored by signed TINYINT?
a) -256
b) -128
c) 0
d) 128
View Answer

Answer: b
Explanation: MySQL supports the SQL standard integer types INTEGER, or INT, and SMALLINT. As an extension to this standard, MySQL also supports the integer types TINYINT, MEDIUMINT and BIGINT.

5. For InnoDB tables in mysqldump an online backup that takes no locks on tables can be performed by which option?
a) –multiple-transaction
b) –single-transaction
c) –double-transaction
d) –no-transaction
View Answer

Answer: b
Explanation: For InnoDB tables it is possible to perform an online backup that takes no locks on tables using the option ‘–single-transaction’ to ‘mysqldump’. The ‘mysqldump’ can make backups.

6. What is used to reload a delimited text data file?
a) mysqldump
b) mysqld
c) mysqlimport
d) mysqlnaive
View Answer

Answer: c
Explanation: A way to create text data files along with files containing ‘CREATE TABLE’ statements for the backed up tables is to use ‘mysqldump’ with –tab. To reload a delimited text data file ‘mysqlimport’ is used.

7. Replication does not enable data from one MySQL database server to be copied to one or more MySQL database servers.
a) True
b) False
View Answer

Answer: b
Explanation: Replication enables data from one MySQL database server (the master) to be copied to one or more MySQL database servers (the slaves). Replication is asynchronous by default.
advertisement

8. What is SBR replication?
a) Statement based
b) Row based
c) Column based
d) Table based
View Answer

Answer: a
Explanation: There are two main kinds of replication format: Statement Based Replication (SBR) replicates entire SQL statements and Row Based Replication (RBR) replicates only the changed rows.

9. Which is the library file that contains various portability macros and definitions?
a) my_global.h
b) my_sys.h
c) mysql.h
d) my_local.h
View Answer

Answer: b
Explanation: The ‘my_sys.h’ header file contains a variety of portability macros and definitions required for structures and functions. These structures and functions are used by the client library.
advertisement

10. Which is the header that should be included first?
a) my_global.h
b) my_sys.h
c) mysql.h
d) my_local.h
View Answer

Answer: a
Explanation: The file ‘my_global.h’ takes care of including several other header files that are likely to be generally useful, like ‘stdio.h’. It also includes Windows compatibility information.

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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

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.