This set of MySQL Questions and Answers for Experienced people focuses on “Data Value Categories – 2”.
1. The NUL (‘\0’) is same as the SQL NULL value.
Explanation: MySQL recognizes many escape sequences like other programming languages. An escape sequence begin with a backslash character. The ‘\0’ is different from NULL. It is a zero valued byte.
2. The escape sequence for carriage return is ___________
Explanation: MySQL provides the facility to use a wide range of escape sequences. They are special characters. They begin with the backslash character. For example, ‘\r’ specifies carriage return.
3. Which mode is used to turn off the special meaning of backslash and treat it as an ordinary character?
Explanation: To turn off the special meaning of backslash in MySQL, and treat it as an ordinary character, the SQL mode named NO_BACKSLASH_ESCAPES is enabled. The escape sequence is treated as characters.
4. x’ffff’ in decimal is ___________
Explanation: In MySQL, string values are specified using the standard SQL notation x’val’. Here, val is pairs of hexadecimal digits ( ‘0’ through ‘ 9 ’ and ‘ a ’ through ‘ f ’). x’ffff’ is 65536 in decimal.
5. X’61626364′ and X’61626364′ are respectively __________
a) abcd and 1633837924
b) abcd and 4297383361
c) dcba and 1633837924
d) dcba and 4297383361
Explanation: In the numeric contexts, each hexadecimal number constant is treated as a number. Without adding a zero to it, a hexadecimal literal is treated as a string. Hence it is displayed as abcd.
6. The number of legal hexadecimal values among 0x0a, 0x0A, 0X0a and 0X0A is ___________
Explanation: In MySQL, the hexadecimal values are case sensitive. The leading 0x is what makes it case sensitive. Not the lowercase ‘x’ notation is used here. Numbers prefixed with ‘0X’ are illegal.
7. A binary string is not associated with a character set.
Explanation: In MySQL, the string values are classified into two general categories. They are the binary strings and non binary strings. A binary string is only a sequence of bytes interpreted without a character set.
8. What is used to produce a new string from an old string in a desired character set.
Explanation: The introducers and CONVERT() clause are not the same in MySQL. An introducer modifies the way a string is interpreted and does not modify the string. CONVERT() produces a new string from the old one.
9. To measure the length of a string in bytes, the operator used is __________
Explanation: The LENGTH() operator is used to measure the length of an MySQL string in terms of bytes. To measure the length of the string in terms of number of characters, CHAR_LENGTH() is used.
10. Which character set variable indicates the character set used for storing identifiers?
Explanation: The server is responsible for maintaining various system variables involved in the character set support. The system variable ‘character_set_system’ indicates the character set used for storing identifiers.
Sanfoundry Global Education & Learning Series – MySQL Database.
To practice all areas of MySQL for Experienced people, here is complete set of 1000+ Multiple Choice Questions and Answers.