Dbms Model Paper
Dbms Model Paper
A) Data integrity
B) Data security
C) Data model
D) Data abstrac on
A) En ty
B) A ribute
C) Rela onship
D) Key
A) Physical level
B) Logical level
C) Conceptual level
D) Applica on level
Ques on 5: Which data model represents data in a hierarchical structure with parent-child
rela onships?
B) ER model
C) Hierarchical model
D) Network model
Ques on 6: Which type of integrity constraint ensures that a primary key value cannot be null?
A) Domain constraint
C) En ty integrity constraint
D) Key constraint
A) En ty
B) A ribute
C) Rela onship
D) Key
Answer: A) En ty
Ques on 8: Which data model represents data as a collec on of objects, along with their a ributes
and methods?
A) Object-Oriented model
D) Hierarchical model
Ques on 9: Which type of key uniquely iden fies a record within its own table?
A) Super key
B) Candidate key
C) Primary key
D) Foreign key
Ques on 12: In the context of func onal dependencies, if a ribute B is func onally dependent on
a ribute A, how is this rela onship denoted?
A) A → B
B) B → A
C) A ↔ B
D) A ⊆ B
Answer: A) A → B
Ques on 13: Which of the following is a key property of a candidate key in a rela onal database?
B) It is a super key.
D) It is a foreign key.
Here are 10 mul ple-choice ques ons along with their answers based on normaliza on in a
database management system (DBMS):
Ques on 2: In which normal form is a rela on if all non-prime a ributes are fully func onally
dependent on the primary key?
Ques on 3: Which normal form ensures that every non-prime a ribute is non-transi vely dependent
on the primary key?
A) First Normal Form (1NF)
Ques on 5: Which normal form is based on func onal dependency and mul valued dependency
concepts?
Ques on 7: In which normal form is a rela on if it is in Second Normal Form (2NF) and has no par al
dependencies?
Ques on 8: Which of the following normal forms allows for the presence of transi ve dependencies?
Ques on 9: Which normal form eliminates transi ve dependencies as well as par al dependencies?
MCQ (PART-1)
Ques on 1:
a) FETCH
b) SELECT
c) GET
d) EXTRACT
Answer: b) SELECT
Ques on 2:
a) FILTER
b) WHERE
c) HAVING
d) LIMIT
Answer: b) WHERE
Ques on 3:
Which SQL func on is used to find the total number of rows in a table?
a) COUNT()
b) SUM()
c) AVG()
d) MAX()
Answer: a) COUNT()
Ques on 4:
a) CREATE
b) INSERT
c) UPDATE
d) ALTER
Answer: b) INSERT
Ques on 5:
Which clause is used to sort the result set in ascending or descending order?
a) ORDER BY
b) SORT BY
c) GROUP BY
d) ARRANGE BY
Answer: a) ORDER BY
Ques on 6:
Ques on 7:
a) UPDATE
b) ALTER
c) MODIFY
d) CHANGE
Answer: a) UPDATE
Ques on 8:
a) UNION
b) JOIN
c) CONNECT
d) COMBINE
Answer: b) JOIN
Ques on 9:
a) HIGH()
b) TOP()
c) MAX()
d) HIGHEST()
Answer: c) MAX()
Ques on 10:
a) DROP
b) DELETE
c) REMOVE
d) ERASE
Answer: a) DROP
Ques on 11:
Ques on 12:
Which SQL operator is used in the WHERE clause to specify mul ple possible values?
a) AND
b) OR
c) NOT
d) XOR
Answer: b) OR
Ques on 13:
a) AVG()
b) AVERAGE()
c) MEAN()
d) TOTAL()
Answer: a) AVG()
Ques on 14:
Ques on 15:
a) ERASE
b) REMOVE
c) DELETE
d) DROP
Answer: c) DELETE
Ques on 16:
Which SQL clause is used to limit the number of rows returned by a query?
a) LIMIT
b) TOP
c) ROWS
d) COUNT
Answer: a) LIMIT
Ques on 17:
Ques on 18:
b) SMALL()
c) LEAST()
d) BOTTOM()
Answer: a) MIN()
Ques on 19:
a) NEW DATABASE
b) CREATE DATABASE
c) ADD DATABASE
d) MAKE DATABASE
Ques on 20:
MCQ ( PART-2)
Ques on 1:
Which SQL join type returns all rows from both tables, filling in NULL values for non-matching rows?
a) INNER JOIN
b) LEFT JOIN
c) RIGHT JOIN
Ques on 2:
Which SQL clause is used to define condi ons for a specific group of rows?
a) WHERE
b) HAVING
c) GROUP WHERE
d) FILTER
Answer: b) HAVING
Ques on 3:
Ques on 4:
a) ALTER TABLE
b) MODIFY TABLE
c) ADD COLUMN
d) INSERT COLUMN
Ques on 5:
a) FORMAT()
b) DATE_FORMAT()
c) TO_CHAR()
d) CONVERT()
Answer: b) DATE_FORMAT()
Ques on 6:
Answer: b) To assign a unique sequen al integer to each row in the result set
Ques on 7:
a) DELETE CONSTRAINT
b) DROP CONSTRAINT
c) REMOVE CONSTRAINT
d) ALTER CONSTRAINT
Ques on 9:
Which SQL data type would you use to store large amounts of text data?
a) VARCHAR
b) TEXT
c) STRING
d) CHAR
Answer: b) TEXT
Ques on 10:
Ques on 11:
Ques on 12:
Which SQL func on is used to calculate the total cumula ve sum of a column's values?
a) SUM()
b) TOTAL()
c) CUMSUM()
d) ROLLUP()
Answer: c) CUMSUM()
Ques on 13:
Ques on 14:
Which SQL statement is used to change data in mul ple rows at once?
a) UPDATE
b) ALTER
c) MODIFY
d) SET
Answer: a) UPDATE
Ques on 15:
Which SQL clause is used to restrict the number of rows returned by a query based on a specific
range?
a) LIMIT
b) OFFSET
c) FETCH
d) ROWS
Answer: b) OFFSET
Ques on 16:
Ques on 17:
a) ADD INDEX
b) CREATE INDEX
c) INDEX TABLE
d) MAKE INDEX
Ques on 18:
What is the purpose of the SQL RANK() func on?
Ques on 19:
a) DELETE TABLE
b) REMOVE TABLE
c) DROP TABLE
d) ERASE TABLE
Ques on 20:
Tables:
Ques on 1:
Which SQL query would you use to retrieve the names of all students born a er January 1, 2000?
Answer: a) SELECT first_name, last_name FROM Students WHERE date_of_birth > '2000-01-01';
Ques on 2:
```sql
FROM Courses
GROUP BY course_name;
```
a) Retrieve a list of course names and the number of enrollments for each course.
b) Retrieve a list of course names and the total count of courses.
d) Retrieve a list of course names and the number of students enrolled in each course.
Answer: a) Retrieve a list of course names and the number of enrollments for each course.
Ques on 3:
Which SQL statement is used to add a new student to the "Students" table?
a) INSERT INTO Students (student_id, first_name, last_name, date_of_birth) VALUES (1, 'John', 'Doe',
'2002-05-15');
b) UPDATE Students SET first_name = 'John', last_name = 'Doe', date_of_birth = '2002-05-15' WHERE
student_id = 1;
d) ADD INTO Students (student_id, first_name, last_name, date_of_birth) VALUES (1, 'John', 'Doe',
'2002-05-15');
Answer: a) INSERT INTO Students (student_id, first_name, last_name, date_of_birth) VALUES (1,
'John', 'Doe', '2002-05-15');
Ques on 4:
Which SQL query would you use to find the student with the highest number of enrollments?
c) SELECT first_name, last_name FROM Students WHERE student_id = (SELECT MAX(COUNT()) FROM
Enrollments);
FROM Students
GROUP BY Students.student_id
LIMIT 1;
Which SQL query would you use to retrieve the course names that have no enrollments?
a) SELECT course_name FROM Courses WHERE course_id NOT IN (SELECT course_id FROM
Enrollments);
Ques on 6:
```sql
FROM Courses
GROUP BY department
```
b) Retrieves the departments with an average course credit greater than 3.0.
c) Retrieves all courses and departments with an average credit greater than 3.0.
d) Retrieves all departments and their average course credit, regardless of value.
Answer: b) Retrieves the departments with an average course credit greater than 3.0.
Ques on 7:
Which SQL statement would you use to remove a student from the "Students" table?
Ques on 8:
Which SQL query would you use to find the names of students who are enrolled in more than two
courses?
a) SELECT first_name, last_name FROM Students WHERE student_id IN (SELECT student_id FROM
Enrollments GROUP BY student_id HAVING COUNT() > 2);
c) SELECT first_name, last_name FROM Students WHERE student_id IN (SELECT student_id FROM
Enrollments WHERE COUNT() > 2);
d) SELECT first_name, last_name FROM Students WHERE student_id IN (SELECT student_id FROM
Enrollments HAVING COUNT() > 2);
Ques on 9:
Which SQL query would you use to update the department of a specific course?
Answer: a) UPDATE Courses SET department = 'Mathema cs' WHERE course_id = 101;
Ques on 10:
```sql
GROUP BY course_name;
```
a) Retrieve a list of course names and the number of students enrolled in each course.
d) Retrieve a list of course names and the number of enrollments for each course.
Answer: a) Retrieve a list of course names and the number of students enrolled in each course.
Ques on 11:
Which SQL query would you use to find the student who has enrolled in the most courses?
a) SELECT student_id FROM Enrollments GROUP BY student_id ORDER BY COUNT() DESC LIMIT 1;
b) SELECT student_id FROM Enrollments GROUP BY student_id ORDER BY COUNT() ASC LIMIT 1;
Ques on 12:
```sql
FROM Students
```
a) Retrieve the names of students who are not enrolled in any course.
b) Retrieve the names of students who are enrolled in at least one course.
c) Retrieve the names of students who have the highest student_id value.
d) Retrieve the names of students who have enrolled in all available courses.
Answer: a) Retrieve the names of students who are not enrolled in any course.
Ques on 13:
Which SQL query would you use to retrieve the course names and the total credits of all courses?
Here are 10 mul ple-choice ques ons based on a hypothe cal "Bank" database schema along with
their answers:
Tables:
3. Transac ons (transac on_id, account_id, transac on_date, amount, transac on_type)
Ques on 1:
Which SQL query would you use to retrieve the total balance of all accounts for a specific customer?
Ques on 2:
```sql
FROM Customers
```
a) Retrieve the names of customers who have made withdrawals and the number of withdrawals
each.
b) Retrieve the names of customers who have made deposits and the number of deposits each.
c) Retrieve the names of customers who have made transac ons and the total count of transac ons.
d) Retrieve the names of customers who have made withdrawals and the total count of withdrawals.
Answer: a) Retrieve the names of customers who have made withdrawals and the number of
withdrawals each.
Ques on 3:
Which SQL statement would you use to add a new customer to the "Customers" table?
a) INSERT INTO Customers (customer_id, first_name, last_name, date_of_birth) VALUES (101, 'John',
'Doe', '1990-03-15');
d) ADD INTO Customers (customer_id, first_name, last_name, date_of_birth) VALUES (101, 'John',
'Doe', '1990-03-15');
Answer: a) INSERT INTO Customers (customer_id, first_name, last_name, date_of_birth) VALUES
(101, 'John', 'Doe', '1990-03-15');
Ques on 4:
Answer: c) To combine data from two or more tables based on a related column
Ques on 5:
Which SQL query would you use to find the average balance of accounts for each account type?
Ques on 6:
```sql
FROM Accounts
GROUP BY account_id
```
a) Retrieve the account IDs and their highest balances for accounts with balances over 10000.
b) Retrieve the account IDs and their highest balances for all accounts.
c) Retrieve the account IDs and their highest balances for accounts with balances less than 10000.
d) Retrieve the account IDs and the sum of balances for accounts with balances over 10000.
Answer: a) Retrieve the account IDs and their highest balances for accounts with balances over
10000.
Ques on 7:
Which SQL query would you use to find the account IDs with the most transac ons?
a) SELECT account_id FROM Transac ons GROUP BY account_id ORDER BY COUNT() DESC LIMIT 1;
c) SELECT account_id FROM Transac ons GROUP BY account_id ORDER BY COUNT() ASC LIMIT 1;
Ques on 8:
Ques on 9:
Which SQL query would you use to retrieve the account IDs and the total amount deposited for each
account?
a) SELECT account_id, SUM(amount) as total_deposits FROM Transac ons WHERE transac on_type =
'Deposit' GROUP BY account_id;
Ques on 10:
```sql
FROM Customers
GROUP BY customer_id
```
a) Retrieve the IDs of customers with an average account balance greater than 5000.
b) Retrieve the IDs of customers with a total account balance greater than 5000.
c) Retrieve the IDs of customers with an average account balance less than 5000.
d) Retrieve the IDs of customers with an average transac on amount greater than 5000.
Answer: a) Retrieve the IDs of customers with an average account balance greater than 5000.
Here are 10 more mul ple-choice ques ons based on a hypothe cal "Hospital Management"
database schema along with their answers:
Tables:
Ques on 11:
Which SQL query would you use to retrieve the names of all female pa ents born a er 1990?
a) SELECT first_name, last_name FROM Pa ents WHERE gender = 'Female' AND date_of_birth >
'1990-01-01';
b) SELECT first_name, last_name FROM Pa ents WHERE gender = 'Female' OR date_of_birth > '1990-
01-01';
c) SELECT first_name, last_name FROM Pa ents WHERE gender = 'Female' AND date_of_birth <
'1990-01-01';
d) SELECT first_name, last_name FROM Pa ents WHERE gender = 'Female' AND date_of_birth >
'1990-12-31';
Answer: a) SELECT first_name, last_name FROM Pa ents WHERE gender = 'Female' AND
date_of_birth > '1990-01-01';
Ques on 12:
```sql
FROM Doctors
GROUP BY specializa on
```
d) Retrieve the specializa on of doctors with more than 5 doctors in that specializa on.
Answer: d) Retrieve the specializa on of doctors with more than 5 doctors in that specializa on.
Ques on 13:
Which SQL statement would you use to add a new pa ent to the "Pa ents" table?
a) INSERT INTO Pa ents (pa ent_id, first_name, last_name, date_of_birth, gender) VALUES (101,
'Alice', 'Johnson', '1985-08-15', 'Female');
c) INSERT Pa ents (first_name, last_name, date_of_birth, gender) VALUES ('Alice', 'Johnson', '1985-
08-15', 'Female');
d) ADD INTO Pa ents (pa ent_id, first_name, last_name, date_of_birth, gender) VALUES (101, 'Alice',
'Johnson', '1985-08-15', 'Female');
Answer: a) INSERT INTO Pa ents (pa ent_id, first_name, last_name, date_of_birth, gender) VALUES
(101, 'Alice', 'Johnson', '1985-08-15', 'Female');
Ques on 14:
Ques on 15:
Which SQL query would you use to find the average experience of doctors in each specializa on?
Ques on 16:
Ques on 17:
Which SQL query would you use to retrieve the names of pa ents who have appointments?
b) SELECT first_name, last_name FROM Pa ents WHERE pa ent_id IN (SELECT pa ent_id FROM
Appointments);
c) SELECT first_name, last_name FROM Pa ents WHERE pa ent_id NOT IN (SELECT pa ent_id FROM
Appointments);
d) SELECT first_name, last_name FROM Pa ents JOIN Appointments WHERE Pa ents.pa ent_id =
Appointments.pa ent_id;
Answer: b) SELECT first_name, last_name FROM Pa ents WHERE pa ent_id IN (SELECT pa ent_id
FROM Appointments);
Ques on 18:
Which SQL query would you use to find the pa ent who has the most appointments?
a) SELECT pa ent_id FROM Appointments GROUP BY pa ent_id ORDER BY COUNT() DESC LIMIT 1;
c) SELECT pa ent_id FROM Appointments GROUP BY pa ent_id ORDER BY COUNT() ASC LIMIT 1;
Ques on 19:
Answer: c) It combines data from two or more tables based on a related column.
Ques on 20:
Which SQL query would you use to retrieve the doctor names and the total number of appointments
for each doctor?
Here are 3 mul ple-choice ques ons based on a hypothe cal "Airline" database schema along
with their answers:
Tables:
Which SQL query would you use to retrieve the list of passengers who have booked flights depar ng
from "New York"?
Ques on 2:
```sql
FROM Flights
GROUP BY flight_number
```
a) Retrieve the flight numbers of flights with more than 100 passengers.
c) Retrieve the flight numbers of flights with fewer than 100 passengers.
d) Retrieve the flight numbers of flights with an average of more than 100 passengers.
Answer: a) Retrieve the flight numbers of flights with more than 100 passengers.
Ques on 3:
Which SQL statement would you use to add a new flight to the "Flights" table?
b) UPDATE Flights SET flight_number = 'AB123', departure_city = 'Los Angeles', arrival_city = 'New
York', departure_ me = '2023-09-01 08:00:00', arrival_ me = '2023-09-01 15:00:00' WHERE flight_id
= 101;
c) INSERT Flights (flight_number, departure_city, arrival_city, departure_ me, arrival_ me) VALUES
('AB123', 'Los Angeles', 'New York', '2023-09-01 08:00:00', '2023-09-01 15:00:00');
Answer: a) INSERT INTO Flights (flight_id, flight_number, departure_city, arrival_city, departure_ me,
arrival_ me) VALUES (101, 'AB123', 'Los Angeles', 'New York', '2023-09-01 08:00:00', '2023-09-01
15:00:00');
here are 5 mul ple-choice ques ons based on a simplified "Bank" database schema along with
sample table data. Please note that this is a simplified schema and sample data for illustra ve
purposes:
Tables:
3. Transac ons (transac on_id, account_id, transac on_date, amount, transac on_type)
Sample Data:
Customers Table
Accounts Table
|------------|-------------|--------------|---------|
|----------------|------------|------------------------|--------|------------------|
Ques on 1:
Which SQL query would you use to retrieve the first name and last name of customers with a balance
greater than 6000?
Answer: a) SELECT first_name, last_name FROM Customers WHERE balance > 6000;
Ques on 2:
FROM Accounts
GROUP BY account_type
```
Answer: b) Retrieve the account types with more than one account.
Ques on 3:
Which SQL statement would you use to add a new transac on to the "Transac ons" table?
a) INSERT INTO Transac ons (transac on_id, account_id, transac on_date, amount,
transac on_type) VALUES (401, 201, '2023-08-05 11:30:00', 300, 'Deposit');
b) UPDATE Transac ons SET transac on_id = 401, account_id = 201, transac on_date = '2023-08-05
11:30:00', amount = 300, transac on_type = 'Deposit' WHERE transac on_id = 401;
c) INSERT Transac ons (account_id, transac on_date, amount, transac on_type) VALUES (201,
'2023-08-05 11:30:00', 300, 'Deposit');
d) ADD INTO Transac ons (transac on_id, account_id, transac on_date, amount, transac on_type)
VALUES (401, 201, '2023-08-05 11:30:00', 300, 'Deposit');
Answer: a) INSERT INTO Transac ons (transac on_id, account_id, transac on_date, amount,
transac on_type) VALUES (401, 201, '2023-08-05 11:30:00', 300, 'Deposit');
Ques on 4:
Ques on 5:
Which SQL query would you use to find the average balance of customers for each account type?