Site icon i2tutorials

MySQL Functions and Stored Procedures – Quiz

This Quiz contains totally 25 Questions each carry 1 point for you.

1. Which MySQL function can be used to concatenate two or more strings? 

 

 

 
SUBSTRING
CONCAT
LENGTH
REPLACE

Correct!

Wrong!

2. Which MySQL function returns the length of a string?
CHAR_LENGTH
LENGTH
SUBSTRING
CONCAT

Correct!

Wrong!

3. What MySQL function can be used to convert a string to uppercase? 

 

 

 
UPPER
LCASE
INITCAP
UCASE

Correct!

Wrong!

4. Which MySQL function is used to round a numeric value to the nearest integer? 

 

 

 
FLOOR
CEIL
ROUND
TRUNCATE

Correct!

Wrong!

5. Which MySQL function extracts the month from a date?
DATE_FORMAT
EXTRACT
MONTH
DAY

Correct!

Wrong!

6. Which MySQL function returns the current date and time? 

 

 

 
NOW
CURDATE
CURTIME
CURRENT_TIMESTAMP

Correct!

Wrong!

7. What is the purpose of the DATE_FORMAT function in MySQL?
Converts a date to a string format
Extracts the year from a date
Calculates the difference between two dates
Rounds a date to the nearest month

Correct!

Wrong!

8. Which MySQL function can be used to find the minimum value in a set of values?
MAX
MIN
AVG
SUM

Correct!

Wrong!

9. What is a stored procedure in MySQL?
A function that returns a result
A temporary table used for storing data
A sequence of SQL statements that can be saved and executed later
A constraint that enforces data integrity rules

Correct!

Wrong!

10. Which keyword is used to create a stored procedure in MySQL? 

 

 

 
PROCEDURE
FUNCTION
CREATE
DECLARE

Correct!

Wrong!

11.How can you execute a stored procedure in MySQL?
Using the EXECUTE statement
Using the SELECT statement
Using the CALL statement
Using the RUN statement

Correct!

Wrong!

12. What is the purpose of parameters in a stored procedure?
They define the data type of variables used in the procedure
They pass values into and out of the procedure
They define the execution order of statements in the procedure
They determine the access privileges for the procedure

Correct!

Wrong!

13. Which statement is used to drop a stored procedure in MySQL?
DROP PROCEDURE
DELETE PROCEDURE
REMOVE PROCEDURE
DESTROY PROCEDURE

Correct!

Wrong!

14. What is the purpose of the RETURN statement in a stored procedure? 

 

 

 
It returns a value from the stored procedure
It terminates the execution of the stored procedure
It defines the input parameters for the stored procedure
It specifies the data type of the stored procedure

Correct!

Wrong!

15. Which MySQL function can be used to generate a random number? 

 

 

 
RAND
RANDOM
RANDOMIZE
RND

Correct!

Wrong!

16. How can you view the definition of a stored procedure in MySQL? 

 

 

 
SHOW PROCEDURE STATUS
DESCRIBE PROCEDURE
SHOW CREATE PROCEDURE
SELECT PROCEDURE_DEFINITION

Correct!

Wrong!

17. Which MySQL function is used to perform string substitution? 

 

 

 
REPLACE
CONCAT
SUBSTRING
REVERSE

Correct!

Wrong!

18. What is the purpose of the IF statement in a stored procedure?
It allows branching based on a condition.
It defines a loop that repeats until a condition is met.
It raises an error and rolls back changes if a condition is not met.
It calls another stored procedure based on a condition.

Correct!

Wrong!

19. Which MySQL function can be used to extract a substring from a string? 

 

 

 
SUBSTRING
REPLACE
CHAR_LENGTH
INSTR

Correct!

Wrong!

20. How can you debug a stored procedure in MySQL? 

 

 

 
Use the PRINT statement to display values.
Use the DEBUG statement to step through the code.
Use the LOG statement to write messages to a log file. .
Use the TRACE statement to track variable values

Correct!

Wrong!

21. What is the purpose of the COUNT() function in MySQL?
It returns the total number of rows in a table.
It calculates the average value of a column.
It finds the minimum value in a column.
It sums up the values in a column.

Correct!

Wrong!

22. Which MySQL function can be used to format a date and time as a string? 

 

 

 
DATE_FORMAT
DATE_ADD
DATE_SUB
DATEDIFF

Correct!

Wrong!

23. What is the purpose of the DATEDIFF() function in MySQL? 

 

 

 
It calculates the difference between two dates.
It adds a specified number of days to a date.
It extracts the year from a date.
It determines the day of the week for a given date.

Correct!

Wrong!

24. Which MySQL function can be used to extract the year from a date? 

 

 

 
YEAR
MONTH
DAY
HOUR

Correct!

Wrong!

25. What is the purpose of the TRIM() function in MySQL?
It removes leading and trailing spaces from a string.
It converts a string to lowercase.
It concatenates two or more strings.
It returns the length of a string.

Correct!

Wrong!

Share the quiz to show your results !

Subscribe to see your results

Ignore & go to results

MySQL Functions and Stored Procedures – Quiz

You got %%score%% of %%total%% right

%%description%%

%%description%%

Loading...

Exit mobile version