Q1
True / FalseMySQL's CONCAT function can concatenate more than two strings.
The CONCAT function in MySQL can concatenate multiple strings, not limited to just two.
Q2
True / FalseThe LOWER function in MySQL converts a string to uppercase.
The LOWER function converts a string to lowercase. The function to convert a string to uppercase is UPPER.
Q3
True / FalseIn MySQL, LENGTH function returns the length of a string in characters.
The LENGTH function returns the number of characters in a string.
Q4
True / FalseMySQL's TRIM function can remove specified characters from both ends of a string.
The TRIM function can remove specified leading and trailing characters from a string.
Q5
True / FalseThe INSTR function in MySQL is case-sensitive when searching for a substring within a string.
The INSTR function is case-sensitive. For case-insensitive searches, the LOCATE function can be used.
Q6
True / FalseIn MySQL, the RPAD function adds characters to the right side of a string until it reaches a specified length.
The RPAD function pads the right side of a string with specified characters to reach a certain length.
Q7
True / FalseThe CHAR_LENGTH function in MySQL returns the number of bytes in a string.
The CHAR_LENGTH function returns the number of characters in a string, not bytes. The LENGTH function returns the number of bytes.
Q8
True / FalseMySQL's SUBSTRING_INDEX function can be used to extract a substring from a string, based on a delimiter.
The SUBSTRING_INDEX function extracts a substring from a string before a specified number of occurrences of a delimiter.
Q9
True / FalseIn MySQL, the REPLACE function can replace all occurrences of a substring within a string.
The REPLACE function replaces all occurrences of a specified substring with another substring within a string.
Q10
True / FalseThe REGEXP operator in MySQL can be used for case-insensitive pattern matching by default.
By default, the REGEXP operator in MySQL is case-sensitive. To perform case-insensitive pattern matching, the REGEXP BINARY operator or a case-insensitive collation can be used.
Q21
Multiple ChoiceWhich 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;
The CONCAT() function is used to concatenate two or more strings into a single string, separated by the specified delimiter.
Q22
Multiple ChoiceIdentify 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;
The SUBSTRING() function is used to extract a part of a string, starting from a specified position for a specified length.
Q23
Multiple ChoiceWhich 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;
The REPLACE() function is used to replace all occurrences of a specified substring within a string with another substring.
Q29
Multiple ChoiceDetermine 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;
The LPAD() function left-pads a string with another string (repeatedly, if needed) until the string reaches the specified length.