DBMS
DBMS
ER‐model. Relational model:Relational algebra, Tuple calculus, SQL. Integrity constraints, Normal forms. File
organization, Indexing (e.g., B and B+ trees). Transactions and concurrency control.
The below figure shows a tree where only key values are indicated in the records. Each block can hold
upto three records. A record with a key value is inserted into the tree. Obtain the modified tree
after insertion.
Answer key☟
Consider - tree of order shown in figure. (A - tree of order contains between and keys in
each node)
Draw the resulting - tree after is inserted in the figure below.
Answer key☟
For a - tree of order with leaf nodes, the number of nodes accessed during a search is .
Answer key☟
A - tree of order is a tree in which each internal node has between and key values. An internal
node with key values has children. The root (if it is an internal node) has between and key
values. The distance of a node from the root is the length of the path from the root to the node. All leaves are at the
same distance from the root. The height of the tree is the distance of a leaf from the root.
A. What is the total number of key values in the internal nodes of a -tree with leaves ( )?
B. What is the maximum number of internal nodes in a - tree of order with leaves?
C. What is the minimum number of leaves in a -tree of order and height ?
Answer key☟
A. B-trees are for storing data on disk and B trees are for main memory.
B. Range queries are faster on B trees.
C. B-trees are for primary indexes and B trees are for secondary indexes.
D. The height of a B tree is independent of the number of records.
Answer key☟
Consider a B-tree with degree , that is, the number of children, , of any internal node (except the root) is
such that . Derive the maximum and minimum number of records in the leaf nodes for
such a B-tree with height Assume that the root of a tree is at height
Answer key☟
Answer key☟
(a) Suppose you are given an empty tree where each node (leaf and internal) can store up to key
values. Suppose values are inserted, in order, into the tree. Show the tree pictorially
Answer key☟
We wish to construct a tree with fan-out (the number of pointers per node) equal to for the following
set of key values:
Assume that the tree is initially empty and the values are added in the order given.
a. Show the tree after insertion of , after insertion of , and after insertion of . Intermediate trees need not be
shown.
b. The key values and are now deleted from the tree in that order show the tree after each deletion.
Answer key☟
a. The following table refers to search items for a key in -trees and trees.
A successful search means that the key exists in the database and unsuccessful means that it is not present in
the database. Each of the entries and can have a value of either Constant or Variable.
Constant means that the search time is the same, independent of the specific key value, where variable means
that it is dependent on the specific key value chosen for the search.
Give the correct values for the entries and (for example
i. The current contents of relation are shown below. What are the contents of the view ?
ii. The tuples and are now inserted into What are the additional tuples that are inserted in
?
gatecse-2002 databases b-tree normal descriptive
Answer key☟
A - tree index is to be built on the Name attribute of the relation STUDENT. Assume that all the student
names are of length bytes, disk blocks are of size bytes, and index pointers are of size bytes. Given
the scenario, what would be the best choice of the degree (i.e. number of pointers per node) of the - tree?
A. B. C. D.
gatecse-2002 databases b-tree normal ugcnetcse-june2012-paper2
Answer key☟
Consider the following tree (i.e., B-tree with a minimum degree of two) in which each data item is
a letter. The usual alphabetical ordering of letters is used in constructing the tree.
A. B.
D. None of the above
C.
gatecse-2003 databases b-tree normal
Answer key☟
The order of an internal node in a tree index is the maximum number of children it can have. Suppose
that a child pointer takes bytes, the search field value takes bytes, and the block size is bytes.
What is the order of the internal node?
A. B. C. D.
gatecse-2004 databases b-tree normal
Answer key☟
Which of the following is a key factor for preferring -trees to binary search trees for indexing database
relations?
Answer key☟
5.1.15 B Tree: GATE CSE 2007 | Question: 63, ISRO2016-59
The order of a leaf node in a - tree is the maximum number of (value, data record pointer) pairs it can
hold. Given that the block size is , data record pointer is long, the value field is
long and a block pointer is long, what is the order of the leaf node?
A. B. C. D.
gatecse-2007 databases b-tree normal isro2016
Answer key☟
A B-tree of order is built from scratch by successive insertions. What is the maximum number of node
splitting operations that may take place?
A. B. C. D.
gatecse-2008 databases b-tree normal
Answer key☟
The following key values are inserted into a - tree in which order of the internal nodes is , and that
of the leaf nodes is , in the sequence given below. The order of internal nodes is the maximum number of
tree pointers in each node, and the order of leaf nodes is the maximum number of data items that can be stored in
it. The - tree is initially empty
, , , , , ,
The maximum number of times leaf nodes would get split up as a result of these insertions is
A. B. C. D.
gatecse-2009 databases b-tree normal
Answer key☟
Consider a -tree in which the maximum number of keys in a node is . What is the minimum number of
keys in any non-root node?
A. B. C. D.
gatecse-2010 databases b-tree easy
Answer key☟
With reference to the B+ tree index of order shown below, the minimum number of nodes (including the
Root node) that must be fetched in order to satisfy the following query. "Get all records with a search key
greater than or equal to and less than " is ______.
Answer key☟
5.1.20 B Tree: GATE CSE 2015 Set 3 | Question: 46
Consider a B+ tree in which the search key is long, block size is , record pointer is
long and the block pointer is long. The maximum number of keys that can be accommodated
in each non-leaf node of the tree is ______.
Answer key☟
A. The lengths of the paths from the root to all leaf nodes are all equal.
B. The lengths of the paths from the root to all leaf nodes differ from each other by at most .
C. The number of children of any two non-leaf sibling nodes differ by at most .
D. The number of records in any two leaf nodes differ by at most .
Answer key☟
In a B+ Tree , if the search-key value is bytes long , the block size is bytes and the pointer size is
, then the maximum order of the B+ Tree is ____
Answer key☟
Which one of the following statements is NOT correct about the B+ tree data structure used for creating an
index of a relational database table?
Answer key☟
In a tree, the requirement of at least half-full node occupancy is relaxed for which one of the
following cases?
Answer key☟
Consider a table in a relational database with a key field . A -tree of order is used as an access
structure on , where denotes the maximum number of tree pointers in a B-tree index node. Assume that
is long; disk block size is ; each data pointer PD is bytes long and each block pointer PB is
bytes long. In order for each -tree node to fit in a single disk block, the maximum value of is
A. B. C. D.
gateit-2004 databases b-tree normal
Answer key☟
A B-Tree used as an index for a large database table has four levels including the root node. If a new key is
inserted in this index, then the maximum number of nodes that could be newly created in the process are
A. B. C. D.
gateit-2005 databases b-tree normal isro2017
Answer key☟
In a database file structure, the search key field is long, the block size is , a record pointer
is and a block pointer is . The largest possible order of a non-leaf node in a tree
implementing this file structure is
A. B. C. D.
gateit-2006 databases b-tree normal
Answer key☟
Consider the tree in the adjoining figure, where each node has at most two keys and three links.
Keys and then are inserted into this tree in that order. Exactly how many of the following nodes
(disregarding the links) will be present in the tree after the two insertions?
A. B. C. D.
gateit-2007 databases b-tree normal
Answer key☟
Consider the tree in the adjoining figure, where each node has at most two keys and three links.
Keys and then are inserted into this tree in that order. Now the key is deleted from the tree
resulting after the two insertions made earlier. Consider the following statements about the tree resulting after
this deletion.
A. Statements (i) and (ii) are true B. Statements (ii) and (iii) are true
C. Statements (iii) and (i) are true D. All the statements are false
gateit-2007 databases b-tree normal
Answer key☟
An instance of a relational scheme has distinct values for attribute . Can you conclude that
is a candidate key for
Answer key☟
Consider a relational table with a single record for each registered student with the following attributes:
A. is a candidate key
B. can be a primary key
C. is a candidate key if all students are from the same country
D. If is a super key such that is then is also a superkey
Answer key☟
The maximum number of superkeys for the relation schema with as the key is _____.
Answer key☟
For to be a key for this instance, the value should NOT be equal to______.
Answer key☟
5.2.5 Candidate Key: GATE CSE 2014 Set 3 | Question: 22
Answer key☟
Consider the following four schedules due to three transactions (indicated by the subscript)
using read and write on a data item x, denoted by and respectively. Which one of them is conflict
serializable?
A. ; ; ; ; ;
B. ; ; ; ; ;
C. ; ; ; ; ;
D. ; ; ; ; ;
Answer key☟
Answer key☟
Answer key☟
Answer key☟
Let and denote read and write operations respectively on a data item by a transaction .
Consider the following two schedules.
Answer key☟
Let be the following schedule of operations of three transactions , and in a relational database
system:
: is conflict-serializable.
: If commits before finishes, then is recoverable.
Answer key☟
Let and denote read and write operations on a data element by a transaction
respectively. Consider the schedule with four transactions.
A. B.
C. D.
gatecse-2022 databases transaction-and-concurrency conflict-serializable 2-marks
Answer key☟
Consider the following read-write schedule over three transactions , and , where the subscripts in
the schedule indicate transaction IDs:
A. B. C. D.
gatecse2024-set1 databases conflict-serializable multiple-selects
Answer key☟
Answer key☟
A relation with schema satisfies the function dependency , The tuples and can both
be in simultaneously.
Answer key☟
What are the three axioms of functional dependency for the relational databases given by Armstrong.
Answer key☟
Answer key☟
Answer key☟
Answer key☟
Answer key☟
Answer key☟
There is always a decomposition into Boyce-Codd normal form (BCNF) that is lossless and dependency
preserving.
gate1994 databases database-normalization easy true-false
Answer key☟
Answer key☟
For a database relation , where the domains include only atomic values, only the
following functional dependencies and those that can be inferred from them hold
This relation is
A. in first normal form but not in second normal form B. in second normal form but not in first normal form
C. in third normal form D. none of the above
gate1997 databases database-normalization normal
Answer key☟
Which normal form is considered adequate for normal relational database design?
A. B. C. D.
gate1998 databases database-normalization easy
Answer key☟
Book_id
Subject_Category_of_book
Name_of_Author
Nationality_of_Author
Answer key☟
A. CD B. EC C. AE D. AC
gate1999 databases database-normalization easy
Answer key☟
Answer key☟
A. and B. and
C. and D. and
gatecse-2000 databases database-normalization easy
Answer key☟
is a relation. Which of the following does not have a lossless join, dependency preserving
decomposition?
A. B.
C. D.
gatecse-2001 databases database-normalization normal
Answer key☟
A. Zero
B. More than zero but less than that of an equivalent decomposition
C. Proportional to the size of
D. Indeterminate
Answer key☟
Answer key☟
Relation is decomposed using a set of functional dependencies, , and relation is decomposed using
another set of functional dependencies, . One decomposition is definitely , the other is definitely
, but it is not known which is which. To make a guaranteed identification, which one of the following tests
should be used on the decompositions? (Assume that the closures of and are available).
A. Dependency-preservation B. Lossless-join
C. definition D. definition
gatecse-2002 databases database-normalization easy
Answer key☟
Answer key☟
A. in second normal form but not in B. in third normal form but not in
third normal form BCNF
C. in BCNF D. in none of the above
gatecse-2003 databases database-normalization normal
Answer key☟
5.5.22 Database Normalization: GATE CSE 2004 | Question: 50
A. B. C. D.
gatecse-2004 databases database-normalization normal
Answer key☟
A. is stricter than
B. Lossless, dependency-preserving decomposition into is always possible
C. Lossless, dependency-preserving decomposition into is always possible
D. Any relation with two attributes is in
Answer key☟
A. B. C. D.
gatecse-2005 databases database-normalization easy
Answer key☟
A. B.
C. D.
gatecse-2006 databases database-normalization normal
Answer key☟
Answer key☟
I.
II.
III.
Assume is the key for both schemes. Which of the following statements is ?
A. Both Book and Collection are in B. Both Book and Collection are in only
C. Book is in and Collection in D. Both Book and Collection are in only
gatecse-2008 databases database-normalization normal
Answer key☟
Answer key☟
A. B. C. D.
gatecse-2013 databases database-normalization normal
Answer key☟
Answer key☟
5.5.31 Database Normalization: GATE CSE 2014 Set 1 | Question: 21
A. B. C. D.
gatecse-2014-set1 databases database-normalization normal
Answer key☟
Answer key☟
A. B.
C. D.
gatecse-2015-set3 databases database-normalization easy
Answer key☟
Which of the following is NOT a superkey in a relational schema with attributes and primary
key ?
A. B. C. D.
gatecse-2016-set1 databases database-normalization easy
Answer key☟
Which is the weakest normal form that the new database satisfies, but the old one does not?
A. B. C. D.
gatecse-2016-set1 databases database-normalization normal
Answer key☟
The following functional dependencies hold true for the relational schema :
Which of the following is irreducible equivalent for this set of functional dependencies?
A. B. C. D.
Answer key☟
Consider the following four relational schemas. For each schema , all non-trivial functional dependencies are
listed, The bolded attributes are the respective primary keys.
Registration(rollno, courses)
Field ‘courses’ is a set-valued attribute containing the set of courses a student has registered for.
Non-trivial functional dependency
rollno courses
Registration (rollno, coursid, email)
Non-trivial functional dependencies:
rollno, courseid email
email rollno
Registration (rollno, courseid, marks, grade)
Non-trivial functional dependencies:
rollno, courseid, marks, grade
marks grade
Registration (rollno, courseid, credit)
Non-trivial functional dependencies:
rollno, courseid credit
courseid credit
Which one of the relational schemas above is in but not in ?
A. B. C. D.
gatecse-2018 databases database-normalization normal 2-marks
Answer key☟
Answer key☟
Consider a relational table that is in , but not in BCNF. Which one of the following statements is
TRUE?
A. has a nontrivial functional dependency , where is not a superkey and is a prime attribute.
B. has a nontrivial functional dependency , where is not a superkey and is a non-prime attribute
and is not a proper subset of any key.
C. has a nontrivial functional dependency , where is not a superkey and is a non-prime attribute
and is a proper subset of some key
D. A cell in holds a set instead of an atomic value.
Answer key☟
Consider the decomposition of the relation into the constituent relations according to the following two
decomposition schemes.
Answer key☟
5.5.41 Database Normalization: GATE CSE 2021 Set 2 | Question: 40
Suppose the following functional dependencies hold on a relation with attributes , and :
Which of the following functional dependencies can be inferred from the above functional dependencies?
A. B. C. D.
gatecse-2021-set2 multiple-selects databases database-normalization 2-marks
Answer key☟
Answer key☟
Answer key☟
Which of the following statements about a relation in first normal form is/are TRUE?
Answer key☟
The symbol indicates functional dependency in the context of a relational database. Which of the
following options is/are TRUE?
A. implies
B. implies
C. and implies
D. and implies
Answer key☟
5.5.46 Database Normalization: GATE CSE 2024 | Set 2 | Question: 46
For a relation with attributes, the total number of possible useful functional dependencies is __________.
Answer key☟
Which of the following functional dependencies can be derived from the above set?
A. B.
C. D.
gate-ds-ai-2024 databases database-normalization multiple-selects
Answer key☟
5.5.48 Database Normalization: GATE Data Science and Artificial Intelligence 2024 | Sample Paper | Question:
26
A. and
B. and
C. and
D. and
gateda-sample-paper-2024 database-normalization
Answer key☟
A relation is defined with attributes empcode (unique), name, street, city, state and pincode. For
any pincode, there is only one city and state. Also, for any given street, city and state, there is just one
pincode. In normalization terms, is a relation in
Answer key☟
A. B. C. D. None of these
gateit-2005 databases database-normalization easy
Answer key☟
In a schema with attributes and following set of functional dependencies are given
Which of the following functional dependencies is NOT implied by the above set?
A. B. C. D.
gateit-2005 databases database-normalization normal
Answer key☟
Consider a relation R with five attributes and The following functional dependencies hold:
and
Which of the following is a candidate key for
A. B. C. D.
gateit-2006 databases database-normalization normal
Answer key☟
Answer key☟
Answer key☟
Answer key☟
Let and be two entities in an diagram with simple-valued attributes. and are two
relationships between and , where is one-to-many and is many-to-many. and do not
have any attributes of their own. What is the minimum number of tables required to represent this situation in the
relational model?
A. B. C. D.
gatecse-2005 databases er-diagram normal
Answer key☟
A. B. C. D.
gatecse-2008 databases er-diagram normal
Answer key☟
A. B. C. D.
gatecse-2008 databases er-diagram normal
Answer key☟
Given the basic ER and relational models, which of the following is INCORRECT?
Answer key☟
has two-singled attributes and of which is the key attribute. has two singled-valued attributes
and of which is the key attribute. has two single-valued attributes and of which is the
key attribute. The relationships do not have any attributes.
If a relational model is derived from the above model, then the minimum number of relations that would be
generated if all relation are in is________________.
Answer key☟
An ER model of a database consists of entity types and . These are connected by a relationship
which does not have its own attribute. Under which one of the following conditions, can the relational table
for R be merged with that of A?
Answer key☟
In an Entity-Relationship (ER) model, suppose is a many-to-one relationship from entity set E1 to entity
set E2. Assume that E1 and E2 participate totally in and that the cardinality of E1 is greater than the
cardinality of E2.
Which one of the following is true about ?
Answer key☟
5.6.8 ER Diagram: GATE CSE 2020 | Question: 14
Which one of the following is used to represent the supporting many-one relationships of a weak entity set in
an entity-relationship diagram?
Answer key☟
Let be the specification: "Instructors teach courses. Students register for courses. Courses are allocated
classrooms. Instructors guide students." Which one of the following diagrams CORRECTLY represents
?
A. B. C. D.
gatecse2024-set1 databases er-diagram
Answer key☟
In the context of owner and weak entity sets in the (Entity-Relationship) data model, which one of the
following statements is TRUE?
A. The weak entity set MUST have total participation in the identifying relationship
B. The owner entity set MUST have total participation in the identifying relationship
C. Both weak and owner entity sets MUST have total participation in the identifying relationship
D. Neither weak entity set nor owner entity set MUST have total participation in the identifying relationship
Consider the following entity relationship diagram , where two entities and have a relation
of cardinality 1:m.
The attributes of are , and where is the key attribute. The attributes of are ,
and where is the key attribute and is a multi-valued attribute. Relation does not have any
attribute. A relational database containing minimum number of tables with each table satisfying the requirements of
the third normal form ( ) is designed from the above . The number of tables in the database is
A. B. C. D.
gateit-2004 databases er-diagram normal
Answer key☟
Consider the entities 'hotel room', and 'person' with a many to many relationship 'lodging' as shown below:
If we wish to store information about the rent payment to be made by person (s) occupying different hotel rooms,
then this information should appear as an attribute of
Answer key☟
For secondary key processing which of the following file organizations is preferred? Give a one line
justification:
Answer key☟
One giga bytes of data are to be organized as an indexed-sequential file with a uniform blocking factor
Assuming a block size of Kilo bytes and a block refrencing pointer size of bits, find out the number of
levels of indexing that would be required and the size of the index at each level. Determine also the size of the
master index. The referencing capability (fanout ratio) per block of index storage may be considered to be .
Answer key☟
An (indexed sequential) file consists of records of size bytes each, including key field of size
bytes. An address of a disk block takes bytes. If the disk block size is bytes and there are
records, compute the size of the data and index areas in terms of number blocks. How many levels of do you
have for the index?
Answer key☟
There is an index file associated with this and it contains the values and . Which one of the fields is the
index built from?
Answer key☟
Answer key☟
Consider a file of records. Each record is long and its key field is of size . The file is
ordered on a non-key field, and the file organization is unspanned. The file is stored in a file system with
block size , and the size of a block pointer is . If the secondary index is built on the key field of
the file, and a multi-level index scheme is used to store the secondary index, the number of first-level and
second-level blocks in the multi-level index are respectively
Answer key☟
Consider a relational table with sufficient number of records, having attributes and let
. Two queries and are given below.
where is a constant
where and are constants.
The database can be configured to do ordered indexing on or hashing on . Which of the following statements
is TRUE?
Answer key☟
An index is clustered, if
Answer key☟
A file is organized so that the ordering of the data records is the same as or close to the ordering of data
entries in some index. Then that index is called
Answer key☟
Consider a database implemented using tree for file indexing and installed on a disk drive with block
size of . The size of search key is and the size of tree/disk pointer is . Assume that
the database has one million records. Also assume that no node of the tree and no records are present initially
in main memory. Consider that each record fits into one disk block. The minimum number of disk accesses required
to retrieve any record in the database is _______
Answer key☟
A data file consisting of student-records is stored on a hard disk with block size of bytes.
The data file is sorted on the primary key . The size of a record pointer for this disk is bytes. Each
student-record has a candidate key attribute called of size bytes. Suppose an index file with records
consisting of two fields, value and the record pointer the corresponding student record, is built and stored
on the same disk. Assume that the records of data file and index file are not split across disk blocks. The number of
blocks in the index file is ________
Answer key☟
Consider a database of fixed-length records, stored as an ordered file. The database has records,
with each record being bytes, of which the primary key occupies bytes. The data file is block-aligned
in that each data record is fully contained within a block. The database is indexed by a primary index file, which is
also stored as a block-aligned ordered file. The figure below depicts this indexing scheme.
Suppose the block size of the file system is bytes, and a pointer to a block occupies bytes. The system
uses binary search on the index file to search for a record with a given key. You may assume that a binary search
on an index file of blocks takes block accesses in the worst case.
Given a key, the number of block accesses required to identify the block in the data file that may contain a record
with the key, in the worst case, is _____________.
Answer key☟
Which of the following file organizations is/are efficient for the scan operation in ?
A. Sorted B. Heap
C. Unclustered tree index D. Unclustered hash index
gatecse2024-set2 databases multiple-selects indexing
Answer key☟
where the primary keys are shown underlined. The number of tuples in the student and Enroll tables are and
respectively. What are the maximum and minimum number of tuples that can be present in (Student * Enroll),
where ‘*’ denotes natural join?
A. B. C. D.
gatecse-2004 databases easy joins natural-join
Answer key☟
A. B. C. D.
gatecse-2012 databases joins normal
Answer key☟
Consider a join (relation algebra) between relations and using the nested loop method. There are
buffers each of size equal to disk block size, out of which one buffer is reserved for intermediate results.
Assuming the join will have fewer number of disk block accesses if
Answer key☟
A database table has records and occupies disk blocks. Another table has records and
occupies disk blocks. These two tables have to be joined as per a specified join condition that needs to
be evaluated for every pair of records from these two tables. The memory buffer space available can hold exactly
one block of records for and one block of records for simultaneously at any point in time. No index is
available on either table.
If Nested-loop join algorithm is employed to perform the join, with the most appropriate choice of table to be used in
outer loop, the number of block accesses required for reading the data are
A. B. C. D.
gateit-2005 databases normal joins
Answer key☟
A database table has records and occupies disk blocks. Another table has records and
occupies disk blocks. These two tables have to be joined as per a specified join condition that needs to
be evaluated for every pair of records from these two tables. The memory buffer space available can hold exactly
one block of records for and one block of records for simultaneously at any point in time. No index is
available on either table.
If, instead of Nested-loop join, Block nested-loop join is used, again with the most appropriate choice of table in the
outer loop, the reduction in number of block accesses required for reading the data will be
A. B. C. D.
gateit-2005 databases normal joins
Answer key☟
5.8.6 Joins: GATE IT 2006 | Question: 14
Consider the relations and with primary keys and respectively. The relation
contains tuples and contains tuples. The maximum size of the join is :
A. B. C. D.
gateit-2006 databases joins natural-join normal
Answer key☟
Let branch, account and depositor be respectively instances of the above schemas. Assume that account and
depositor relations are much bigger than the branch relation.
Consider the following query:
Пc-name (σb-city = "Agra" ⋀ bal < 0 (branch ⋈ (account ⋈ depositor)
Which one of the following queries is the most efficient version of the above query ?
Answer key☟
Consider the following implications relating to functional and multivalued dependencies given below, which
may or may not be correct.
i. if and then
ii. if and then
iii. if and then
iv. if and then
A. B. C. D.
gateit-2007 databases database-normalization multivalued-dependency-4nf normal
Answer key☟
Let r be a relation instance with schema R = (A, B, C, D). We define and . Let
where denotes natural join. Given that the decomposition of into and is lossy, which
one of the following is TRUE?
A. B. C. D.
The relation contains tuples and the relation contains tuples. What is the maximum number of tuples
possible in the natural join ?
A. B. C. D.
gatecse-2010 databases normal natural-join database-normalization
Answer key☟
Answer key☟
EMP contains information about employees. PROJ about projects and involved about which employees involved in
which projects. The underlined attributes are the primary keys for the respective relations.
State in English (in not more than 15 words)
What the following relational algebra expressions are designed to determine
i.
ii.
(Note: conceptually makes a copy of and names it ( is called the rename operator))
Answer key☟
Let and be two relations in which is the foreign key of that refers to the primary key
of . Consider the following four operations and
I. Insert into
II. Insert into
III. Delete from
IV. Delete from
Which of the following can cause violation of the referential integrity constraint above?
Answer key☟
The following table has two attributes and where is the primary key and is the foreign key
referencing with on-delete cascade.
The set of all tuples that must be additionally deleted to preserve referential integrity when the tuple is
deleted is:
A. and B. and
C. and D. and
gatecse-2005 databases referential-integrity normal
Answer key☟
Suppose and are two relation schemas. Let and be the corresponding relation
instances. is a foreign key that refers to in . If data in and satisfy referential integrity
constraints, which of the following is ALWAYS TRUE?
A.
B.
C.
D.
Answer key☟
Answer key☟
Consider the following statements and about the relational data model:
Answer key☟
The first indicates the hotels each customer visits, the second tells which snacks each hotel serves and last
indicates which snacks are liked by each customer. Express the following query in relational algebra:
Print the hotels the serve the snack that customer Rama likes.
Answer key☟
A. Write a relational algebra query to print the roll number of students who have registered for cno
B. Write a SQL query to print the age and year of the youngest student in each year.
Answer key☟
Give a relational algebra expression using only the minimum number of operators from which is
equivalent to
Answer key☟
Express the following queries using (one or more of) SELECT, PROJECT, JOIN and DIVIDE operations.
Answer key☟
Explain in one English sentence, what each of the following relational algebra queries is designed to determine
a.
b.
Answer key☟
EMP contains information about employees. PROJ about projects and involved about which employees involved in
which projects. The underlined attributes are the primary keys for the respective relations.
What is the relational algebra expression containing one or more of which is equivalent to SQL
query.
select eno from EMP|INVOLVED where EMP.eno=INVOLVED.eno and INVOLVED.pno=3
Answer key☟
Given two union compatible relations and , what is the result of the operation
?
A. B. C. D.
Answer key☟
COURSES gives the number and name of all the available courses.
PRE_REQ gives the information about which courses are pre-requisites for a given course.
COMPLETED indicates what courses have been completed by students
Express the following using relational algebra:
List all the courses for which a student with Student_no 2310 has completed all the pre-requisites.
Answer key☟
Consider the join of a relation with a relation . If has tuples and has tuples then the maximum
and minimum sizes of the join respectively are
A. and
B. and
C. and
D. and
Answer key☟
Which of the following queries cannot be expressed using the basic relational algebra operations
?
Answer key☟
Suppose the adjacency relation of vertices in a graph is represented in a table Adj Which of the
following queries cannot be expressed by a relational algebra expression of constant length?
Answer key☟
Let r and s be two relations over the relation schemes R and S respectively, and let A be an attribute in R.
The relational algebra expression is always equal to
A. B.
C. D. None of the above
gatecse-2001 databases relational-algebra
Answer key☟
A university placement center maintains a relational database of companies that interview students on
campus and make job offers to those successful in the interview. The schema of the database is given
below:
The COMPANY relation gives the name and location of the company. The STUDENT relation gives the student’s
roll number, name and the degree program for which the student is registered in the university. The INTERVIEW
relation gives the date on which a student is interviewed by a company. The OFFER relation gives the salary
offered to a student who is successful in a company’s interview. The key for each relation is indicated by the
underlined attributes
a. Write a relational algebra expressions (using only the operators ) for the following queries.
i. List the and of students who attended at least one interview but did not receive
job offer.
ii. List the and of students who went for interviews and received job offers from
company with which they interviewed.
b. Write an SQL query to list, for each degree program in which more than students were offered jobs, the
name of the degree and the average offered salary of students in this degree program.
Answer key☟
A.
B.
C.
D.
Answer key☟
Consider the relation Student (name, sex, marks), where the primary key is shown underlined, pertaining to
students in a class that has at least one boy and one girl. What does the following relational algebra
expression produce? (Note: is the rename operator).
Answer key☟
Answer key☟
where is the key for both schemas. Which of the following queries are equivalent?
I.
II.
III.
IV.
A. Only I and II B. Only I and III C. Only I, II and III D. Only I, III and IV
gatecse-2008 databases relational-algebra normal
Answer key☟
A. B.
C. D.
gatecse-2014-set3 databases relational-algebra easy
Answer key☟
Consider the relational schema given below, where eId of the relation dependent is a foreign key referring
to empId of the relation employee. Assume that every employee has at least one associated dependent in
the dependent relation.
The above query evaluates to the set of empIds of employees whose age is greater than that of
Answer key☟
Answer key☟
Consider a database that has the relation schema CR(StudentName, CourseName). An instance of the
schema CR is as given below.
The following query is made on the database.
Answer key☟
Consider the relations and , where is a primary key and is a foreign key
referencing . Consider the query
Let LOJ denote the natural left outer-join operation. Assume that and contain no null values.
Which of the following is NOT equivalent to ?
A. B.
C. D.
gatecse-2018 databases relational-algebra normal 2-marks
Answer key☟
Answer: ________
Answer key☟
The following relation records the age of employees of a company, where (indicating the
employee number) is the key:
Answer key☟
Which of the following relational algebra expressions return the set of who own all the brands?
A.
B.
C.
D.
Answer key☟
Answer key☟
The relation schema, Person (pid, city), describes the city of residence for every person uniquely identified
by pid. The following relational algebra operators are available: selection, projection, cross product, and
rename.
To find the list of cities where at least persons reside, using the above operators, the minimum number of cross
product operations that must be used is
A. B. C. D.
gatecse2024-set2 databases relational-algebra
Answer key☟
Answer key☟
A table 'student' with schema (roll, name, hostel, marks), and another table 'hobby' with schema (roll,
hobbyname) contains records as shown below:
The following SQL query is executed on the above tables:
select hostel
from student natural join hobby
where marks >= 75 and roll between 2000 and 3000;
Relations and with the same schema as those of these two tables respectively contain the same information
as tuples. A new relation is obtained by the following relational algebra operation:
The difference between the number of rows output by the SQL statement and the number of tuples in is
A. B. C. D.
gateit-2005 databases sql relational-algebra normal
Answer key☟
The following relations are used to store data about students, courses, enrollment of students in courses and
teachers of courses. Attributes for primary key in each relation are marked by ‘*’.
Students (rollno*, sname, saddr)
courses (cno*, cname)
enroll(rollno*, cno*, grade)
teach(tno*, tname, cao*)
(cno is course number cname is course name, tno is teacher number, tname is teacher name, sname is student
name, etc.)
Write a SQL query for retrieving roll number and name of students who got A grade in at least one course taught by
teacher names Ramesh for the above relational database.
Answer key☟
The following relations are used to store data about students, courses, enrollment of students in courses and
teachers of courses. Attributes for primary key in each relation are marked by
Answer key☟
Which of the following query transformations (i.e., replacing the l.h.s. expression by the r.h.s expression) is
incorrect? R1 and R2 are relations, C1 and C2 are selection conditions and A1 and A2 are attributes of R1.
A.
B.
C.
D.
Answer key☟
The relational algebra expression equivalent to the following tuple calculus expression:
is
A. B.
C. D.
gate1999 databases relational-calculus normal
Answer key☟
A.
B.
C.
D.
Answer key☟
5.14.6 Relational Calculus: GATE CSE 2002 | Question: 1.20
With regards to the expressive power of the formal relational query languages, which of the following
statements is true?
Answer key☟
Let and be two relation schema, where the primary keys are shown underlined,
and let C be a foreign key in referring to . Suppose there is no violation of the above referential
integrity constraint in the corresponding relation instances and . Which of the following relational algebra
expressions would necessarily produce an empty relation?
A. B.
C. D.
gatecse-2004 databases relational-calculus easy
Answer key☟
Consider the relation employee(name, sex, supervisorName) with name as the key, supervisorName gives
the name of the supervisor of the employee under consideration. What does the following Tuple Relational
Calculus query produce?
Answer key☟
I.
II.
III.
IV.
A. I only B. II only C. III only D. III and IV only
gatecse-2008 databases relational-calculus normal
Answer key☟
Let and be relational schemes such that and Now consider the following
queries on the database:
1.
2.
3.
4. Select R.a,R.b
From R,S
Where R.c = S.c
Answer key☟
II.
III.
IV.
Answer key☟
Consider a database that has the relation schemas EMP(EmpId, EmpName, DeptId), and DEPT(DeptName,
DeptId). Note that the DeptId can be permitted to be NULL in the relation EMP. Consider the following
queries on the database expressed in tuple relational calculus.
A. I and II only B. I and III only C. II and III only D. I, II and III
gatecse-2017-set1 databases relational-calculus safe-query normal
Answer key☟
Which of the following relational query languages have the same expressive power?
I. Relational algebra
II. Tuple relational calculus restricted to safe expressions
III. Domain relational calculus restricted to safe expressions
A. II and III only B. I and II only C. I and III only D. I, II and III
gateit-2006 databases relational-algebra relational-calculus easy
Answer key☟
Consider a selection of the form , where is a relation with tuples. Assume that the attribute
values for among the tuples are uniformly distributed in the interval Which one of the following
options is the best estimate of the number of tuples returned by the given selection query ?
A. B. C. D.
gateit-2007 databases relational-calculus probability normal
Answer key☟
If a student needs to score more than 35 marks to pass an exam, what does the query return?
Answer key☟
Which one of the options given below refers to the degree (or arity) of a relation in relational database
systems?
Answer key☟
Describe the relational algebraic expression giving the relation returned by the following SQL query.
Select SNAME
from S
Where SNOin
(select SNO
from SP
where PNOin
(select PNO
from P
Where COLOUR='BLUE'))
Answer key☟
Select SNAME
from S
Where SNOin
(select SNO
from SP
where PNOin
(select PNO
from P
Where COLOUR='BLUE'))
What relations are being used in the above SQL query? Given at least two attributes of each of these relations.
Answer key☟
The queries regarding data in the above database are formulated below in SQL. Describe in ENGLISH sentences
the two queries that have been posted:
i. SELECT ename
FROM employees
WHERE eno IN
(SELECT eno
FROM working
GROUP BY eno
HAVING COUNT(*)=
(SELECT COUNT(*)
FROM projects))
Answer key☟
PART (PCODE,PNAME,PDESC,CITY).
PROJECTS (PRCODE,PRNAME,PRCITY).
SPPR (SCODE,PCODE,PRCODE,QTY).
i. Get SCODE values for suppliers who supply to both projects PR1 and PR2.
ii. Get PRCODE values for projects supplied by at least one supplier not in the same city.
Answer key☟
i. Print PCODE values for parts supplied to any project in DEHLI by a supplier in DELHI.
ii. Print all triples <CITY, PCODE, CITY> such that a supplier in first city supplies the specified part to a project in
the second city, but do not print the triples in which the two CITY values are same.
Answer key☟
(Assume that each student likes at least one ice-cream and frequents at least one parlor)
Express the following in SQL:
Print the students that frequent at least one parlor that serves some ice-cream that they like.
Answer key☟
Answer key☟
Answer key☟
Answer key☟
select distinct w, x
from r, s
Answer key☟
In SQL, relations can contain null values, and comparisons with null values are treated as unknown.
Suppose all comparisons with a null value are treated as false. Which of the following pairs is not
equivalent?
A.
B. and where is an integer
C.
D. none of the above
Answer key☟
Answer key☟
Consider a relation geq which represents "greater than or equal to", that is, geq only if .
create table geq
(
ib integer not null,
ub integer not null,
primary key ib,
foreign key (ub) references geq on delete cascade
);
A. A tuple (z,w) with z > y is deleted B. A tuple (z,w) with z > x is deleted
C. A tuple (z,w) with w < x is deleted D. The deletion of (x,y) is prohibited
gatecse-2001 databases sql normal
Answer key☟
Consider a relation examinee (regno, name, score), where regno is the primary key to score is a real
number.
Write a relational algebra using to find the list of names which appear more than once in examinee.
Answer key☟
Consider a relation examinee (regno, name, score), where regno is the primary key to score is a real
number.
Write an SQL query to list the regno of examinees who have a score greater than the average score.
Answer key☟
Answer key☟
Consider the set of relations shown below and the SQL query that follows.
Students: (Roll_number, Name, Date_of_birth)
Courses: (Course_number, Course_name, Instructor)
Grades: (Roll_number, Course_number, Grade)
Select distinct Name
from Students, Courses, Grades
where Students.Roll_number=Grades.Roll_number
and Courses.Instructor = 'Korth'
and Courses.Course_number = Grades.Course_number
and Grades.Grade = 'A'
A. Names of students who have got an A grade in all courses taught by Korth
B. Names of students who have got an A grade in all courses
C. Names of students who have got an A grade in at least one of the courses taught by Korth
D. None of the above
Answer key☟
A. the average salary is more than the average salary in the company
B. the average salary of male employees is more than the average salary of all male employees in the company
C. the average salary of male employees is more than the average salary of employees in same the department
D. the average salary of male employees is more than the average salary in the company
Answer key☟
The relation book (title, price) contains the titles and prices of different books. Assuming that no two books
have the same price, what does the following SQL query list?
select title
from book as B
where (select count(*)
from book as T
where T.price>B.price) < 5
Answer key☟
Consider the relation account (customer, balance) where the customer is a primary key and there are no null
values. We would like to rank customers according to decreasing balance. The customer with the largest
balance gets rank Ties are not broke but ranks are skipped: if exactly two customers have the largest balance
they each get rank and rank is not assigned.
1. Query will produce the same row set as Query for some but not all databases.
2. Both Query and Query are a correct implementation of the specification
3. Query is a correct implementation of the specification but Query is not
4. Neither Query nor Query is a correct implementation of the specification
5. Assigning rank with a pure relational query takes less time than scanning in decreasing balance order
assigning ranks using ODBC.
Answer key☟
Consider the relation enrolled (student, course) in which (student, course) is the primary key, and the relation
paid (student, amount) where student is the primary key. Assume no null values and no foreign keys or
integrity constraints.
Given the following four queries:
Query1:
select student from enrolled where student in (select student from paid)
Query2:
select student from paid where student in (select student from enrolled)
Query3:
select E.student from enrolled E, paid P where E.student = P.student
Query4:
select student from paid where exists
(select * from enrolled where enrolled.student = paid.student)
Answer key☟
5.16.22 SQL: GATE CSE 2006 | Question: 69
Consider the relation enrolled (student, course) in which (student, course) is the primary key, and the relation
paid (student, amount) where student is the primary key. Assume no null values and no foreign keys or
integrity constraints. Assume that amounts and were each paid by of the
students. Consider these query plans (Plan 1 on left, Plan 2 on right) to “list all courses taken by students who have
paid more than x”
A disk seek takes disk data transfer bandwidth is MB/s and checking a tuple to see if amount is greater
than takes µ Which of the following statements is correct?
A. Plan 1 and Plan 2 will not output identical row sets for all databases
B. A course may be listed more than once in the output of Plan 1 for some databases
C. For Plan 1 executes faster than Plan 2 for all databases
D. For Plan I executes slower than Plan 2 for all databases
Answer key☟
Consider the table employee(empId, name, department, salary) and the two queries below.
Assuming that department has more than one employee, and we want to find the employees who get
higher salary than anyone in the department which one of the statements is TRUE for any arbitrary employee
table?
Select e.empId
From employee e
Where not exists
(Select * From employee s Where s.department = "5" and s.salary >= e.salary)
Select e.empId
From employee e
Where e.salary > Any
(Select distinct salary From employee s Where s.department = "5")
Answer key☟
SELECT S.sname
FROM Suppliers S
WHERE S.sid NOT IN (SELECT C.sid
FROM Catalog C
WHERE C.pid NOT IN (SELECT P.pid
FROM Parts P
WHERE P.color<>'blue'))
Assume that relations corresponding to the above schema are not empty. Which one of the following is the correct
interpretation of the above query?
A. Find the names of all suppliers who have supplied a non-blue part.
B. Find the names of all suppliers who have not supplied a non-blue part.
C. Find the names of all suppliers who have supplied only non-blue part.
D. Find the names of all suppliers who have not supplied only blue parts.
Answer key☟
Assume that, in the suppliers relation above, each supplier and each street within a city has 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 about the above schema?
Answer key☟
A. B. C. D.
gatecse-2010 databases sql normal
Answer key☟
Consider a database table T containing two columns and each of type . After the creation of the
table, one record is inserted in the table.
Let and denote the respective maximum values of and among all records in the table at any point in
time. Using and , new records are inserted in the table times with and values being
respectively. It may be noted that each time after the insertion, values of and
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. B. C. D.
gatecse-2011 databases sql normal
Answer key☟
Answer key☟
Answer key☟
How many tuples does the result of the following SQL query contain?
SELECT A.Id
FROM A
WHERE A.Age > ALL (SELECT B.Age
FROM B
WHERE B.Name = ‘Arun’)
A. B. C. D.
gatecse-2012 databases sql normal
Answer key☟
Answer key☟
5.16.32 SQL: GATE CSE 2014 Set 1 | Question: 54
Answer key☟
SQL allows duplicate tuples in relations, and correspondingly defines the multiplicity of tuples in the result of
joins. Which one of the following queries always gives the same answer as the nested query shown below:
select * from R where a in (select S.a from S)
Answer key☟
A. Names of all the employees with at least one of their customers having a ‘GOOD’ rating.
B. Names of all the employees with at most one of their customers having a 'GOOD' rating.
C. Names of all the employees with none of their customers having a 'GOOD' rating.
D. Names of all the employees with all their customers having a 'GOOD' rating.
Answer key☟
5.16.35 SQL: GATE CSE 2015 Set 1 | Question: 27
The numbers of rows that will be returned by the SQL query is_________________.
Answer key☟
such that it always finds the addresses of theaters with maximum capacity?
Answer key☟
Answer key☟
Consider a database that has the relation schema EMP (EmpId, EmpName, and DeptName). An instance of
the schema EMP and a SQL query on it are given below:
SELECT AVG(EC.Num)
FROM EC
WHERE (DeptName, Num) IN
(SELECT DeptName, COUNT(EmpId) AS
EC(DeptName, Num)
FROM EMP
GROUP BY DeptName)
Answer key☟
5.16.39 SQL: GATE CSE 2017 Set 2 | Question: 46
Answer key☟
Query 2:
SELECT B.isbn, S.copies FROM Book B LEFT OUTER JOIN Stock S ON B.isbn=S.isbn;
Query 3:
SELECT B.isbn, S,copies FROM Book B RIGHT OUTER JOIN Stock S ON B.isbn=S.isbn
Query 4:
SELECT B.isbn, S.copies FROM Book B FULL OUTER JOIN Stock S ON B.isbn=S.isbn
Which one of the queries above is certain to have an output that is a superset of the outputs of the other three
queries?
A relational database contains two tables Student and Performance as shown below:
The primary key of the Student table is Roll_no. For the performance table, the columns Roll_no. and Subject_code
together form the primary key. Consider the SQL query given below:
SELECT S.Student_name, sum(P.Marks)
FROM Student S, Performance P
WHERE P.Marks >84
GROUP BY S.Student_name;
Answer key☟
The primary key of each table is indicated by underlining the constituent fields.
SELECT s.sno, s.sname
FROM Suppliers s, Catalogue c
WHERE s.sno=c.sno AND
cost > (SELECT AVG (cost)
FROM Catalogue
WHERE pno = ‘P4’
GROUP BY pno) ;
A. B. C. D.
gatecse-2020 databases sql 1-mark
Answer key☟
5.16.43 SQL: GATE CSE 2021 Set 1 | Question: 23
A relation in a relational database has tuples. The attribute has integer values ranging from
to , and the attribute has integer values ranging from to . Assume that the attributes and are
independently distributed.
Answer key☟
The relation scheme given below is used to store information about the employees of a company, where
is the key and indicates the department to which the employee is assigned. Each employee is
assigned to exactly one department.
The above query gives, for each department in the company, the number of female employees whose salary is
greater than the average salary of
Answer key☟
Consider the relational database with the following four schemas and their respective instances.
Answer key☟
Consider the following table named in a relational database. The primary key of this table is
Answer key☟
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
Arjun
Ankush
Sunil
Reza
Pratham
Gopal
Team
City ID BidPoints
Jaipur
Patna
Hyderabad
Jaipur
Patna
Jaipur
Answer key☟
An OTT company is maintaining a large disk-based relational database of different movies with the following
schema:
This SQL query can be sped up using which of the following indexing options?
Answer key☟
A relational database contains two tables student and department in which student table has columns
roll_no, name and dept_id and department table has columns dept_id and dept_name. The following insert
statements were executed successfully to populate the empty tables:
Insert into department values (1, 'Mathematics')
Insert into department values (2, 'Physics')
Insert into student values (l, 'Navin', 1)
Insert into student values (2, 'Mukesh', 2)
Insert into student values (3, 'Gita', 1)
How many rows and columns will be retrieved by the following SQL statement?
Select * from student, department
Answer key☟
A. B. C. D.
gateit-2004 databases sql normal
Answer key☟
Consider two tables in a relational database with columns and rows as follows:
Roll_no is the primary key of the Student table, Dept_id is the primary key of the Department table and
Student.Dept_id is a foreign key from Department.Dept_id
What will happen if we try to execute the following two SQL statements?
Answer key☟
In an inventory management system implemented at a trading corporation, there are several tables
designed to hold all the information. Amongst these, the following two tables hold information on which items
are supplied by which suppliers, and which warehouse keeps which items along with the stock-level of these items.
Supply = (supplierid, itemcode)
Inventory = (itemcode, warehouse, stocklevel)
For a specific information required by the management, following SQL query has been written
Select distinct STMP.supplierid
From Supply as STMP
Where not unique (Select ITMP.supplierid
From Inventory, Supply as ITMP
Where STMP.supplierid = ITMP.supplierid
And ITMP.itemcode = Inventory.itemcode
And Inventory.warehouse = 'Nagpur');
For the warehouse at Nagpur, this query will find all suppliers who
A. do not supply any item B. supply exactly one item
C. supply one or more items D. supply two or more items
gateit-2005 databases sql normal
Answer key☟
Consider a database with three relation instances shown below. The primary keys for the Drivers and Cars
relation are did and cid respectively and the records are stored in ascending order of these primary keys as
given in the tables. No indexing is available in the database.
Answer key☟
Consider a database with three relation instances shown below. The primary keys for the Drivers and Cars
relation are did and cid respectively and the records are stored in ascending order of these primary keys as given in
the tables. No indexing is available in the database.
select D.dname
from Drivers D
where D.did in (
select R.did
from Cars C, Reserves R
where R.cid = C.cid and C.colour = 'red'
intersect
select R.did
from Cars C, Reserves R
where R.cid = C.cid and C.colour = 'green'
)
Let be the number of comparisons performed when the above SQL query is optimally executed. If linear search is
used to locate a tuple in a relation using primary key, then lies in the range:
A. B. C. D.
gateit-2006 databases sql normal
Answer key☟
A. for each school with more than students appearing in exams, the name of the school and the number of
scored by its students
B. for each school with more than students in it, the name of the school and the number of scored by its
students
C. for each school with more than students in it, the name of the school and the number of its students scoring
in at least one exam
D. nothing; the query has a syntax error
Answer key☟
A. This schedule is serializable and can occur in a scheme using 2PL protocol
B. This schedule is serializable but cannot occur in a scheme using 2PL protocol
C. This schedule is not serializable but can occur in a scheme using 2PL protocol
D. This schedule is not serializable and cannot occur in a scheme using 2PL protocol
Answer key☟
5.17.2 Transaction and Concurrency: GATE CSE 2003 | Question: 29, ISRO2009-73
Which of the following scenarios may lead to an irrecoverable error in a database system?
Answer key☟
Consider three data items and and the following execution schedule of transactions
and In the diagram, and denote the actions reading and writing the data item
respectively.
Which of the following statements is correct?
Answer key☟
5.17.4 Transaction and Concurrency: GATE CSE 2006 | Question: 20, ISRO2015-17
Consider the following log sequence of two transactions on a bank account, with initial balance that
transfer to a mortgage payment and then apply a interest.
1. T1 start
2. T1 B old new
3. T1 M old new
4. T1 commit
5. T2 start
6. T2 B old new
7. T2 commit
Suppose the database system crashes just before log record is written. When the system is restarted, which one
statement is true of the recovery procedure?
Answer key☟
Consider the following schedules involving two transactions. Which one of the following statements is
TRUE?
A. Both and are conflict serializable.
B. is conflict serializable and is not conflict serializable.
C. is not conflict serializable and is conflict serializable.
D. Both and are not conflict serializable.
Answer key☟
Consider two transactions and , and four schedules , of and as given below:
A. B. C. only D. only
gatecse-2009 databases transaction-and-concurrency normal
Answer key☟
Which of the following concurrency control protocols ensure both conflict serializability and freedom from
deadlock?
I. -phase locking
II. Time-stamp ordering
A. I only B. II only C. Both I and II D. Neither I nor II
gatecse-2010 databases transaction-and-concurrency normal
Answer key☟
Which one of the schedules below is the correct serialization of the above?
A. B.
C. D.
gatecse-2010 databases transaction-and-concurrency normal
Answer key☟
Consider the following transactions with data items and initialized to zero:
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
Answer key☟
The constraint that the sum of the accounts and should remain constant is that of
Answer key☟
Consider a simple checkpointing protocol and the following set of operations in the log.
(start, T4); (write, T4, y, 2, 3); (start, T1); (commit, T4); (write, T1, z, 5, 7);
(checkpoint);
(start, T2); (write, T2, x, 1, 9); (commit, T2); (start, T3); (write, T3, z, 7, 2);
If a crash happens now and the system tries to recover using both undo and redo operations, what are the contents
of the undo list and the redo list?
Answer key☟
Consider the partial Schedule involving two transactions and . Only the and the
operations have been shown. The operation on data item is denoted by and
operation on data item is denoted by .
Suppose that the transaction fails immediately after time instance 9. Which of the following statements is
correct?
A. must be aborted and then both and must be re-started to ensure transaction atomicity
B. Schedule is non-recoverable and cannot ensure transaction atomicity
C. Only must be aborted and then re-started to ensure transaction atomicity
D. Schedule is recoverable and can ensure transaction atomicity and nothing else needs to be done
Answer key☟
Which one of the following is NOT a part of the ACID properties of database transactions?
Answer key☟
Consider the following two phase locking protocol. Suppose a transaction accesses (for read or write
operations), a certain set of objects . This is done in the following manner:
Answer key☟
Answer key☟
Answer key☟
In a database system, unique timestamps are assigned to each transaction using Lamport's logical clock.
Let and be the timestamps of transactions and respectively. Besides, holds a
lock on the resource and has requested a conflicting lock on the same resource The following algorithm is
used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same
timestamp.
if then
is killed
else waits.
Assume any transaction that is not killed terminates eventually. Which of the following is TRUE about the database
system that uses the above algorithm to prevent deadlocks?
Answer key☟
I. Strict two-phase locking protocol generates conflict serializable schedules that are also recoverable.
II. Timestamp-ordering concurrency control protocol with Thomas’ Write Rule can generate view
serializable schedules that are not conflict serializable
Here, RX stands for “Read(X)” and WX stands for “Write(X)”. Which one of the following schedules is conflict
equivalent to the above schedule?
A.
B.
C.
D.
Answer key☟
Suppose a database system crashes again while recovering from a previous crash. Assume checkpointing
is not done by the database either during the transactions or during recovery.
Which of the following statements is/are correct?
A. The same undo and redo list will be used while recovering again
B. The system cannot recover any further
C. All the transactions that are already undone and redone will not be recovered again
D. The database will become inconsistent
Answer key☟
Which of the following statements about the Two Phase Locking ( ) protocol is/are TRUE?
Answer key☟
5.17.22 Transaction and Concurrency: GATE CSE 2024 | Set 2 | Question: 9
Once the informs the user that a transaction has been successfully completed, its effect should
persist even if the system crashes before all its changes are reflected on disk. This property is called
Answer key☟
Which level of locking provides the highest degree of concurrency in a relational database ?
A. Page
B. Table
C. Row
D. Page, table and row level locking allow the same degree of concurrency
Answer key☟
A. is serializable only as
B. is serializable only as
C. is serializable both as and
D. is not serializable either as or as
Answer key☟
Amongst the ACID properties of a transaction, the 'Durability' property requires that the changes made to the
database by a successful transaction persist
Answer key☟
A company maintains records of sales made by its salespersons and pays them commission based on each
individual's total sales made in a year. This data is maintained in a table with following schema:
salesinfo = (salespersonid, totalsales, commission)
In a certain year, due to better business results, the company decides to further reward its salespersons by
enhancing the commission paid to them as per the following formula:
If commission enhance it by
If commission enhance it by
If commission enhance it by
The IT staff has written three different SQL scripts to calculate enhancement for each slab, each of these scripts is
to run as a separate transaction as follows:
T1 Update salesinfo
Set commission = commission * 1.02
Where commission < = 50000;
T2 Update salesinfo
Set commission = commission * 1.04
Where commission > 50000 and
commission is < = 100000;
T3 Update salesinfo
Set commission = commission * 1.06
Where commission > 100000;
Which of the following options of running these transactions will update the commission of all salespersons correctly
Answer key☟
Which of the following schemes, using shared and exclusive locks, satisfy the requirements for strict two phase
locking for the above transactions?
A.
B.
C.
D.
Answer key☟
5.17.28 Transaction and Concurrency: GATE IT 2008 | Question: 63
Consider the following three schedules of transactions T1, T2 and T3. [Notation: In the following NYO
represents the action Y (R for read, W for write) performed by transaction N on object O.]
Answer key☟
Answer Keys
5.1.1 N/A 5.1.2 N/A 5.1.3 N/A 5.1.4 N/A 5.1.5 B
5.1.6 N/A 5.1.7 B 5.1.8 N/A 5.1.9 N/A 5.1.10 N/A
5.1.11 C 5.1.12 B 5.1.13 C 5.1.14 D 5.1.15 A
5.1.16 C 5.1.17 C 5.1.18 B 5.1.19 5 5.1.20 50
5.1.21 A 5.1.22 52 5.1.23 B 5.1.24 A 5.1.25 C
5.1.26 A 5.1.27 C 5.1.28 A 5.1.29 A 5.2.1 N/A
5.2.2 A 5.2.3 8 5.2.4 19 5.2.5 B 5.3.1 D
5.3.2 C 5.3.3 A 5.3.4 54 5.3.5 B 5.3.6 B
5.3.7 A 5.3.8 B;C;D 5.4.1 False 5.5.1 True 5.5.2 N/A
5.5.3 N/A 5.5.4 N/A 5.5.5 N/A 5.5.6 N/A 5.5.7 A;B;D
5.5.8 False 5.5.9 N/A 5.5.10 A 5.5.11 D 5.5.12 N/A
5.5.13 B 5.5.14 D 5.5.15 B 5.5.16 C 5.5.17 A
5.5.18 N/A 5.5.19 C 5.5.20 C 5.5.21 D 5.5.22 B
5.5.23 C 5.5.24 D 5.5.25 C 5.5.26 D 5.5.27 C
5.5.28 C 5.5.29 B 5.5.30 A 5.5.31 B 5.5.32 A
5.5.33 C 5.5.34 B 5.5.35 B 5.5.36 A 5.5.37 B
5.5.38 C 5.5.39 A 5.5.40 A 5.5.41 A;C;D 5.5.42 8
5.5.43 A 5.5.44 A;C 5.5.45 B;C;D 5.5.46 50 5.5.47 A;B;D
5.5.48 Q-Q 5.5.49 B 5.5.50 A 5.5.51 B 5.5.52 B
5.5.53 A 5.5.54 D 5.5.55 A 5.6.1 B 5.6.2 B
5.6.3 A 5.6.4 C 5.6.5 4 5.6.6 C 5.6.7 A
5.6.8 A 5.6.9 D 5.6.10 A 5.6.11 B 5.6.12 C
5.7.1 N/A 5.7.2 N/A 5.7.3 3 5.7.4 C 5.7.5 A
5.7.6 C 5.7.7 C 5.7.8 C 5.7.9 C 5.7.10 4
5.7.11 698 : 698 5.7.12 6 5.7.13 A;B 5.8.1 A 5.8.2 A
5.8.3 A 5.8.4 C 5.8.5 B 5.8.6 A 5.8.7 A
5.9.1 C 5.10.1 C 5.10.2 A 5.10.3 C 5.11.1 N/A
5.12.1 B 5.12.2 C 5.12.3 A 5.12.4 0.00 5.12.5 D
5.13.1 N/A 5.13.2 N/A 5.13.3 N/A 5.13.4 N/A 5.13.5 N/A
5.13.6 N/A 5.13.7 D 5.13.8 N/A 5.13.9 B 5.13.10 C
5.13.11 D 5.13.12 C 5.13.13 N/A 5.13.14 A 5.13.15 D
5.13.16 B 5.13.17 D 5.13.18 A 5.13.19 D 5.13.20 D
5.13.21 4 5.13.22 C 5.13.23 1 5.13.24 C 5.13.25 A;B
5.13.26 2 5.13.27 B 5.13.28 C 5.13.29 B 5.14.1 N/A
5.14.2 N/A 5.14.3 D 5.14.4 C 5.14.5 C 5.14.6 C
5.14.7 B 5.14.8 C 5.14.9 C 5.14.10 A 5.14.11 A
5.14.12 D 5.14.13 D 5.14.14 D 5.14.15 C 5.15.1 A
5.16.1 N/A 5.16.2 N/A 5.16.3 N/A 5.16.4 N/A 5.16.5 N/A
5.16.6 N/A 5.16.7 D 5.16.8 N/A 5.16.9 N/A 5.16.10 A
5.16.11 C 5.16.12 N/A 5.16.13 C 5.16.14 N/A 5.16.15 N/A
5.16.16 N/A 5.16.17 C 5.16.18 D 5.16.19 D 5.16.20 C
5.16.21 B 5.16.22 C 5.16.23 A 5.16.24 X 5.16.25 A
5.16.26 C 5.16.27 A 5.16.28 C 5.16.29 C 5.16.30 B
5.16.31 D 5.16.32 B 5.16.33 C 5.16.34 D 5.16.35 2
5.16.36 A 5.16.37 2 5.16.38 2.6 5.16.39 7 5.16.40 D
5.16.41 5 5.16.42 A 5.16.43 819 : 820 ; 205 : 205 5.16.44 B 5.16.45 2
5.16.46 2 5.16.47 3 5.16.48 A;B 5.16.49 D 5.16.50 C
5.16.51 C 5.16.52 D 5.16.53 A 5.16.54 B 5.16.55 D
5.17.1 D 5.17.2 D 5.17.3 D 5.17.4 B 5.17.5 C
5.17.6 B 5.17.7 B 5.17.8 A 5.17.9 B 5.17.10 B
5.17.11 A 5.17.12 B 5.17.13 D 5.17.14 A 5.17.15 A
5.17.16 C 5.17.17 A 5.17.18 C 5.17.19 A 5.17.20 A
5.17.21 A;C;D 5.17.22 A 5.17.23 C 5.17.24 X 5.17.25 D
5.17.26 D 5.17.27 C 5.17.28 D