GATE DA Database Management and Warehousing Quiz

Last Updated :
Discuss
Comments

Question 1

Consider the function computeS(X) whose pseudocode is given below:

computeS(X)
𝑆[1] ← 1
for 𝑖 ←2 to length(X)
𝑆[𝑖] ← 1
if 𝑋[𝑖 βˆ’ 1] ≀ 𝑋[𝑖]
𝑆[𝑖] ← 𝑆[𝑖] + 𝑆[𝑖 βˆ’ 1]
end if
end for
return S

which ONE of the following values is returned by the function computeS(x)

for X=[6,3,5,4,10]?


  • [1,1,2,3,4]

  • [1,1,2,3,3]

  • [1,1,2,1,2]

  • [1,1,2,1,5]

Question 2

On a relation named Loan of a bank:

Loan

loan_number

branch_name

amount

L11

Banjara Hills

90000

L14

Kondapur

50000

L15

SR Nagar

40000

L22

SR Nagar

25000

L23

Balanagar

80000

L25

Kondapur

70000

L19

SR Nagar

65000

the following SQL query is executed.

SELECT L1.loan_number

FROM Loan L1

WHERE L1.amount > (SELECT MAX (L2.amount)

FROM Loan L2

WHERE L2.branch_name = ’SR Nagar’);

The number of rows returned by the query is ___________ (Answer in integer)

  • 2

  • 3

  • 4

  • 5

Question 3

Consider the following tables, Loan and Borrower, of a bank.

Loan

loan_num

branch_name

amount

L11

Banjara Hills

90000

L14

Kondapur

50000

L15

SR Nagar

40000

L22

SR Nagar

25000

L23

Balanagar

80000

L25

Kondapur

70000

L19

SR Nagar

6500


Borrower

customer_name

loan_num

Anand

L11

Karteek

L11

Karteek

L14

Ankita

L15

Gopal

L19

Karteek

L22

Karteek

L23

Sunil

L23

Sunil

L25

Query: Ο€branch name, customer name(Loan β‹ˆ Borrower) Γ· Ο€branch name(Loan)

where β‹ˆ denotes natural join.

The number of tuples returned by the above relational algebra query is _________

(Answer in integer)

  • 3

  • 2

  • 1

  • 0

Question 4

Given the relational schema 𝑅 = (π‘ˆ,𝑉, π‘Š, 𝑋, π‘Œ, 𝑍) and the set of functional dependencies:

{π‘ˆ β†’ 𝑉, π‘ˆ β†’ π‘Š, π‘Šπ‘‹ β†’ π‘Œ, π‘Šπ‘‹ β†’ 𝑍, 𝑉 β†’ 𝑋} 

Which of the following functional dependencies can be derived from the above set? [GATE || DA || MSQ || 2024]

  • π‘‰π‘Š β†’ π‘ŒZ

  • π‘Šπ‘‹ β†’ π‘ŒZ

  • π‘‰π‘Š β†’ U

  • π‘‰π‘Š β†’ Y

Question 5

An OTT company is maintaining a large disk-based relational database of different movies with the following schema: Movie(ID, CustomerRating)

Genre(ID, Name)

Movie_Genre(MovieID, GenreID)

Consider the following SQL query on the relation database above:

SELECT * FROM Movie, Genre, Movie_Genre WHERE

Movie.CustomerRating > 3.4 AND

Genre.Name = β€œComedy” AND

Movie_Genre.MovieID = Movie.ID AND Movie_Genre.GenreID = Genre.ID;

This SQL query can be sped up using which of the following indexing options? [GATE DA || MSQ || 2024]

  • B + tree on all the attributes

  • Hash index on Genre.Name and B + tree on the remaining attributes.

  • Hash index on Movie.CustomerRating and B + tree on the remaining attributes.

  • Hash index on all the attributes.

Question 6

Consider a database that includes the following relations:

Defender(name, rating, side, goals)

Forward(name, rating, assists, goals)

Team(name, club, price)

Which ONE of the following relational algebra expressions checks that every name occurring in Team appears in either Defender or Forward, where πœ™ denotes the empty set?

[GATE DA || MCQ || 2024]

  • Ξ _name (Team) \ (Ξ _name (Defender) ∩ Ξ _name (Forward)) = Ο•

  • (Ξ _name (Defender) ∩ Ξ _name (Forward)) \ Ξ _name (Team) = Ο•

  • Ξ _name (Team) \ (Ξ _name (Defender) βˆͺ Ξ _name (Forward)) = Ο•

  • (Ξ _name (Defender) βˆͺ Ξ _name (Forward)) \ Ξ _name (Team) = Ο•

Question 7

Consider the following two tables named Raider and Team in a relational database maintained by a Kabaddi league. The attribute ID in table Team references the primary key of the Raider table, ID.

Raider


ID

Name

Raids

RaidPoints

1

Arjun

200

250

2

Ankush

190

219

3

Sunil

150

200

4

Reza

150

190

5

Pratham

175

220

6

Gopal

193

215

Team

City

ID

BidPoints

Jaipur

2

200

Patna

3

195

Hyderabad

5

175

Jaipur

1

250

Patna

4

200

Jaipur

6

20

The SQL query described below is executed on this database:

SELECT * FROM Raider, Team WHERE Raider.ID=Team.ID AND City=β€œJaipur” AND  RaidPoints > 200; 

The number of rows returned by this query is ______ [GATE DA || MCQ || 2024]

  • 1

  • 3

  • 2

  • 0

Question 8

If a relational decomposition is not dependency-preserving, which one of the following relational operators will be executed more frequently in order to maintain the dependencies?
[GATE || DA || MCQ || 2025]

  • Selection

  • Projection

  • Join

  • Set union

Question 9

Consider the following three relations:

Car (model, year, serial, color)
Make (maker, model)
Own (owner, serial)

A tuple in Car represents a specific car of a given model, made in a given year, with a serial number and a color. A tuple in Make specifies that a maker company makes cars of a certain model. A tuple in Own specifies that an owner owns the car with a given serial number. Keys are underlined; (owner, serial) together form key for Own. (β‹ˆ denotes natural join)

Ο€owner(Own β‹ˆ (Οƒcolor=β€œred” (Car β‹ˆ (Οƒmaker=β€œABC” Make))))

Which one of the following options describes what the above expression computes? [GATE DA || MCQ || 2025]

  • All owners of a red car, a car made by ABC, or a red car made by ABC

  • All owners of more than one car, where at least one car is red and made by ABC

  • All owners of a red car made by ABC

  • All red cars made by ABC

Question 10

Consider a fact table in an OLAP application: Facts(D1, D2, val), where D1 and D2 are its dimension attributes and val is a dependent attribute. Suppose attribute D1 takes 3 values and D2 takes 2 values, and all combinations of these values are present in the table Facts. How many tuples are there in the result of the following query?

SELECT D1, D2, sum(val)
FROM Facts
GROUP BY CUBE (D1, D2); [GATE DA || MSQ || 2025]

  • 1

  • 6

  • 9

  • 12

There are 12 questions to complete.

Take a part in the ongoing discussion