MySQL Database Quiz Questions

Course Name:MySQL
Chapter Name:Chapter 7 - DQL (Data Query Language)
Lesson Content Link:STRING functions
Current Quiz Count:30
Progress
0%
Q1
True / False

MySQL's CONCAT function can concatenate more than two strings.

Q2
True / False

The LOWER function in MySQL converts a string to uppercase.

Q3
True / False

In MySQL, LENGTH function returns the length of a string in characters.

Q4
True / False

MySQL's TRIM function can remove specified characters from both ends of a string.

Q5
True / False

The INSTR function in MySQL is case-sensitive when searching for a substring within a string.

Q6
True / False

In MySQL, the RPAD function adds characters to the right side of a string until it reaches a specified length.

Q7
True / False

The CHAR_LENGTH function in MySQL returns the number of bytes in a string.

Q8
True / False

MySQL's SUBSTRING_INDEX function can be used to extract a substring from a string, based on a delimiter.

Q9
True / False

In MySQL, the REPLACE function can replace all occurrences of a substring within a string.

Q10
True / False

The REGEXP operator in MySQL can be used for case-insensitive pattern matching by default.

Q11
Single Choice

Which MySQL function is used to return the length of a string?

Q12
Single Choice

How do you convert a string to uppercase in MySQL?

Q13
Single Choice

Which function in MySQL is used to extract a substring from a string?

Q14
Single Choice

Given the SQL query SELECT LEFT('Hello World', 5);, what is the output?

Q15
Single Choice

What does the SUBSTRING_INDEX() function do?

Q16
Single Choice

How do you replace occurrences of 'old' with 'new' in a string using MySQL?

Q17
Single Choice

Given the query SELECT REPEAT('Hi!', 3);, what is the result?

Q18
Single Choice

How can you extract the last 3 characters from the string 'abcdef' in MySQL?

Q19
Single Choice

Which MySQL function would you use to find the position of the first occurrence of 'X' in the string 'Hello World'?

Q20
Single Choice

Which function returns the part of the string starting from the 4th character up to the end in MySQL?

Q21
Multiple Choice

Which SQL query uses the CONCAT() function to concatenate first name and last name into a full name?

SQL Code
SELECT CONCAT(first_name, ' ', last_name) AS full_name
FROM employees;
Q22
Multiple Choice

Identify the SQL query that uses the SUBSTRING() function to extract the first 3 characters of the product name.

SQL Code
SELECT SUBSTRING(product_name, 1, 3) AS short_name
FROM products;
Q23
Multiple Choice

Which SQL query uses the REPLACE() function to replace spaces in product names with underscores?

SQL Code
SELECT REPLACE(product_name, ' ', '_') AS modified_name
FROM products;
Q24
Multiple Choice

Determine the SQL query that uses the LOWER() function to convert product names to lowercase.

SQL Code
SELECT LOWER(product_name) AS lowercase_name
FROM products;
Q25
Multiple Choice

Which SQL query uses the UPPER() function to convert customer names to uppercase?

SQL Code
SELECT UPPER(customer_name) AS uppercase_name
FROM customers;
Q26
Multiple Choice

Which SQL query uses the LENGTH() function to find the length of the product names?

SQL Code
SELECT product_name, LENGTH(product_name) AS name_length
FROM products;
Q27
Multiple Choice

Identify the SQL query that uses the INSTR() function to find the position of the first occurrence of 'a' in the product name.

SQL Code
SELECT product_name, INSTR(product_name, 'a') AS position
FROM products;
Q28
Multiple Choice

Which SQL query uses the TRIM() function to remove leading and trailing spaces from product names?

SQL Code
SELECT TRIM(product_name) AS trimmed_name
FROM products;
Q29
Multiple Choice

Determine the SQL query that uses the LPAD() function to left-pad product names with asterisks (*) to a total length of 10 characters.

SQL Code
SELECT LPAD(product_name, 10, '*') AS padded_name
FROM products;
Q30
Multiple Choice

Which SQL query uses the REVERSE() function to reverse the characters in the customer name?

SQL Code
SELECT REVERSE(customer_name) AS reversed_name
FROM customers;