NEW
Font size
WorksheetsCS10337 - Lecture # 9
Total questions: 10
Worksheet time: 4mins
Dynamic SQL statements are constructed and executed at runtime rather than being hard-coded.
True
False
Static SQL provides greater flexibility than Dynamic SQL because it can adapt to user input.
True
False
Dynamic SQL is typically implemented in MySQL using the PREPARE, EXECUTE, and DEALLOCATE PREPARE statements.
True
False
Parameterization is one of the most effective defenses against SQL injection in dynamic SQL.
True
False
Using dynamic SQL automatically protects against SQL injection if the syntax is correct.
True
False
Which of the following best describes Dynamic SQL?
SQL code stored permanently in the database.
SQL that is constructed and executed at runtime.
SQL used only for read-only operations.
SQL that cannot include variables.
Which of the following are common use cases for dynamic SQL?
Hardcoding static reports
Fixed database schemas
Generating reports with variable filters
Creating indexes during database installation only
Which of these statements is NOT true about static SQL?
It is hardcoded and known at compile time.
It provides predictable performance.
It can automatically adapt to runtime variables.
It is easier to maintain.
In MySQL, which sequence correctly represents the steps to execute Dynamic SQL?
PREPARE → EXECUTE → COMMIT
PREPARE → EXECUTE → DEALLOCATE PREPARE
PREPARE → EXECUTE → DEALLOCATE
CREATE → EXECUTE → CLOSE
Which of the following is a recommended security measure for using dynamic SQL safely?
Concatenating user input directly into SQL strings
Allowing full DBA privileges to all users
Using parameterized queries and input validation
Storing dynamic SQL inside system tables
