MySQL Stored Procedure MCQs with answers Page - 5

You will find multiple-choice questions (MCQs) related to #MySQL Stored Procedure here. Go through these questions to prepare effectively for your upcoming exams and interviews.

To view the correct answer for any question, simply click the "Show Answer" button.

Have a question to share? Click on "Add Question" to contribute!

A

Admin • 828.70K Points
Coach

Q. Which type of cursor is read-only in MySQL stored procedures?

  • (A) FOR UPDATE
  • (B) SCROLL
  • (C) INSENSITIVE
  • (D) BINARY

A

Admin • 828.70K Points
Coach

Q. What happens when a handler is declared with CONTINUE in a procedure?

  • (A) Procedure execution stops
  • (B) Error is ignored and execution continues
  • (C) Transaction is rolled back automatically
  • (D) Procedure restarts

A

Admin • 828.70K 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 • 828.70K 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 • 828.70K 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 • 828.70K 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 • 828.70K 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 • 828.70K 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 • 828.70K 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 • 828.70K 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
What's Tag

As you may know, questions are organized under broad categories. Each category can include various types of questions. For example, the "History" category might contain questions about the Revolt of 1857, Shivaji Maharaj, Ancient History, Buddhism, and more.

To further refine this organization, we've introduced tags, which act as sub-categories to group questions more specifically.

Verified users can add tags to any question. If you have any suggestions regarding this system, we'd love to hear from you. Contact Us

Learn More