MCQ
on various aspects in DBMS including database schedules, indexing, data storage, normalization, database views, query optimizers and multivalued dependency questions with answers, RDBMS
Multiple Choice Questions with Answers
Database management systems - MCQ exam questions
1. Consider a B+
tree of order 100. One of the non-leaf nodes has 95 pointers. How many keys
will that node contain?
a) 95
b) 94
c) 100
d) 47
Click here to view answer
Ans : (b)
Answer: (b) 94
The number of
keys in a non-leaf node is 1 less the number of pointers in that node.
Few properties of
B+ tree
- B+ tree is a balanced binary search
tree, hence all leaf nodes are at the same level. That is, all leaf
nodes are at the same height from the root.
- If the root node is not a leaf, then
it has at least two children.
- In a tree of order (branching
factor) m, each node, except root and leaf, can have a maximum of m children and at least m/2 children.
- Each node can contain a maximum of m - 1 keys and a minimum of ⌈m/2⌉ - 1 keys.
- The number of keys in a non-leaf node
is p-1 where p is the number of pointers.
|
2. Consider a B+
tree of order 100. One of the leaf nodes has 90 pointers. How many keys will
that node contain?
a) 90
b) 100
c) 89
d) 91
Click here to view
answer
Ans : (c)
Answer: (c) 89
A leaf node with 𝑛 keys needs 𝑛+1 pointers (𝑛 pointers to the actual data and 1 pointer to its
sibling).
In this question,
it is given that the total number of pointers in a leaf node is 90. That is
89 for actual data and 1 for sibling node.
|
3. Consider a
database file that consists of 1000 fixed-length records. The size of each
record is 300 bytes. This file has to be stored in disk blocks of size 1024
bytes, with no spanning of records. How many blocks will be needed to store
this file?
a) 300
b) 1000
c) 334
d) 332
Click here to view
answer
Ans : (c)
Answer: (c) 334
For
unspanned records, the blocking factor (bfr) = floor(B/R).
Here, B is the
disk block size and R is the record size.
Hence, bfr =
floor(1024/300) = floor(3.413) = 3.
Number
of blocks needed to store = ceiling(r/bfr).
Here, r is the
number of records in the table.
Number of blocks
needed = ceiling(1000/3) = ceiling(333.33) = 334.
|
4. Which of the following
is/are most suitable for the given schedule S1?
Schedule
S1 = W1(X), W2(Y), W3(Z), C1,
R3(X), C2, R3(Y), C3
Here, W and R
represent write and read operations respectively, numbers in the suffix
represents the transaction id, letters inside bracket represent data items, and
C1, C2, C3 are commit instructions.
a) Conflict-serializable
schedule
b) Recoverable
schedule
c) Not conflict-serializable
schedule
d) Not-recoverable
schedule
Click here to view
answer
Ans : (a) and (b)
Answer: (a) Conflict-serializable schedule and (b) Recoverable
schedule
Transaction T3
reads data items X and Y that are written by transaction T1 and T2 respectively.
Schedule S1 is recoverable because the commit instruction
of T1 and T2 appears before that of T3.
The precedence graph for S1 does not have
any cycles. Hence, S1 is conflict-serializable.
Precedence graph:
Recoverable schedule
A recoverable schedule is one where,
for each pair of transactions Ti and
Tj such that Tj reads a data item previously written
by Ti, the commit operation
of Ti appears before the
commit operation of Tj.
|
5. Which of the following
is/are most suitable for the given schedule S2?
Schedule
S2 = R1(X), W2(X), W2(Y), C2,
R1(Y), C1
a) Conflict-serializable
schedule
b) Recoverable
schedule
c) Not conflict-serializable
schedule
d) Not-recoverable
schedule
Click here to view
answer
Ans : (b) and (c)
Answer: (b) Recoverable schedule and (c) Not
conflict-serializable schedule
This schedule is recoverable because T1 reads a data item that is
written by T2 and T1 commits after T2.
The schedule is not conflit-serializable because it has cycle in the
precedence graph.
|
************************
Related posts:
Quiz questions with answers on DBMS introduction concepts
How many keys a leaf node can have in a B+ tree in DBMS
How many pointers a non-leaf node can have in a B+ tree in DBMS
what are the properties of B+ tree
how many disk blocks required to store a database file of fixed size records with no spanning of records
List down all the recoverable and conflict serializable schedules
No comments:
Post a Comment