dbms banner

DBMS Multiple Choice Questions (MCQs) and Answers

Master Database Management Systems (DBMS) with Practice MCQs. Explore our curated collection of Multiple Choice Questions. Ideal for placement and interview preparation, our questions range from basic to advanced, ensuring comprehensive coverage of DBMS. Begin your placement preparation journey now!

Q91

Q91 In PostgreSQL, how do you add a GIN index to an array column named "tags" in a table named "Posts"?

A

CREATE INDEX gin_tags ON Posts USING GIN(tags)

B

GIN INDEX CREATE ON Posts(tags)

C

CREATE GIN INDEX ON Posts(tags)

D

INDEX GIN CREATE ON Posts USING (tags)

Q92

Q92 How do you enforce uniqueness on a composite index in SQL Server for columns "FirstName" and "LastName" in the "Employees" table?

A

CREATE UNIQUE INDEX ux_name ON Employees(FirstName, LastName)

B

UNIQUE INDEX CREATE Employees(FirstName, LastName)

C

CREATE INDEX UNIQUE Employees ON (FirstName, LastName)

D

INDEX CREATE UNIQUE ON Employees(FirstName, LastName)

Q93

Q93 A query that used to run quickly is now running slowly, even though no changes were made to the query itself.
What is a likely cause?

A

The database has been indexed incorrectly

B

The underlying data has significantly increased in size

C

A network issue is causing delayed responses

D

The query optimizer is malfunctioning

Q94

Q94 After adding a new index to a table, certain update operations on the table have become slower.
What is a likely explanation?

A

The new index requires additional storage space

B

The update operations do not use the index

C

Updating the table now requires updating the index as well

D

The index has caused a lock on the table

Q95

Q95 You observe that a specific query is not using an available index, leading to poor performance.
What could be done to encourage the use of the index?

A

Rebuild the index

B

Update the database statistics

C

Increase the query timeout

D

Change the query's isolation level

Q96

Q96 What is a primary benefit of using distributed databases over centralized databases?

A

Increased data redundancy

B

Simpler data management

C

Improved data availability and disaster recovery

D

Reduced data security

Q97

Q97 In a distributed database system, what does the term "data fragmentation" refer to?

A

The process of breaking down data into smaller, manageable parts for storage

B

The unintended loss of data due to network issues

C

The division of data into different types for analysis

D

Segmenting and storing parts of a database at different locations based on certain criteria

Q98

Q98 What challenge is primarily addressed by the two-phase commit protocol in distributed database systems?

A

Data consistency across multiple sites

B

Encrypting data transmitted between sites

C

Optimizing query performance across networks

D

Managing distributed database schema changes

Q99

Q99 Which of the following best describes the concept of "horizontal scaling" in distributed databases?

A

Adding more columns to a database table

B

Splitting a database across different physical locations

C

Increasing the storage capacity of a single database server

D

Adding more servers or nodes to manage increased load

Q100

Q100 In distributed databases, what does "eventual consistency" mean?

A

That the database will be immediately consistent after any transaction

B

That the database may temporarily have different data copies, which will become consistent over time

C

That consistency is not guaranteed in any form

D

That consistency between database copies is achieved through periodic synchronization

Q101

Q101 In a distributed SQL database, how can you query data from a remote table named "RemoteOrders" that resides on a server named "RemoteServer"?

A

SELECT * FROM RemoteServer.RemoteOrders

B

SELECT * FROM RemoteOrders AT RemoteServer

C

SELECT * FROM LINKED.RemoteServer.RemoteOrders

D

SELECT * FROM RemoteOrders@RemoteServer

Q102

Q102 How do you enable automatic sharding in a MongoDB distributed database to distribute data across multiple servers?

A

Use the sh.enableSharding("databaseName") command

B

Set up a shard cluster and define shard keys for collections

C

Implement a custom sharding algorithm

D

Configure replication sets for automatic sharding

Q103

Q103 For ensuring strong consistency across replicas in a Cassandra cluster, which consistency level should be used for both reads and writes?

A

ONE

B

QUORUM

C

ALL

D

LOCAL_QUORUM

Q104

Q104 A distributed database system is experiencing slow query responses.
What could be a reason for increased latency?

A

A single overloaded server

B

Network latency between distributed nodes

C

Incorrectly configured indexes

D

All of the above

Q105

Q105 After partitioning a table across multiple distributed database nodes, some transactions fail due to lost updates. What is a likely cause and solution?

A

The transactions are accessing non-partitioned data, requiring data replication

B

Transactions are not being distributed correctly, necessitating a review of the partitioning strategy

C

Locks are not being acquired on the data, suggesting the need for explicit locking mechanisms

D

Partitioned data is not being synchronized properly, indicating the need for transaction coordination

Q106

Q106 How can data inconsistency issues be resolved in a system using eventual consistency?

A

By immediately synchronizing all data replicas

B

By using a conflict resolution mechanism such as last write wins

C

By reducing the number of database replicas

D

By avoiding updates to data

Q107

Q107 What distinguishes NoSQL databases from traditional relational databases?

A

Strict schema enforcement

B

Support for SQL syntax

C

Ability to handle unstructured and semi-structured data efficiently

D

Primarily used for transactional data

Q108

Q108 Which NoSQL database type is optimized for storing and querying connected data, such as social networks or recommendation systems?

A

Document store

B

Key-value store

C

Graph database

D

Column-family store

Q109

Q109 What is "sharding" in the context of NoSQL databases?

A

The process of replicating data across multiple servers for fault tolerance

B

Partitioning data across multiple servers to improve performance

C

Encrypting data at rest

D

Compressing data to save storage space

Q110

Q110 In big data processing, what does the term "MapReduce" refer to?

A

A data storage technique for large datasets

B

A programming model for processing large data sets with a parallel, distributed algorithm on a cluster

C

A type of NoSQL database

D

A data backup and recovery strategy

Q111

Q111 How does data consistency in eventual consistency models compare to that in traditional ACID transaction models?

A

It guarantees immediate consistency

B

It never achieves consistency

C

It achieves consistency over time, after all updates propagate

D

It prioritizes availability over consistency

Q112

Q112 How do you create a collection named "users" in MongoDB?

A

db.createCollection("users")

B

CREATE COLLECTION users

C

db.users.create()

D

mongodb.create("users")

Q113

Q113 In Cassandra, how can you define a table with automatic expiration of data (TTL) for a column named "message"?

A

CREATE TABLE messages (id UUID PRIMARY KEY, message text, TTL int)

B

CREATE TABLE messages (id UUID PRIMARY KEY, message text) WITH default_time_to_live=3600

C

ALTER TABLE messages ADD TTL (message, 3600)

D

None of the above

Q114

Q114 Which command in Redis is used to set a key "user:100" with a value "John Doe" that expires after 10 minutes?

A

SET user:100 "John Doe" EXPIRE 600

B

SET user:100 "John Doe" TTL 600

C

SET user:100 "John Doe" WITH EXPIRY 600

D

SETEX user:100 600 "John Doe"

Q115

Q115 A developer notices slow query performance on a document store database when querying by a frequently accessed field.
What is a potential solution?

A

Adding an index on the frequently accessed field

B

Increasing the memory allocated to the database

C

Splitting the database into smaller, separate databases

D

Replicating the database for read-heavy workloads

Q116

Q116 After adding a new node to a NoSQL database cluster, data is not evenly distributed across nodes.
What action can help redistribute the data more evenly?

A

Manually transferring data between nodes

B

Rebooting the cluster

C

Updating the database schema

D

Triggering a rebalance operation across the cluster

Q117

Q117 How can "hotspotting" issues be mitigated in a Big Data application using a key-value store for time-series data?

A

By writing all data to a single key

B

By using sequential keys for data insertion

C

By sharding data across keys using a hash of the timestamp

D

By increasing the write throughput limits on the database

Q118

Q118 What is a data warehouse?

A

A database optimized for transaction processing

B

A collection of tools for web data mining

C

A centralized repository for integrating data from various sources

D

A type of NoSQL database

Q119

Q119 In data mining, what does the term "classification" refer to?

A

The process of organizing data into categories for efficient storage

B

Dividing a database into smaller, manageable parts

C

The task of predicting the class label of given input data

D

The restructuring of a data warehouse

Q120

Q120 What distinguishes data warehousing from databases in terms of data analysis?

A

Data warehousing focuses on capturing data from diverse sources, whereas databases focus on storing real-time transactional data

B

Data warehousing is optimized for read-intensive operations, whereas databases are optimized for write-intensive operations

C

Data warehouses primarily use SQL for querying, whereas databases use NoSQL

D

Data warehouses store unstructured data, whereas databases store structured data

ad verticalad vertical
ad