0% found this document useful (0 votes)
1 views18 pages

Module 3 Study Materials

The document contains a series of questions and answers related to Database Management Systems (DBMS), covering topics such as relational models, SQL queries, normalization, and functional dependencies. It includes multiple-choice questions with explanations for the correct answers, focusing on concepts like cardinality, DML, and database architecture. The content serves as a study guide for understanding key DBMS principles and practices.

Uploaded by

mfibu87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1 views18 pages

Module 3 Study Materials

The document contains a series of questions and answers related to Database Management Systems (DBMS), covering topics such as relational models, SQL queries, normalization, and functional dependencies. It includes multiple-choice questions with explanations for the correct answers, focusing on concepts like cardinality, DML, and database architecture. The content serves as a study guide for understanding key DBMS principles and practices.

Uploaded by

mfibu87
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

DBMS QUESTIONS AND ANSWERS

1.1. In the relational model, cardinality is termed as:

A. A number of tuples.

2.Relational calculus is a:

A. Non-Procedural language.

3.The view of total database content is

A.Conceptual view

5.Cartesian product in relational algebra is

A.a Binary operator.

6.DML is provided for

A.Manipulation & processing of the database.

7.‘AS’ clause is used in SQL for

A.Rename operation.

8.ODBC stands for

A.Open Database Connectivity.

9.Architecture of the database can be viewed as

A.three levels.

10.In a relational model, relations are termed as

A.Tables

11.The database schema is written in

A.DDL

12.In the architecture of a database system external level is the

A.view level.

13.In Hierarchical model records are organised as

A.Tree

14.In an E-R diagram attributes are represented by


2

A.ellipse

15.In case of entity integrity, the primary key maybe

A.not Null

16.The language used in application programs to request data from the DBMS is referred to as the

A.DML

17.A logical schema

A.is the entire database.

18.Related fields in a database are grouped to form a

A.data record.

19.The language which has recently become the defacto standard for interfacing application
programs with relational database system

A.SQL

20.The way a particular application views the data from the database that the application uses is a

A.subschema

21.In an E-R diagram an entity set is represented by a

A.rectangle

22.A report generator is used to

A.print files on paper.

23.The DBMS language component which can be embedded in a program is

A.DML

24.A relational database developer refers to a record as

A.tuple

24.Conceptual design

A.involves modelling independent of the DBMS.

25,A subschema expresses

A.the external view.

26.Count function in SQL returns the


3

A.values

27.An advantage of the database management approach is

A.data is integrated and can be accessed by multiple programs.

28.A DBMS query language is designed to

Ans.A.support end-users who use English-like commands.

B. support in the development of complex applications software.

C. specify the structure of a data

29.It is possible to define a schema completely using

A.DDL and DML

30.The method of access which uses key transformation is known as

A.Hash

31.The statement in SQL which allows changing the definition of a table is

A.Alter

32.E-R model uses this symbol to represent a weak entity set?

A.Doubly outlined rectangle

33.SET concept is used in:

A.Network Model

34.Relational Algebra is

A.Procedural Query Language

35.Key to represent the relationship between tables is called

A.Foreign Key

36._______ produces the relation that has attributes of R1 and R2

A.Cartesian product

37.Which of the following are the properties of entities?

A.Attributes

38.It is better to use files than a DBMS when there are

A.Multiple users wish to access the data.


4

39.The conceptual model is

A.independent of both hardware and software.

40.What is a relationship called when it is maintained between two entities?

A.Binary

41.Which of the following operation is used if we are interested in only certain columns of a table?

A.projection

42.Which of the following is a valid SQL type?

Ans:A. CHARACTER

B. NUMERIC

C. FLOAT

43.The RDBMS terminology for a row is

A.tuple

44.The full form of DDL is

A.Data Definition Language

45.Which of the following is an advantage of view?

Ans:A. Data security

B. Derived columns

C. Hiding of complex queries

46.Which of the following is a legal expression in SQL?

A.SELECT NAME FROM EMPLOYEE;

47.The users who use the easy-to-use menu are called

A.Naïve users.

48.Which database level is closest to the users?

A.External

49.A set of possible data values is called

A.Domain

50.Which of the operations constitute a basic set of operations for manipulating relational data?
5

A.Relational algebra

51.Which of the following is another name for the weak entity?

A.Child

52.Which of the following database object does not physically exist?

A.view
GATE DBMS QUESTIONS
Question 1
Consider the following relational schema.
Students(rollno: integer, sname: string)
Courses(courseno: integer, cname: string)
Registration(rollno: integer, courseno: integer, percent: real)
Which of the following queries are equivalent to this query in English?
"Find the distinct names of all students who score
more than 90% in the course numbered 107"

A I, II, III and IV


B I, II and III only
C I, II and IV only
D II, III and IV only
Ans: Option A:

This is a SQL query expression. It first perform a cross product of Students


and Registration, then WHERE clause only keeps those rows in the cross product
set where the student is registered for course no 107, and percentage is > 90.
Then select distinct statement gives the distinct names of those students as the
result set.
Question 2
Consider the following relational schema.
Students(rollno: integer, sname: string)
Courses(courseno: integer, cname: string)
Registration(rollno: integer, courseno: integer, percent: real)
Which of the following queries are equivalent to this query in English?
"Find the distinct names of all students who score
more than 90% in the course numbered 107"

A I, II, III and IV


B I, II and III only
C I, II and IV only
D II, III and IV only
Ans:Option A:

This is a SQL query expression. It first perform a cross product of Students


and Registration, then WHERE clause only keeps those rows in the cross product
set where the student is registered for course no 107, and percentage is > 90.
Then select distinct statement gives the distinct names of those students as the
result set.
Question 3
Given the basic ER and relational models, which of the following is INCORRECT?
A An attribute of an entity can have more than one value
B An attribute of an entity can be composite
C In a row of a relational table, an attribute can have more than one value
In a row of a relational table, an attribute can have exactly one value or a
D
NULL value
Ans: The term ‘entity’ belongs to ER model and the term ‘relational table’ belongs to
relational model. A and B both are true. ER model supports both multivalued and composite
attributes See this for more details. (C) is false and (D) is true. In Relation model, an entry in
relational table can can have exactly one value or a NULL.
Question 4
Suppose (A, B) and (C,D) are two relation schemas. Let r1 and r2 be the corresponding
relation instances. B is a foreign key that refers to C in r2. If data in r1 and r2 satisfy
referential integrity constraints, which of the following is ALWAYS TRUE?
A A
B B
C C
D D

Ans:option A
Question 5
Consider the following relations A, B, C. How many tuples does the result of the following
relational algebra expression contain? Assume that the schema of A U B is the same as that

of A.
Table A
Id Name Age
----------------
12 Arun 60
15 Shreya 24
99 Rohit 11

Table B
Id Name Age
----------------
15 Shreya 24
25 Hari 40
98 Rohit 20
99 Rohit 11

Table C
Id Phone Area
-----------------
10 2200 02
99 2100 01
A 7
B 4
C 5
D 9
Ans: option A
Question 6
Consider a relational table r with sufficient number of records, having attributes A1, A2,…,
An and let 1 <= p <= n. Two queries Q1 and Q2 are given
below. The database can be configured to do
ordered indexing on Ap or hashing on Ap. Which of the following statements is TRUE?
A Ordered indexing will always outperform hashing for both queries
B Hashing will always outperform ordered indexing for both queries
C Hashing will outperform ordered indexing on Q1, but not on Q2
D Hashing will outperform ordered indexing on Q2, but not on Q1.
Ans: option c
Question 7
1) Let R and S be two relations with the following schema R (P,Q,R1,R2,R3) S (P,Q,S1,S2)
Where {P, Q} is the key for both schemas. Which of the following queries are

equivalent?
A Only I and II
B Only I and III
C Only I, II and III
D Only I, III and IV
Ans: option D
Question 8
Consider the following ER

diagram. The
minimum number of tables needed to represent M, N, P, R1, R2 is
A 2
B 3
C 4
D 5
Ans: option B
Answer is B, i.e, 3 minimum tables. M, P are strong entities hence they must be represented
by separate tables. Many-to-one and one-to-many relationship sets that are total on the many-
side can be represented by adding an extra attribute to the “many” side, containing the
primary key of the “one” side. ( This way no extra table will be needed for Relationship sets )
M table is modified to include primary key of P side(i.e. P1). N is weak entity, and is
modified to include primary key of P (i.e, P1). Therefore there would be minimum of 3 tables
with schema given below :
M ( M1, M2, M3, P1)
P ( P1, P2 )
N ( P1, N1, N2 )

Question 9
Relation R has eight attributes ABCDEFGH. Fields of R contain only atomic values. F =
{CH -> G, A -> BC, B -> CFH, E -> A, F -> EG} is a set of functional dependencies (FDs)
so that F+ is exactly the set of FDs that hold for R. How many candidate keys does the
relation R have?
A 3
B 4
C 5
D 6
Ans: option B
Explanation: A+ is ABCEFGH which is all attributes except D. B+ is also ABCEFGH which
is all attributes except D. E+ is also ABCEFGH which is all attributes except D. F+ is also
ABCEFGH which is all attributes except D. So there are total 4 candidate keys AD, BD, ED
and FD
Question 10
Consider the FDs given in above question. The relation R is
A in 1NF, but not in 2NF.
B in 2NF, but not in 3NF.
C in 3NF, but not in BCNF.
D in BCNF
Ans: option A
Explanation:
The table is not in 2nd Normal Form as the non-prime attributes are dependent on subsets of
candidate keys. The candidate keys are AD, BD, ED and FD. In all of the following FDs, the
non-prime attributes are dependent on a partial candidate key. A -> BC B -> CFH F -> EG

Question 11
Which of the following is TRUE?
A Every relation in 3NF is also in BCNF
A relation R is in 3NF if every non-prime attribute of R is fully functionally
B
dependent on every key of R
C Every relation in BCNF is also in 3NF
D No relation can be in both BCNF and 3NF
Ans:Option C
Explanation:
BCNF is a stronger version 3NF. So every relation in BCNF will also be in 3NF.

Question 12
Consider a relational table with a single record for each registered student with the following
attributes.
1. Registration_Num: Unique registration number
of each registered student
2. UID: Unique identity number, unique at the
national level for each citizen
3. BankAccount_Num: Unique account number at
the bank. A student can have multiple accounts
or join accounts. This attribute stores the
primary account number.
4. Name: Name of the student
5. Hostel_Room: Room number of the hostel
Which one of the following option is INCORRECT?
A BankAccount_Num is candidate key
B Registration_Num can be a primary key
C UID is candidate key if all students are from the same country
D If S is a superkey such that S∩UID is NULL then S∪UID is also a superkey
Ans:Option A

Explanation:
A Candidate Key value must uniquely identify the corresponding row in table.
BankAccount_Number is not a candidate key. As per the question “A student can have
multiple accounts or joint accounts. This attributes stores the primary account number”. If
two students have a joint account and if the joint account is their primary account, then
BankAccount_Number value cannot uniquely identify a row.

Question 13
Consider the following relational schema:
Suppliers(sid:integer, sname:string, city:string, street:string)
Parts(pid:integer, pname:string, color:string)
Catalog(sid:integer, pid:integer, cost:real)
Assume that, in the suppliers relation above, each supplier and each street within a city has a
unique name, and (sname, city) forms a candidate key. No other functional dependencies are
implied other than those implied by primary and candidate keys. Which one of the following
is TRUE about the above schema?
A The schema is in BCNF
B The schema is in 3NF but not in BCNF
C The schema is in 2NF but not in 3NF
D The schema is not in 2NF
Ans:option A
Explanation:
A relation is in BCNF if for every one of its dependencies X → Y, at least one of the
following conditions hold:
X → Y is a trivial functional dependency (Y ⊆ X)
X is a superkey for schema R
Since (sname, city) forms a candidate key, there is no non-tirvial dependency X → Y where
X is not a superkey

Question 14
Consider the following relational schemes for a library database: Book (Title, Author,
Catalog_no, Publisher, Year, Price) Collection (Title, Author, Catalog_no) with in the
following functional dependencies:
I. Title Author --> Catalog_no
II. Catalog_no --> Title, Author, Publisher, Year
III. Publisher Title Year --> Price
Assume {Author, Title} is the key for both schemes. Which of the following statements is
true?
A Both Book and Collection are in BCNF
B Both Book and Collection are in 3NF only
C Book is in 2NF and Collection is in 3NF
D Both Book and Collection are in 2NF only
Ans:option C
Explanation:
Book (Title, Author, Catalog_no, Publisher, Year, Price)
Collection (Title, Author, Catalog_no)
with in the following functional dependencies:
I. Title, Author --> Catalog_no
II. Catalog_no --> Title, Author, Publisher, Year
III. Publisher, Title, Year --> Price

Assume {Author, Title} is the key for both schemes


 The table "Collection" is in BCNF as there is only one functional dependency “Title
Author –> Catalog_no” and {Author, Title} is key for collection.
 Book is not in BCNF because Catalog_no is not a key and there is a functional
dependency “Catalog_no –> Title Author Publisher Year”.
 Book is not in 3NF because non-prime attributes (Publisher Year) are transitively
dependent on key [Title, Author].
 Book is in 2NF because every non-prime attribute of the table is either dependent on
the whole of a candidate key [Title, Author], or on another non prime attribute. In
table book, candidate keys are {Title, Author} and {Catalog_no}. In table Book, non-
prime attributes (attributes that do not occur in any candidate key) are Publisher, Year
and Prince

Question 15
Consider the relation scheme R = {E, F, G, H, I, J, K, L, M, M} and the set of functional
dependencies {{E, F} -> {G}, {F} -> {I, J}, {E, H} -> {K, L}, K -> {M}, L -> {N} on R.
What is the key for R?
A {E, F}
B {E, F, H}
C {E, F, H, K, L}
D {E}
Ans:Option B
Explanation:
All attributes can be derived from {E, F, H} To solve these kind of questions that are
frequently asked in GATE paper, try to solve it by using shortcuts so that enough amount of
time can be saved. Fist Method: Using the given options try to obtain closure of each
options. The solution is the one that contains R and also minimal Super Key, i.e Candidate
Key.

A) {EF}+ = {EFGIJ} ≠ R(The given relation)

B) {EFH}+ = {EFGHIJKLMN} = R (Correct since each member of the


given relation is determined)

C) {EFHKL}+ = {EFGHIJKLMN} = R (Not correct although each member


of the given relation can be determined
but it is not minimal, since by the definition
of Candidate key it should be minimal Super Key)

D) {E}+ = {E} ≠ R

Question 16
Given the following two statements:
S1: Every table with two single-valued
attributes is in 1NF, 2NF, 3NF and BCNF.

S2: AB->C, D->E, E->C is a minimal cover for


the set of functional dependencies
AB->C, D->E, AB->E, E->C.
Which one of the following is CORRECT?
A S1 is TRUE and S2 is FALSE.
B Both S1 and S2 are TRUE.
C S1 is FALSE and S2 is TRUE.
D Both S1 and S2 are FALSE.
Ans:Option A

Question 17
The maximum number of superkeys for the relation schema R(E,F,G,H) with E as the key is
A 5
B 6
C 7
D 8
Ans:Option D

Question 18
Given the STUDENTS relation as shown
below.

For (StudentName, StudentAge) to be the key for this instance, the value X should not be
equal to
A 18
B 19

Ans: option B
Explanation:
There is already an entry with same name and age as 19. So the age of this entry must be
something other than 19.

Question 19
Which of the following statements are TRUE about an SQL query? P : An SQL query can
contain a HAVING clause even if it does not have a GROUP BY clause Q : An SQL query
can contain a HAVING clause only if it has a GROUP BY clause R : All attributes used in
the GROUP BY clause must appear in the SELECT clause S : Not all attributes used in the
GROUP BY clause need to appear in the SELECT clause
A P and R
B P and S
C Q and R
D Q and S
Ans: Option B
Explanation:
According to standard SQL answer should be option (C) which is answer key given by
GATE authority. If we talk about different SQL implementations like MySQL, then option
(B) is also right. But in question they seem to be talking about standard SQL not about
implementation. For example below is a P is correct in most of the implementations.
HAVING clause can also be used with aggregate function. If we use a HAVING clause
without a GROUP BY clause, the HAVING condition applies to all rows that satisfy the
search condition. In other words, all rows that satisfy the search condition make up a single
group. See this for more details. S is correct . To verify S, try following queries in SQL.
CREATE TABLE temp
(
id INT,
name VARCHAR(100)
);

INSERT INTO temp VALUES (1, "abc");


INSERT INTO temp VALUES (2, "abc");
INSERT INTO temp VALUES (3, "bcd");
INSERT INTO temp VALUES (4, "cde");

SELECT Count(*)
FROM temp
GROUP BY name;
Output:
count(*)
--------
2
1
1
Alternative way - Statement (P) "An SQL query can contain a HAVING clause even if it
does not have a GROUP BY clause" is correct because Having caluse is applied after the
aggregation phase and must be used if you want to filter aggregate results and Having doesn't
require Group By clause. A HAVING clause without a GROUP BY clause is valid and
(arguably) useful syntax in Standard SQL. Consider this example, which is valid Standard
SQL:
SELECT 'T' AS result
FROM Book
HAVING MIN(NumberOfPages) < MAX(NumberOfPages);
Statement (S) "Not all attributes used in the GROUP BY clause need to appear in the
SELECT clause" is correct but if we use Group By clause must, there are limitations on what
we can put into the Select clause.

Question 20
Consider a database table T containing two columns X and Y each of type integer. After the
creation of the table, one record (X=1, Y=1) is inserted in the table. Let MX and My denote
the respective maximum values of X and Y among all records in the table at any point in
time. Using MX and MY, new records are inserted in the table 128 times with X and Y
values being MX+1, 2*MY+1 respectively. It may be noted that each time after the insertion,
values of MX and MY change. What will be the output of the following SQL query after the
steps mentioned above are carried out?
SELECT Y FROM T WHERE X=7;
A 127
B 255
C 129
D 257
Ans:option A
Question 21
Consider the following transactions with data items P and Q initialized to zero:
T1: read (P) ;
read (Q) ;
if P = 0 then Q : = Q + 1 ;
write (Q) ;
T2: read (Q) ;
read (P) ;
if Q = 0 then P : = P + 1 ;
write (P) ;
Any non-serial interleaving of T1 and T2 for concurrent execution leads to
A A serializable schedule
B A schedule that is not conflict serializable
C A conflict serializable schedule
D A schedule for which a precedence graph cannot be drawn

Ans: option B

Question 22
Which of the following concurrency control protocols ensure both conflict serialzability and
freedom from deadlock? I. 2-phase locking II. Time-stamp ordering
A I only
B II only
C Both I and II
D Neither I nor II

Ans:Option B
Explanation:
2 Phase Locking (2PL) is a concurrency control method that guarantees serializability. The
protocol utilizes locks, applied by a transaction to data, which may block (interpreted as
signals to stop) other transactions from accessing the same data during the transaction’s life.
2PL may be lead to deadlocks that result from the mutual blocking of two or more
transactions. See the following situation, neither T3 nor T4 can make progress.

Timestamp-based concurrency control algorithm is a non-lock concurrency control method.


In Timestamp based method, deadlock cannot occur as no transaction ever waits.
Question 23

Consider the following schedule for transactions T1, T2 and

T3:
Which one of the schedules below is the correct serialization of the above?
A T1->>T3->>T2
B T2->>T1->>T3
C T2->>T3->>T1
D T3->>T1->>T2
Ans:option A
Explanation:
T1 can complete before T2 and T3 as there is no conflict between Write(X) of T1 and the
operations in T2 and T3 which occur before Write(X) of T1 in the above diagram.
T3 should can complete before T2 as the Read(Y) of T3 doesn’t conflict with Read(Y) of T2.
Similarly, Write(X) of T3 doesn’t conflict with Read(Y) and Write(Y) operations of T2.
Another way to solve this question is to create a dependency graph and topologically sort the
dependency graph. After topologically sorting, we can see the sequence T1, T3, T2.
Question 24
Consider the following four schedules due to three transactions (indicated by the subscript)
using read and write on a data item x, denoted by r(x) and w(x) respectively. Which one of
them is conflict

serializable.
A A
B B
C C
D D
Ans:option D
Explanation:
In option D, there is no interleaving of operations. The option D has first all operations of
transaction 2, then 3 and finally 1 There can not be any conflict as it is a serial schedule with
sequence 2 --> 3 -- > 1
Question 5
Consider the following schedule S of transactions T1, T2, T3,
T4:

Which one of the following statements is CORRECT?


A S is conflict-serializable but not recoverable
B S is not conflict-serializable but is recoverable
C S is both conflict-serializable and recoverable
D S is neither conflict-serializable nor is it recoverable
Ans:option C

Explanation:
To check for conflict-serializable, we need to make a precedence graph, if the graph contains
a cycle, then it's not conflict serializable, else it is. Here, for the precedence graph there will
be only two directed edges, one from T2 -> T3 ( Read- Write Conflict), and another from T2
-> T1( Read- Write Conflict), hence no cycle, so the schedule is conflict serializable. Now to
check for Recoverable, we need to check for a dirty-read operation( Write by Transaction Ti,
followed by Read by Transaction Tj but before Ti commits) between any pair of operations.
If no dirty-read then recoverable schedule, if a dirty read is there then we need to check for
commit operations. Here no dirty read operation ( as T3 and T1 commits before T4 reads the
Write(X) of T3 and T1 , and T2 commits before T4 reads the Write(Y) of T2 ). Therefore the
schedule is recoverable. Hence, Option C.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy