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
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
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
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. What is the minimum value stored by signed TINYINT?
a) -256
b) -128
c) 0
d) 128
View Answer
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
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
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
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.
8. What is SBR replication?
a) Statement based
b) Row based
c) Column based
d) Table based
View Answer
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
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.
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
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.
- Practice Programming MCQs
- Check Information Technology Books
- Apply for Programming Internship
- Check MySQL Books