Database miscellaneous


Database miscellaneous

  1. In a database system, unique timestamps are assigned to each transaction using Lamport’s logical clock. Let TS( T1) and TS(T2) be the timestamps of transactions T1 and T2 respectively. Besides, T1 holds a lock on the resource R and T2 has requested a conflicting lock on the same resource R. The following algorithm is used to prevent deadlocks in the database system assuming that a killed transaction is restarted with the same timestamp.
    if TS(T2) < TS(T1) then
    T1 is killed
    else T2 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?









  1. View Hint View Answer Discuss in Forum

    The given two transaction TS (T1) and TS (T2), in which T1 holds lock on resource R, T2 requires conflict lock on same resource R and T2 wait for graph.
    If (TS(T2) < TS (T1)).
    Then T1 killed.
    (If restart with same TS value).
    Else T2 waits.
    This process shows avoids both deadlock and starvation because the transaction, who got killed will be starting with same time stamps and both are not waiting for each other.
    Hence, option (a) is correct.

    Correct Option: A

    The given two transaction TS (T1) and TS (T2), in which T1 holds lock on resource R, T2 requires conflict lock on same resource R and T2 wait for graph.
    If (TS(T2) < TS (T1)).
    Then T1 killed.
    (If restart with same TS value).
    Else T2 waits.
    This process shows avoids both deadlock and starvation because the transaction, who got killed will be starting with same time stamps and both are not waiting for each other.
    Hence, option (a) is correct.


  1. B+ trees are preferred to binary trees in databases because









  1. View Hint View Answer Discuss in Forum

    We know that indexing is better if the data block is large. Now, B+ trees are preferred over the binary search trees as in B+ trees, transfer of data is in form of data blocks. These data blocks can store large information while transferring, information on a single block is more efficient.

    Correct Option: B

    We know that indexing is better if the data block is large. Now, B+ trees are preferred over the binary search trees as in B+ trees, transfer of data is in form of data blocks. These data blocks can store large information while transferring, information on a single block is more efficient.



  1. In the index allocation scheme of blocks to a file, the maximum possible size of the file depends on









  1. View Hint View Answer Discuss in Forum

    As per the definition and the process of index allocation scheme for blocks in a file, the maximum possible size of file depends on the number of blocks used for index and the size of the blocks.

    Correct Option: B

    As per the definition and the process of index allocation scheme for blocks in a file, the maximum possible size of file depends on the number of blocks used for index and the size of the blocks.


  1. A B+ tree index is to be built on the name attribute of the relation STUDENT. Assume that all student names are of length 8 byte, disk blocks are of size 512 byte and index pointers are of size 4 byte. Given this scenario, what would be the best choice of the degree (i.e., the number of pointers per node) of the B+ tree?









  1. View Hint View Answer Discuss in Forum

    Size of 1 record of index = 8 + 4 = 12 bytes.
    Let no. of pointers required = P
    No. of index values per block = P – 1
    So (P – 1) 8 + 4P = 512
    12P = 520 or 12. P < = 520
    P < = 43

    Correct Option: C

    Size of 1 record of index = 8 + 4 = 12 bytes.
    Let no. of pointers required = P
    No. of index values per block = P – 1
    So (P – 1) 8 + 4P = 512
    12P = 520 or 12. P < = 520
    P < = 43



  1. The order of an internal node in a B+ tree index is the maximum number of children it can have. Suppose that a child pointer takes 6 byte, the search field value takes 14 byte, and the block size is 512 byte. What is the order of the internal node?









  1. View Hint View Answer Discuss in Forum

    Let the order of the internal node be X,
    Then from the given,
    (X – 1) 14 + 6X ≤ 512
    ⇒ 15X – 14 + 6X ≤ 512
    20X ≤ 256
    X = 26

    Correct Option: C

    Let the order of the internal node be X,
    Then from the given,
    (X – 1) 14 + 6X ≤ 512
    ⇒ 15X – 14 + 6X ≤ 512
    20X ≤ 256
    X = 26