uiz Space

September 2024 term · Database Management Systems · BSCS2001

Database Management Systems Quiz 1: 27 October 2024 (September 2024 term)

The IIT Madras BS Database Management Systems (DBMS) Quiz 1 paper sat on 27 Oct 2024, in the September 2024 term: 14 questions for 50 marks in 120 minutes. Every question is below with its answer. Take it as a timed mock test to be marked, or read it through first.

Questions
14
Marks
50
Duration
120 min
MCQ
8
MSQ
4
Numerical
2

Updated

Official paper: IIT M DIPLOMA AN EXAM QDD2 27 Oct 2024 · No negative marking.

Question 1

+2 marksOne correct option

Which of the following is the correct sequence for query processing?

  1. A

    Query → Parser and Translator → Evaluation Engine → Optimizer → Query Output

  2. B

    Query → Optimizer → Evaluation Engine → Parser and Translator → Query Output

  3. C

    Query → Parser and Translator → Optimizer → Evaluation Engine → Query Output

  4. D

    Query → Evaluation Engine → Parser and Translator → Optimizer → Query Output

Show answer

Correct answer

  • C

    Query → Parser and Translator → Optimizer → Evaluation Engine → Query Output

Question 2

+2 marksOne correct option
  1. A

    1-A, 2-B, 3-C

  2. B

    1-B, 2-A, 3-C

  3. C

    1-B, 2-C, 3-A

  4. D

    1-C, 2-A, 3-B

Show answer

Correct answer

  • B

    1-B, 2-A, 3-C

Question 3

+4 marksOne correct option

A relational database contains two separate tables called Employee and Department.
The Employee table has the attributes (Emp_ID, Name, Dept_ID, Salary) and the Department table contains the attributes (Dept_ID, Dept_Name).
The following insert statements were executed to populate the tables:

sql
Insert into Employee values(001,'Mark',1,80000)
Insert into Employee values(002,'Finn',2,60000)
Insert into Employee values(003,'Rory',1,90000)
Insert into Department values(1,'Forensics')
Insert into Department values(2,'Cyber Crime')

How many rows and columns will be returned by the following SQL query?

sql
select *
from Employee, Department
where salary>65000
  1. A

    4 rows and 6 columns

  2. B

    2 rows and 5 columns

  3. C

    4 rows and 5 columns

  4. D

    2 rows and 6 columns

Show answer

Correct answer

  • A

    4 rows and 6 columns

Question 4

+4 marksOne correct option

The relation Students(Name, Total_Marks) contains the names and marks of different students where no two students have the same name or total marks. What will the following SQL query return?

sql
select name
from Students as S
where (select count(*)
from Students as T
where T.Total_Marks>S.Total_Marks)<3
  1. A

    Names of the students with the first four highest marks

  2. B

    Name of the student with the 4th highest mark

  3. C

    Names of the students with the first three highest marks

  4. D

    Name of the student with the 3rd highest mark

Show answer

Correct answer

  • C

    Names of the students with the first three highest marks

Question 5

+4 marksOne correct option

Consider the table Faculty(ID, Name, Department, Salary) and the two queries Q1 and Q2 given below. Our goal is to find the IDs of faculty members whose salary is greater than the highest salary in the Computer Science department. Assume that 'Computer Science' department has more than one faculty member. Which of the following queries will give the required output?

Q1:

sql
select F.ID
from Faculty as F
where F.salary>All(select distinct salary
from Faculty as T
where T.department='Computer Science')

Q2:

sql
select F.ID
from Faculty as F
where not exists(select *
from Faculty as T
where T.department='Computer Science' and T.salary>=F.salary)
  1. A

    Q1 is correct but Q2 is wrong

  2. B

    Q2 is correct but Q1 is wrong

  3. C

    Both Q1 and Q2 are wrong

  4. D

    Both Q1 and Q2 are correct

Show answer

Correct answer

  • D

    Both Q1 and Q2 are correct

Question 6

+4 marksOne or more correct options

Consider the following Entity Relationship Diagram:

Choose the correct statements.

Select all that apply.

  1. A

    An employee can work on more than one project.

  2. B

    A project can have employees from more than one department, working on it.

  3. C

    A dependent, who is not dependent on any employee, can exist.

  4. D

    Every department must have at least one employee working in it.

Show answer

Correct answers

  • A

    An employee can work on more than one project.

  • B

    A project can have employees from more than one department, working on it.

  • D

    Every department must have at least one employee working in it.

Question 7

+4 marksOne or more correct options

We want to create the table nominee by using following SQL statements:

sql
CREATE TABLE nominee (
nominee_id VARCHAR(20) PRIMARY KEY,
NomineeName VARCHAR(20),
relationship VARCHAR(20),
ins_id VARCHAR(20),
FOREIGN KEY (ins_id) REFERENCES insurance(ins_id) ON DELETE CASCADE);

Which of the following is/are the correct SQL statement that can be used to create table insurance?

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • C
  • D

Question 8

+4 marksNumerical answer

Consider relations Book and Author shown in Table 1 and Table 2

BookIDTitleAuthorIDGenre
1Harry Potter and the Sorcerer's Stone101Fantasy
2Pride and Prejudice103Fiction
3The Great Gatsby104Fiction
4The chamber of secrets101Adventure
5The Catcher in the Rye103Fiction
61984101Dystopian

Table 1: Book Table

AuthorIDName
101J.K. Rowling
102F. Scott Fitzgerald
103Jane Austen
104Herman Melville

Table 2: Author Table

How many tuples are returned by the following relational algebra expression?

∏Title(σGenre=’Fiction’(Book)⋈σName=’JaneAusten’(Author))\prod_{Title}(\sigma_{Genre=\textit{'Fiction'}}(Book) \bowtie \sigma_{Name=\textit{'JaneAusten'}}(Author))

Show answer

Correct answer: 2

Question 9

+3 marksNumerical answer

Consider the following relations:
Instructor(InsID, InsName, email)
Course(CID, CName)
Teaches(InsID, CID, Semester, Year)

If the relation Instructor and Teaches have 12, 8 rows respectively.
(Note: Consider all the attributes are having NOT NULL constraint.)

Execute the following query and compute the value of A - B where:
A = Maximum number of rows returned by the following query.
B = Minimum number of rows returned by the following query.

sql
SELECT * FROM Instructor LEFT OUTER JOIN Teaches
ON Instructor.InsID = Teaches.InsID;
Show answer

Correct answer: 7

Question 10

+4 marksOne or more correct options

Consider the following relational schema and answer the given subquestions.

Questions:

  1. Find the first names of players whose names start with 'A' and have at least 4 characters.
  2. Find out the number of players in each team.
  3. List the team names that have players with the last name 'Smith'.

SQL queries:

sql
a. SELECT FirstName FROM Player WHERE FirstName LIKE 'A___%';
b. SELECT FirstName FROM Player WHERE FirstName LIKE 'A___';
c. SELECT TeamID, COUNT(PlayerID) FROM Player GROUP BY PlayerID;
d. SELECT TeamID, COUNT(PlayerID) FROM Player GROUP BY TeamID;
e. SELECT distinct t.TeamName FROM Team t INNER JOIN Player p
ON t.TeamID = p.TeamID WHERE p.LastName = 'Smith';
f. SELECT distinct t.TeamName FROM Team t, Player p WHERE t.TeamID = p.TeamID
AND p.LastName = 'Smith';

Match the correct SQL queries with the corresponding Questions.

Select all that apply.

  1. A

    1-a, 2-d, 3-f

  2. B

    1-b, 2-c, 3-e

  3. C

    1-a, 2-d, 3-e

  4. D

    1-a, 2-e, 3-f

Show answer

Correct answers

  • A

    1-a, 2-d, 3-f

  • C

    1-a, 2-d, 3-e

Question 11

+4 marksOne correct option

Consider the following relational schema and answer the given subquestions.

  1. A

    First names of players who are in either the Warriors or the Lakers team

  2. B

    First names of players who are in both the Warriors and the Lakers teams

  3. C

    Unique First names of players who are in both the Warriors and the Lakers teams

  4. D

    Unique First names of players who are either in the Warriors team or in the Lakers team

Show answer

Correct answer

  • D

    Unique First names of players who are either in the Warriors team or in the Lakers team

Question 12

+3 marksOne correct option

Consider the tables 3 and 4 and answer the given subquestions.

Table 3: Relation team

team_idnamerankingcountry
Cric-1BCCI1India
Cric-2ACB3Australia
Cric-3PCB10Pakistan
Cric-4NCB9Nepal
Cric-5ECB4England

Table 4: Relation players

team_idplayer_idnameranking
Cric-1BCCI-11Virat1
Cric-1BCCI-23Rohit3
Cric-3PCB-22Azam2
Cric-2ACB-12David6
Cric-2ACB-29Smith3
Cric-5ECB-88Cris4
Cric-5ECB-82Ben1
  1. A

    7

  2. B

    5

  3. C

    9

  4. D

    8

Show answer

Correct answer

  • D

    8

Question 13

+4 marksOne or more correct options

Consider the tables 3 and 4 and answer the given subquestions.

Table 3: Relation team

team_idnamerankingcountry
Cric-1BCCI1India
Cric-2ACB3Australia
Cric-3PCB10Pakistan
Cric-4NCB9Nepal
Cric-5ECB4England

Table 4: Relation players

team_idplayer_idnameranking
Cric-1BCCI-11Virat1
Cric-1BCCI-23Rohit3
Cric-3PCB-22Azam2
Cric-2ACB-12David6
Cric-2ACB-29Smith3
Cric-5ECB-88Cris4
Cric-5ECB-82Ben1

Select all that apply.

  1. A
  2. B
  3. C
  4. D
Show answer

Correct answers

  • B
  • C

Question 14

+4 marksOne correct option

Consider the tables 3 and 4 and answer the given subquestions.

Table 3: Relation team

team_idnamerankingcountry
Cric-1BCCI1India
Cric-2ACB3Australia
Cric-3PCB10Pakistan
Cric-4NCB9Nepal
Cric-5ECB4England

Table 4: Relation players

team_idplayer_idnameranking
Cric-1BCCI-11Virat1
Cric-1BCCI-23Rohit3
Cric-3PCB-22Azam2
Cric-2ACB-12David6
Cric-2ACB-29Smith3
Cric-5ECB-88Cris4
Cric-5ECB-82Ben1

Using the SQL query shown below, a view named BestTeam is created.

sql
CREATE VIEW BestTeam AS
SELECT p.player_id, p.name, t.country
FROM players p join team t on p.team_id = t.team_id
WHERE t.ranking < 4

Which among the following SQL queries will display the table shown below?

player_idname
BCCI-11Virat
BCCI-23Rohit
  1. A
  2. B
  3. C
  4. D
Show answer

Correct answer

  • B