0% found this document useful (0 votes)
11 views

Module-4 Problems

The document discusses B-tree indexing and properties like order and degree. It provides examples of problems calculating order, degree, number of blocks, and access times for B-tree indexes given properties like key size, pointer sizes, and block size.

Uploaded by

charan.g
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views

Module-4 Problems

The document discusses B-tree indexing and properties like order and degree. It provides examples of problems calculating order, degree, number of blocks, and access times for B-tree indexes given properties like key size, pointer sizes, and block size.

Uploaded by

charan.g
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Figure 26: B-Tree

• In left children, there are 3 keys, so it will check from the leftmost key as the data is stored in
sorted order.
• Leftmost element is having key value as 48 which match the element to be searched, so that’s
how the element is searched.

4.7 Problems
Problem 110. Consider a disk with the following specifications: rotation speed of 6000 RPM,
average seek time of 5 milliseconds, 500 sectors/track, 512-byte sectors. A file has content stored in
3000 sectors located randomly on the disk. Assuming average rotational latency, the total time (in
seconds, rounded off to 2 decimal places) to read the entire file from the disk is

A) 12.25
B) 29.25
C) 32.56
D) 42.12

Problem 111. Six files F1, F2, F3, F4, F5 and F6 have 100, 200, 50, 80, 120, 150 records
respectively. In what order should they be stored so as to optimize act. Assume each file is accessed
with the same frequency

A) F3, F4, F1, F5, F6, F2


B) F2, F6, F5, F1, F4, F3
C) F1, F2, F3, F4, F5, F6
D) Ordering is immaterial as all files are accessed with the same frequency.

Problem 112. Consider a typical disk that rotates at 15000 rotations per minute (RPM) and has a
transfer rate of 50 ∗ 106 bytes/sec. If the average seek time of the disk is twice the average rotational
delay and the controller’s transfer time is 10 times the disk transfer time, the average time (in
milliseconds) to read or write a 512-byte sector of the disk is
.

A) 8.2

154 DBMS (4CSGC2021), Lecture Review, Dr. Gourish Goudar & Dr. Kalyan Nagaraj.
B) 6.1
C) 3.5
D) 9.5

Problem 113. Consider a disk pack with a seek time of 4 milliseconds and rotational speed of 10000
rotations per minute (RPM). It has 600 sectors per track and each sector can store 512 bytes of data.
Consider a file stored in the disk. The file contains 2000 sectors. Assume that every sector access
necessitates a seek, and the average rotational latency for accessing each sector is half of the time
for one complete rotation. The total time (in milliseconds) needed to read the entire file is .

A) 12530
B) 14020
C) 17564
D) 15642

Problem 114. An application loads 100 libraries at startup. Loading each library requires exactly
one disk access. The seek time of the disk to a random location is given as 10ms. Rotational speed
of disk is 6000rpm. If all 100 libraries are loaded from random locations on the disk, how long does
it take to load all libraries? (The time to transfer data from the disk block once the head has been
positioned at the start of the block may be neglected)

A) 0.5s
B) 1.5s
C) 1.25s

D) 1s

Problem 115. Consider a database of fixed-length records, stored as an ordered file. The database
has 25,000 records, with each record being 100 bytes, of which the primary key occupies 15 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

155 DBMS (4CSGC2021), Lecture Review, Dr. Gourish Goudar & Dr. Kalyan Nagaraj.
below depicts this indexing scheme.
Suppose the block size of the file system is 1024 bytes, and a pointer to a block occupies 5 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 ⌈log2 b⌉ 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
A) 4
B) 6
C) 8
D) 16
Problem 116. A data file consisting of 1,50,000 student-records is stored on a hard disk with block
size of 4096 bytes. The data file is sorted on the primary key RollNo. The size of a record pointer
for this disk is 7 bytes. Each student-record has a candidate key attribute called ANum of size 12
bytes. Suppose an index file with records consisting of two fields, ANum 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
A) 235
B) 248
C) 488
D) 698
Problem 117. Consider a database implemented using B+ tree for file indexing and installed on a
disk drive with block size of 4 KB. The size of search key is 12 bytes and the size of tree/disk pointer
is 8 bytes. Assume that the database has one million records. Also assume that no node of the B+
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

156 DBMS (4CSGC2021), Lecture Review, Dr. Gourish Goudar & Dr. Kalyan Nagaraj.
A) 2
B) 3
C) 4

D) 5
Problem 118. in a file which contains 1 million records and the order of the tree is 100, then what
is the maximum number of nodes to be accessed if B+ tree index is used?
A) 5

B) 4
C) 3
D) 10
Problem 119. In a B + tree, if the search -key value is 8 bytes long, the block size is 512 bytes and
the block pointer size is 2 bytes, then maximum order of the tree is
A) 64
B) 32
C) 52

D) 12
Problem 120. The order of leaf node in B + - tree is the maximum number of (value, data record
pointer) pairs it can hold. Given that the block size is 1K bytes, data record pointer is 7 bytes long,
the value field is 9 bytes long and a block pointer is 6 bytes long, what is the order of the leaf node?

A) 63
B) 64
C) 67
D) 68

Problem 121. Given a block can hold either 3 records or 10 key pointers. A database contains n
records, then how many blocks do we need to hold the data file and the dense index
A) 13n/30

B) n/3
C) n/10
D) n/30
Problem 122. Consider a B + tree in which the search key is 12 bytes long, block size is 1024 bytes,
record pointer is 10 bytes long and block pointer is 8 bytes long. The maximum number of keys that
can be accommodated in each non-leaf node of the tree is .

157 DBMS (4CSGC2021), Lecture Review, Dr. Gourish Goudar & Dr. Kalyan Nagaraj.
A) 50
B) 56
C) 46

D) 40
Problem 123. Calculate the order of leaf (Pleaf ) and non leaf (P) nodes of B + tree based on the
information given below:
search key field: 12 field
Record Pointer: 10 bytes
Block Pointer: 8 bytes
Block Size: 1KB
A) Pleaf : 51 and P : 46
B) Pleaf : 47 and P : 52

C) Pleaf : 46 and P : 51
D) Pleaf : 52 and P : 47
Problem 124. Consider a file of 16384 records. Each record is 32 bytes long and its key field is
of size 6 bytes. 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 1024 bytes, and the size of a block pointer is 10 bytes.
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
A) 8 and 0

B) 128 and 6
C) 256 and 4
D) 512 and 5
Problem 125. The order of a leaf node in a B+ tree is the maximum number of (value, data record
pointer) pairs it can hold. Given that the block size is 1K bytes, data record pointer is 7 bytes long,
the value field is 9 bytes long and a block pointer is 6 bytes long, what is the order of the leaf node?
A) 63
B) 64

C) 67
D) 68
Problem 126. In a database file structure, the search key field is 9 bytes long, the block size is
512 bytes, a record pointer is 7 bytes and a block pointer is 6 bytes. The largest possible order of a
non-leaf node in a B+ tree implementing this file structure is
A) 23

158 DBMS (4CSGC2021), Lecture Review, Dr. Gourish Goudar & Dr. Kalyan Nagaraj.
B) 24
C) 34
D) 44

Problem 127. Consider a table T in a relational database with a key field K. A B-tree of order p is
used as an access structure on K, where p denotes the maximum number of tree pointers in a B-tree
index node. Assume that K is 10 bytes long; disk block size is 512 bytes; each data pointer PD is 8
bytes long and each block pointer PB is 5 bytes long. In order for each B-tree node to fit in a single
disk block, the maximum value of p is

A) 20
B) 22
C) 23
D) 32

Problem 128. 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 bytes, disk blocks are of size 512 bytes, and index
pointers are of size 4 bytes. Given this scenario, what would be the best choice of the degree (i.e. the
number of pointers per node) of the B+-tree

A) 16
B) 42
C) 43
D) 44

159 DBMS (4CSGC2021), Lecture Review, Dr. Gourish Goudar & Dr. Kalyan Nagaraj.

You might also like