Q1
True / FalseMySQL is an example of a Relational Database Management System (RDBMS).
MySQL is a popular open-source RDBMS used for managing relational databases.
Q2
True / FalseIn MySQL, data is stored in tables that can relate to each other using foreign keys.
An RDBMS like MySQL uses tables and supports relationships through primary keys and foreign keys.
Q3
True / FalseMySQL does not support the SQL language for database management.
MySQL fully supports SQL (Structured Query Language) for database management and operations.
Q4
True / FalseIn MySQL, normalization is a process used to reduce data redundancy
Normalization in MySQL (and other RDBMS) is used to organize data to reduce redundancy and improve data integrity.
Q5
True / FalseMySQL does not provide ACID (Atomicity, Consistency, Isolation, Durability) properties.
MySQL supports ACID properties, particularly when using storage engines like InnoDB, to ensure reliable transactions.
Q6
True / FalseIn MySQL, a schema is a collection of database objects, including tables, views, and procedures.
A schema in MySQL (and other RDBMS) is indeed a logical collection of database objects.
Q7
True / FalseIn MySQL, indexing a column improves the speed of data retrieval operations
Indexes in MySQL enhance the performance of data retrieval operations by allowing faster access to rows.
Q8
True / FalseMySQL uses the concept of foreign key constraints to enforce referential integrity.
Foreign keys in MySQL ensure that the relationships between tables remain consistent and enforce referential integrity.
Q9
True / FalseMySQL can handle only a limited number of transactions at a time.
MySQL, especially with the InnoDB storage engine, is designed to handle a large number of concurrent transactions efficiently.
Q10
True / FalseMySQL supports the use of triggers to automatically perform actions in response to certain events in the database.
Triggers in MySQL are a powerful feature that allows automatic execution of SQL code in response to specified events, such as INSERT, UPDATE, or DELETE.
Q21
Multiple ChoiceWhich of the following SQL statements correctly creates a table named 'students' with 'id' as the primary key in an RDBMS?
SQL Code
CREATE TABLE students (
id INT AUTO_INCREMENT,
name VARCHAR(100),
age INT,
PRIMARY KEY (id)
);
In an RDBMS like MySQL, the primary key uniquely identifies each record in the table. The correct SQL statement should include 'PRIMARY KEY (id)' after defining the column.
Q22
Multiple ChoiceIdentify the correct SQL code that inserts a record into a table named 'employees' ensuring referential integrity.
SQL Code
INSERT INTO employees (id, name, department_id)
VALUES (1, 'John Doe', 3);
INSERT INTO departments (id, name)
VALUES (3, 'Sales');
In an RDBMS, referential integrity is maintained by ensuring that any foreign key value matches a primary key in the related table. The code that ensures this is correct.
Q23
Multiple ChoiceChoose the SQL code snippet that correctly creates a foreign key constraint between two tables in an RDBMS.
SQL Code
CREATE TABLE orders (
order_id INT AUTO_INCREMENT,
customer_id INT,
PRIMARY KEY (order_id),
FOREIGN KEY (customer_id) REFERENCES customers(id)
);
In an RDBMS, a foreign key constraint links two tables by establishing a relationship between columns, usually the primary key of one table and a foreign key in another.
Q24
Multiple ChoiceWhich of the following SQL statements would correctly normalize data by separating it into related tables?
SQL Code
CREATE TABLE students (
id INT AUTO_INCREMENT,
name VARCHAR(100),
address VARCHAR(255),
PRIMARY KEY (id)
);
CREATE TABLE addresses (
address_id INT AUTO_INCREMENT,
address VARCHAR(255),
PRIMARY KEY (address_id)
);
Normalization in RDBMS involves organizing data to reduce redundancy. Splitting the data into related tables is key, such as separating addresses into a distinct table.
Q25
Multiple ChoiceSelect the SQL code that effectively ensures data integrity using constraints in an RDBMS.
SQL Code
CREATE TABLE employees (
id INT AUTO_INCREMENT,
name VARCHAR(100),
department_id INT,
PRIMARY KEY (id),
FOREIGN KEY (department_id) REFERENCES departments(id)
);
CREATE TABLE departments (
id INT AUTO_INCREMENT,
name VARCHAR(100),
PRIMARY KEY (id)
);
Data integrity in RDBMS is maintained through constraints such as primary and foreign keys that enforce rules on the data.
Q26
Multiple ChoiceWhich SQL code ensures the atomicity of transactions in an RDBMS by rolling back on failure?
SQL Code
START TRANSACTION;
INSERT INTO employees (id, name, department_id)
VALUES (5, 'Tom Holland', 2);
INSERT INTO salaries (employee_id, salary)
VALUES (5, 70000);
COMMIT;
Atomicity in RDBMS ensures that all operations within a transaction are completed successfully, or none are, ensuring the database remains consistent.
Q28
Multiple ChoiceChoose the SQL code snippet that correctly implements data redundancy reduction using normalization.
SQL Code
CREATE TABLE students (
id INT AUTO_INCREMENT,
name VARCHAR(100),
class_id INT,
PRIMARY KEY (id)
);
CREATE TABLE classes (
id INT AUTO_INCREMENT,
class_name VARCHAR(100),
PRIMARY KEY (id)
);
Normalization in RDBMS reduces data redundancy by organizing the data into related tables with relationships defined by foreign keys.
Q29
Multiple ChoiceWhat SQL code would you use to enforce unique constraints on a table to prevent duplicate data entries?
SQL Code
CREATE TABLE students (
id INT AUTO_INCREMENT,
name VARCHAR(100),
email VARCHAR(100),
UNIQUE (email),
PRIMARY KEY (id)
);
In RDBMS, a UNIQUE constraint ensures that all values in a column are distinct, preventing duplicate data entries.
Q30
Multiple ChoiceWhich SQL code correctly sets up a relational database structure for an e-commerce application?
SQL Code
CREATE TABLE products (
id INT AUTO_INCREMENT,
name VARCHAR(100),
price DECIMAL(10, 2),
PRIMARY KEY (id)
);
CREATE TABLE orders (
id INT AUTO_INCREMENT,
product_id INT,
quantity INT,
PRIMARY KEY (id),
FOREIGN KEY (product_id) REFERENCES products(id)
);
A relational database in MySQL is organized into tables related by keys. The primary key identifies each record, while foreign keys establish relationships between tables.