MySQL MCQs with answers Page - 181

Here, you will find a collection of MCQ questions on MySQL. Go through these questions to enhance your preparation for upcoming examinations and interviews.

To check the correct answer, simply click the View Answer button provided for each question.

Have your own questions to contribute? Click the button below to share your MCQs with others!

+ Add Question

A

Admin • 831.35K Points
Coach

Q. Which statement inside a stored procedure fetches the next row from a cursor?

  • (A) NEXT cursor_name
  • (B) FETCH cursor_name INTO variable
  • (C) GET cursor_name
  • (D) SELECT cursor_name

A

Admin • 831.35K Points
Coach

Q. Which SQLSTATE value is commonly used to detect 'no data found' in cursors?

  • (A) 02000
  • (B) 23000
  • (C) 42000
  • (D) HY000

A

Admin • 831.35K Points
Coach

Q. Which clause allows a procedure to execute with the privileges of the creator instead of the caller?

  • (A) SECURITY INVOKER
  • (B) SECURITY DEFINER
  • (C) EXECUTE AS OWNER
  • (D) PRIVILEGE DEFINER

A

Admin • 831.35K Points
Coach

Q. Which statement in a procedure is used to explicitly terminate execution and return control?

  • (A) EXIT
  • (B) STOP
  • (C) RETURN
  • (D) END

A

Admin • 831.35K Points
Coach

Q. Which type of handler stops procedure execution after handling an error?

  • (A) EXIT handler
  • (B) CONTINUE handler
  • (C) IGNORE handler
  • (D) STOP handler

A

Admin • 831.35K Points
Coach

Q. Can a stored procedure call itself recursively in MySQL?

  • (A) Yes
  • (B) No
  • (C) Only if it has no parameters
  • (D) Only if IN parameters are used

A

Admin • 831.35K Points
Coach

Q. Which statement is used to define a label for loops in stored procedures?

  • (A) LABEL loop_name
  • (B) DECLARE label_name
  • (C) loop_name: LOOP ... END LOOP
  • (D) SET loop_name

A

Admin • 831.35K Points
Coach

Q. Which statement is used to exit from a specific labeled loop?

  • (A) EXIT loop_name
  • (B) BREAK loop_name
  • (C) LEAVE loop_name
  • (D) STOP loop_name

A

Admin • 831.35K Points
Coach

Q. What is the difference between INOUT and OUT parameters?

  • (A) INOUT can accept input and return output, OUT only returns output
  • (B) INOUT only accepts input, OUT only returns output
  • (C) INOUT only returns output, OUT only accepts input
  • (D) No difference

A

Admin • 831.35K Points
Coach

Q. Can stored procedures execute dynamic SQL in MySQL?

  • (A) Yes, using PREPARE and EXECUTE
  • (B) No, only functions can execute dynamic SQL
  • (C) Yes, using CALL statement
  • (D) No, MySQL does not allow dynamic SQL