Database Programming Quiz
Question 1: SQLite3 Connection
Which method is used to create a new SQLite3 database connection in Ruby?
Question 2: Prepared Statements
What is the main benefit of using prepared statements in database programming?
Question 3: PostgreSQL Connection
Which gem is commonly used to connect to PostgreSQL databases in Ruby?
Question 4: MySQL Connection
What is the recommended gem for connecting to MySQL databases in Ruby?
Question 5: Sequel ORM Datasets
In Sequel ORM, how do you chain conditions to filter records?
Question 6: Transaction Management
What happens when an exception is raised inside a database transaction block?
Question 7: SQL Injection Prevention
Which of the following is the safest way to include user input in SQL queries?
Question 8: Sequel Associations
In Sequel models, which association type represents a "belongs to" relationship?
Question 9: Connection Pooling
What is the primary benefit of using connection pooling in database applications?
Question 10: Raw SQL vs ORM
When might you choose raw SQL over an ORM like Sequel?
Question 11: Database Migrations
What is the primary purpose of database migrations?
Question 12: Sequel Dataset Operations
What does the following Sequel code do: DB[:users].where(age: 25..35).order(:name).limit(10)?