MySQL Questions and Answers – Data Value Categories – 2

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.
a) True
b) False
View Answer

Answer: b
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 ___________
a) ‘\c’
b) ‘\r’
c) ‘\b’
d) ‘\z’
View Answer

Answer: b
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?
a) NO_ESCAPES_SLASH
b) NO_ESCAPES_BACKSLASH
c) NO_BACKSLASH_ESCAPES
d) NO_BACKSLASH_ESCAPE
View Answer

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

4. x’ffff’ in decimal is ___________
a) 65534
b) 66535
c) 65536
d) 65537
View Answer

Answer: c
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
View Answer

Answer: a
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.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

6. The number of legal hexadecimal values among 0x0a, 0x0A, 0X0a and 0X0A is ___________
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: b
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.
a) True
b) False
View Answer

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

8. What is used to produce a new string from an old string in the desired character set?
a) Introducers
b) CONVERT()
c) CONVERTER()
d) CONVERTS()
View Answer

Answer: b
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 __________
a) CHAR_LENGTH()
b) LENGTH()
c) LEN()
d) SIZE()
View Answer

Answer: b
Explanation: The LENGTH() operator is used to measure the length of a MySQL string in terms of bytes. To measure the length of the string in terms of number of characters, CHAR_LENGTH() is used.
advertisement

10. Which character set variable indicates the character set used for storing identifiers?
a) character_set_system
b) character_set_server
c) collation_server
d) character_set_database
View Answer

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

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.