0% found this document useful (0 votes)
58 views22 pages

File Organization and Indexing - DPP 01 Discussion Notes

Uploaded by

ajayvaliya831
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)
58 views22 pages

File Organization and Indexing - DPP 01 Discussion Notes

Uploaded by

ajayvaliya831
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/ 22

CS & IT 2024

ENGINEERING
Database
Management System
File Organization and Indexing
File Org & Indexing

DPP 01 Discussion Notes By- Mili Dhara Ma’am


[MCQ]
#Q. Assume a relational database system that holds relation: C(colleges) with
the following characteristics
∙ Records are stored as fixed length, fixed format records, length is 256
bytes.
∙ There are 16384 records.
∙ Records contains key attribute CollegeNumber (C.N), length 22 bytes and
other fields.
∙ Unspanned organization is used to store the information or record.
Let’s suppose we want to build a sparse primary index on C.N then how many
numbers of 4096-byte blocks are needed to store the primary index when block
pointer size is 10 bytes ______?
A 7 B 8

C 9 D 10
[NAT]
#Q. Assume a relational database system that holds relation: Product (P) with
the following characteristics
∙ Records are stored as fixed length, fixed format records, with the length of
256 bytes.
∙ There are 262144 records.
∙ Records contain attribute P.I (The identifier of the product involved), with
the length 24 bytes, and an attribute P.C (the cost of product), with the
length 32 bytes and other fields.
∙ Unspanned organization is used to store the record.
Assume that we want to build a dense secondary index on P.C, then how many
numbers of 4096-byte blocks needed to store the dense secondary index. When
record pointer size is 32 bytes? _______.
[MCQ]
#Q. Consider a SQL statement SELECT P1, P2, P3 from Q WHERE P2 = ‘Pavan’ is
frequently executed, which column(s) should be considered for indexing
based only on the statement itself?

A P1 only

B P2 only

C P3 only

D P1, P2 and P3
[MCQ]
#Q. Consider the following specification of system-Disk block size = 2048 bytes
Block pointer size = 16 bytes
Record pointer size = 20 bytes long file contains 30,000 records.
Each record of the file has the following fields:
An extra/additional byte is used per record to represent end of the record.
What is the block factor of the database file assuming unspanned file
organization?
Fields Size (in Bytes)
A 16
EmpName 5
EmpNum 10
B 32 DeptNum 9
Addr 20
PhNum 9
C 48
DOB 1
Sex 1
Job 3
D 64
Sal 5
[MSQ]
#Q. Which one of the following statements is/are True regarding indexing?

A A database file can contain multiple clustered indexes.

B A database file can consist of at most one clustered index with multiple
secondary indexes.
C A database file can consist of multiple primary indexes.

D A database file can consist of both primary and clustered index.


[NAT]
#Q. Consider a database of fixed-length records stored as an ordered file. The
database has 25,000 records with each records being 100 bytes, of which the
non-key attribute on which clustering index is formed occupies 10 bytes. The data
file is completely block aligned.
Suppose, block size, of the file system is 512 bytes and a pointer to the block
occupy 5 bytes. You may assume that a binary search on an index file of b block may
take ⎡log2b⎤ accesses in worst case.
Given that a cluster consumes 2 blocks, the number of block accesses required
to identify the desired data in the worst case is ______.
[MCQ]
#Q. Consider the following statements-
S1: If the records of a relation X are physically ordered over a non-key
field P and an index is build over the key-field of relation X, then the index
is necessarily a secondary index over key attribute.
S2: More than one secondary indexes are possible.
Which of the given statement(s) is/are CORRECT?

A S1 only B S2 only

C Both S1 and S2 D Neither S1 nor S2


[MCQ]

#Q. 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 8 bytes long, the value field is 10 bytes long and a block
pointer is 6 bytes, then what is the order of the leaf node ?

A 53 B 54

C 55 D 56
[NAT]

#Q. The order of an internal node in B+ tree index is the maximum number of
children it can have. Assume that a child pointer takes 6 bytes, the search
field value takes 34 bytes and the blocks size is 2048 bytes. The order of the
internal node is ________.
[MCQ]

#Q. Given a block can hold either 3 records or 10 key pointers. A database
contains P records, then how many blocks do we need to hold the data file
and the dense index ?

A B

C D
[MCQ]

#Q. Assume a disk with block size B = 1024 Bytes, A block pointer is PB = 12
bytes long and a record pointer is PR = 18 bytes long. A file has 1,00,000
patients records of size 100 bytes. Suppose the file is ordered by the key
field PID and we want to construct a secondary (dense) index on non-key
field Dept ID (14 bytes), then minimum of how many blocks are required to
store index file assuming an unspanned organization?

A 3000 B 3100

C 3125 D None of the above


[NAT]

#Q. The order of a node in B tree is the maximum number of block pointers it
can hold. Given that the block size is 2K bytes, data record pointer is 8 bytes
long, the search key is 9 bytes long and a block pointer is 5 bytes long. The
best possible order of B tree node is .
[NAT]
[MCQ]

#Q. Consider the following statements:


S1: In a B+ tree, data pointers are stored only at the leaf nodes of the tree.
S2: The leaf node has an entry for every value of the search field, along with
the data pointer to the record.
Choose the correct statements.

A Only S1 is true B Only S2 is true

C Both S1 and S2 are true D Neither S1 nor S2 is true


[MSQ]

#Q. Which of the following is/are true reading B+ tree ?

A Records can be fetched in equal number of disk access.

B Height of the tree remains balanced and less as compared to B tree.

C Keys are used for indexing

D Faster search queries as the data is stored only on the leaf nodes.
[NAT]

#Q. Consider the following specification of system with disk block size 2048
bytes, block pointer size 14 bytes, record pointer size 18 bytes long and file
size 60,000 records. Each record of file is 256 bytes long and record of the
size is sorted on the key field. If the primary index (sparse) is built on the
kye field (ESN) which is 18 bytes long. What is the Index blocking factors
(That is number of indexes per block)
Assuming unspanned file organization _________.
[NAT]

#Q. Data For This & Next Question:


Consider a disk blocking size B = 1024 bytes. A block pointer is PB =12
bytes long and a record pointer is PR = 7 bytes long. A file has r = 60,000
patient records of fixed length. The size of record is 230 bytes. Suppose the
file is not ordered by the key field PSN (18 bytes) and we want to construct
a secondary index on PSN.
The number of first level index entries is _____.
[MCQ]

#Q. The number of first level index block is ______?

A 1800 B 1825

C 1850 D 1857
[MCQ]

#Q. Consider an unordered file of 106 records with records size of 200 bytes
stored on blocks of 8KB with a spanned records organization. We will
assume that no system related information is stored within a block, then
how many blocks would it be need to store this file?

A 24400 B 24405

C 24410 D 24415
[MCQ]

#Q. Consider the following statements:


S1: for any given data file, it is possible to create two different sparse first
level indexes on various keys.
S2: for any given data file, it is possible to create two different denes first
level indexes on various keys. Select the correct statements.

A Only S1 correct

B Only S2 correct

C Both S1 and S2 are correct

D Neither is S1 and S2 is correct


THANK - YOU

You might also like