0% found this document useful (0 votes)
52 views10 pages

Indexing and Hashing

Uploaded by

Mr. Phekdey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views10 pages

Indexing and Hashing

Uploaded by

Mr. Phekdey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 10

8.

Indexing and Hashing


=== Ordered Indices
1. In ordered indices the file containing the records is sequentially ordered, a
___________ is an index whose search key also defines the sequential order of the
file.
a) Clustered index
b) Structured index
c) Unstructured index
d) Nonclustered index
View Answer

Answer: a
Explanation: Clustering index are also called primary indices; the term primary
index may appear to denote an index on a primary key, but such indices can in fact
be built on any search key.
2. Indices whose search key specifies an order different from the sequential order
of the file are called ___________ indices.
a) Nonclustered
b) Secondary
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: Nonclustering index is also called secondary indices.
3. An ____________ consists of a search-key value and pointers to one or more
records with that value as their search-key value.
a) Index entry
b) Index hash
c) Index cluster
d) Index map
View Answer

Answer: a
Explanation: The pointer to a record consists of the identifier of a disk block and
an offset within the disk block to identify the record within the block.
4. In a _______ clustering index, the index record contains the search-key value
and a pointer to the first data record with that search-key value and the rest of
the records will be in the sequential pointers.
a) Dense
b) Sparse
c) Straight
d) Continuous
View Answer

Answer: a
Explanation: In a dense nonclustering index, the index must store a list of
pointers to all records with the same search-key value.
5. In a __________ index, an index entry appears for only some of the search-key
values.
a) Dense
b) Sparse
c) Straight
d) Continuous
View Answer

Answer: a
Explanation: Sparse indices can be used only if the relation is stored in sorted
order of the search key, that is if the index is a clustering index.
Note: Join free Sanfoundry classes at Telegram or Youtube
6. Incase the indices values are larger, index is created for these values of the
index. This is called
a) Pointed index
b) Sequential index
c) Multilevel index
d) Multiple index
View Answer

Answer: c
Explanation: Indices with two or more levels are called multilevel indices.
7. A search key containing more than one attribute is referred to as a _________
search key.
a) Simple
b) Composite
c) Compound
d) Secondary
View Answer

Answer: b
Explanation: The structure of the index is the same as that of any other index, the
only difference being that the search key is not a single attribute, but rather is
a list of attributes.
8. In B+ tree the node which points to another node is called
a) Leaf node
b) External node
c) Final node
d) Internal node
View Answer

Answer: d
Explanation: Nonleaf nodes are also referred to as internal nodes.
9. Insertion of a large number of entries at a time into an index is referred to as
__________ of the index.
a) Loading
b) Bulk insertion
c) Bulk loading
d) Increase insertion
View Answer

Answer: c
Explanation: Bulk loading is used to improve efficiency and scalability.
10. While inserting the record into the index, if the search-key value does not
appear in the index.
a) The system adds a pointer to the new record in the index entry
b) The system places the record being inserted after the other records with the
same search-key values
c) The system inserts an index entry with the search-key value in the index at the
appropriate position
d) None of the mentioned
View Answer

Answer: c
Explanation: If the index entry stores pointers to all records with the same search
key value, the system adds a pointer to the new record in the index entry.

=== Hashing techniques


1. If h is any hashing function and is used to hash n keys in to a table of size m,
where n<=m, the expected number of collisions involving a particular key x is :
a) Less than 1
b) Less than n
c) Less than m
d) Less than n/2
View Answer

Answer: a
Explanation: Hashing is also a method of sorting key values in a database table in
an efficient manner.
2. A technique for direct search is
a) Binary Search
b) Linear Search
c) Tree Search
d) Hashing
View Answer

Answer: d
Explanation: Hashing is one way to enable security during the process of message
transmission when the message is intended for a particular recipient only.
3. The searching technique that takes O (1) time to find a data is
a) Linear Search
b) Binary Search
c) Hashing
d) Tree Search
View Answer

Answer: c
Explanation: A formula generates the hash, which helps to protect the security of
the transmission from unauthorized users.
4. The goal of hashing is to produce a search that takes
a) O(1) time
b) O(n2 )time
c) O(log n ) time
d) O(n log n ) time
View Answer

Answer: a
Explanation: Time complexity is given by the big oh notation.
5. Consider a hash table of size seven, with starting index zero, and a hash
function (3x + 4)mod7. Assuming the hash table is initially empty, which of the
following is the contents of the table when the sequence 1, 3, 8, 10 is inserted
into the table using closed hashing? Note that ‘_’ denotes an empty location in the
table.
a) 8, _, _, _, _, _, 10
b) 1, 8, 10, _, _, _, 3
c) 1, _, _, _, _, _,3
d) 1, 10, 8, _, _, _, 3
View Answer

Answer: b
Explanation: A formula generates the hash, which helps to protect the security of
the transmission from unauthorized users.
Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate
Now!
6. A hash table can store a maximum of 10 records, currently there are records in
location 1, 3,4,7,8,9,10. The probability of a new record going into location 2,
with hash functions resolving collisions by linear probing is
a) 0.1
b) 0.6
c) 0.2
d) 0.5
View Answer

Answer: b
Explanation: Hashing is used to index and retrieve items in a database because it
is easier to find the item using the shortened hashed key than using the original
value.
7. Key value pairs is usually seen in
a) Hash tables
b) Heaps
c) Both Hash tables and Heaps
d) Skip list
View Answer

Answer: a
Explanation: Hashing is used to index and retrieve items in a database because it
is easier to find the item using the shortened hashed key than using the original
value.
8. What is the best definition of a collision in a hash table?
a) Two entries are identical except for their keys
b) Two entries with different data have the exact same key
c) Two entries with different keys have the same exact hash value
d) Two entries with the exact same key have different hash values
View Answer

Answer: a
Explanation: This level is the root of the tree.
9. Which of the following scenarios leads to linear running time for a random
search hit in a linear-probing hash table?
a) All keys hash to same index
b) All keys hash to different indices
c) All keys hash to an even-numbered index
d) All keys hash to different even-numbered indices
View Answer

Answer: a
Explanation: If all keys hash to the same location then the i-th inserted key would
need i lookups to be found. The probability of looking up i-th key is 1/n (since
it’s random). If you know some probability it’s trivial to show that such lookups
have linear time.
10. Breadth First Search is used in
a) Binary trees
b) Stacks
c) Graphs
d) All of the mentioned
View Answer

Answer: c
Explanation: Hashing is used to index and retrieve items in a database because it
is easier to find the item using the shortened hashed key than using the original
value

=== Ordered Indexing and Hashing


1. A(n) _________ can be used to preserve the integrity of a document or a message.
a) Message digest
b) Message summary
c) Encrypted message
d) None of the mentioned
View Answer

Answer: c
Explanation: Encryption algorithms are used to keep the contents safe.
2. A hash function must meet ________ criteria.
a) Two
b) Three
c) Four
d) None of the mentioned
View Answer

Answer: b
Explanation: Only if the criteria is fulfilled the values are hashed.
3. What is the main limitation of Hierarchical Databases?
a) Limited capacity (unable to hold much data)
b) Limited flexibility in accessing data
c) Overhead associated with maintaining indexes
d) The performance of the database is poor
View Answer

Answer: b
Explanation: In this, the data items are placed in a tree like hierarchical
structure.
4. The property (or set of properties) that uniquely defines each row in a table is
called the:
a) Identifier
b) Index
c) Primary key
d) Symmetric key
View Answer

Answer: c
Explanation: Primary is used to uniquely identify the tuples.
5. The separation of the data definition from the program is known as:
a) Data dictionary
b) Data independence
c) Data integrity
d) Referential integrity
View Answer

Answer: b
Explanation: Data dictionary is the place where the meaning of the data are
organized.
Subscribe Now: DBMS Newsletter | Important Subjects Newsletters
6. In the client / server model, the database:
a) Is downloaded to the client upon request
b) Is shared by both the client and server
c) Resides on the client side
d) Resides on the server side
View Answer

Answer: d
Explanation: The server has all the database information and the client access it.
7. The traditional storage of data that is organized by customer, stored in
separate folders in filing cabinets is an example of what type of ‘database’
system?
a) Hierarchical
b) Network
c) Object oriented
d) Relational
View Answer

Answer: a
Explanation: Hierarchy is based on Parent-Child Relationship. Parent-Child
Relationship Type is basically 1:N relationship.
8. The database design that consists of multiple tables that are linked together
through matching data stored in each table is called
a) Hierarchical database
b) Network database
c) Object oriented database
d) Relational database
View Answer

Answer: d
Explanation: A relational database is a collection of data items organized as a set
of formally described tables from which data can be accessed or reassembled.
9. The association role defines:
a) How tables are related in the database
b) The relationship between the class diagram and the tables in the database
c) The tables that each attribute is contained
d) Which attribute is the table’s primary key
View Answer

Answer: a
Explanation: The tables are always related in the database to form consistency.
10. The purpose of an N-Ary association is:
a) To capture a parent-child relationship
b) To deal with one to many relationships
c) To deal with relationships that involve more than two tables
d) To represent an inheritance relationship
View Answer

Answer: c
Explanation: The is binary n-array association meaning more than two classes are
involved in the relationship.

=== Bitmap Indices


1. Bitmap indices are a specialized type of index designed for easy querying on
___________
a) Bit values
b) Binary digits
c) Multiple keys
d) Single keys
View Answer

Answer: a
Explanation: Bitmap indices are a type of index that is optimized for efficient
querying on columns containing boolean or bit values. Each value in the column has
a corresponding bitmap, with each bit representing a row. This enables fast
querying and filtering of large datasets.
2. A _______ on the attribute A of relation r consists of one bitmap for each value
that A can take.
a) Bitmap index
b) Bitmap
c) Index
d) Array
View Answer
Answer: a
Explanation: A bitmap is simply an array of bits.
3.

SELECT *
FROM r
WHERE gender = ’f’ AND income level = ’L2’;
In this selection, we fetch the bitmaps for gender value f and the bitmap for
income level value L2, and perform an ________ of the two bitmaps.
a) Union
b) Addition
c) Combination
d) Intersection
View Answer

Answer: d
Explanation: We compute a new bitmap where bit i has value 1 if the ith bit of the
two bitmaps are both 1, and has a value 0 otherwise.
Subscribe Now: DBMS Newsletter | Important Subjects Newsletters
4. To identify the deleted records we use the ______________
a) Existence bitmap
b) Current bitmap
c) Final bitmap
d) Deleted bitmap
View Answer

Answer: a
Explanation: The bitmaps which are deleted are denoted by 0.
5. Bitmaps can be used as a compressed storage mechanism at the leaf nodes of
________ for those values that occur very frequently.
a) B-trees
b) B+-trees
c) Bit trees
d) Both B-trees and B+-trees
View Answer

Answer: b
Explanation: Bitmaps are combined and stored in a B+ tree.
6. Bitmaps can be combined with regular B+-tree indices for relations where a few
attribute values are extremely common, and other values also occur, but much less
frequently.
a) Bitmap, B-tree
b) Bitmap, B+tree
c) B-tree, Bitmap
d) B+tree, Bitmap
View Answer

Answer: b
Explanation: Bitmaps are combined and stored in a B+ tree.
7. In a B+-tree index ______ for each value, we would normally maintain a list of
all records with that value for the indexed attribute.
a) Leaf
b) Node
c) Root
d) Link
View Answer

Answer: a
Explanation: Bitmaps are combined and stored in a B+ tree.
8. A tablespace is further broken down into ________
a) Tablespace
b) Segments
c) Extents
d) Blocks
View Answer

Answer: b
Explanation: Segment names are used in create table and create index commands to
place tables or indexes on specific database devices.
9. In ordered indices the file containing the records is sequentially ordered, a
___________ is an index whose search key also defines the sequential order of the
file.
a) Clustered index
b) Structured index
c) Unstructured index
d) Nonclustered index
View Answer

Answer: a
Explanation: Clustering index are also called primary indices; the term primary
index may appear to denote an index on a primary key, but such indices can in fact
be built on any search key.
10. Indices whose search key specifies an order different from the sequential order
of the file are called ___________ indices.
a) Nonclustered
b) Secondary
c) All of the mentioned
d) None of the mentioned
View Answer

Answer: c
Explanation: Nonclustering index are also called secondary indices.

=== Index Definition in SQL


1. What is the purpose of the index in sql server?
a) To enhance the query performance
b) To provide an index to a record
c) To perform fast searches
d) All of the mentioned
View Answer

Answer: d
Explanation: A database index is a data structure that improves the speed of data
retrieval operations on a database table at the cost of additional writes.
2. How many types of indexes are there in sql server?
a) 1
b) 2
c) 3
d) 4
View Answer

Answer: b
Explanation: They are clustered index and non clustered index.
3. How non clustered index point to the data?
a) It never points to anything
b) It points to a data row
c) It is used for pointing data rows containing key values
d) None of the mentioned
View Answer

Answer: c
Explanation: Nonclustered indexes have a structure separate from the data rows. A
nonclustered index contains the nonclustered index key values and each key value
entry has a pointer to the data row that contains the key value.
4. Which one is true about clustered index?
a) Clustered index is not associated with table
b) Clustered index is built by default on unique key columns
c) Clustered index is not built on unique key columns
d) None of the mentioned
View Answer

Answer: b
Explanation: Nonclustered indexes have a structure separate from the data rows. A
nonclustered index contains the nonclustered index key values and each key value
entry has a pointer to the data row that contains the key value.
5. What is true about indexes?
a) Indexes enhance the performance even if the table is updated frequently
b) It makes harder for sql server engines to work to work on index which have large
keys
c) It doesn’t make harder for sql server engines to work to work on index which
have large keys
d) None of the mentioned
View Answer

Answer: b
Explanation: Indexes tend to improve the performance.
Note: Join free Sanfoundry classes at Telegram or Youtube
6. Does index take space in the disk?
a) It stores memory as and when required
b) Yes, Indexes are stored on disk
c) Indexes are never stored on disk
d) Indexes take no space
View Answer

Answer: b
Explanation: Indexes take memory slots which are located on the disk.
7. What are composite indexes?
a) Are those which are composed by database for its internal use
b) A composite index is a combination of index on 2 or more columns
c) Composite index can never be created
d) None of the mentioned
View Answer

Answer: b
Explanation: A composite index is an index on two or more columns of a table.
8. If an index is _________________ the metadata and statistics continue to exists
a) Disabling
b) Dropping
c) Altering
d) Both Disabling and Dropping
View Answer

Answer: a
Explanation: A database index is a data structure that improves the speed of data
retrieval operations on a database table at the cost of additional writes.
9. In _______________ index instead of storing all the columns for a record
together, each column is stored separately with all other rows in an index.
a) Clustered
b) Column store
c) Non clustered
d) Row store
View Answer

Answer: b
Explanation: A database index is a data structure that improves the speed of data
retrieval operations on a database table at the cost of additional writes.
10. A _________________ index is the one which satisfies all the columns requested
in the query without performing further lookup into the clustered index.
a) Clustered
b) Non Clustered
c) Covering
d) B-Tree
View Answer

Answer: c
Explanation: A covered query is a query where all the columns in the query’s result
set are pulled from non-clustered indexes.

You might also like