Databse MCQs (101-200)

101. The main goal of transaction management is to ensure:
A) Data consistency
B) Data redundancy
C) Query speed
D) Indexing
Answer: A

102. Which of the following is a valid transaction state?
A) Active
B) Partially committed
C) Failed
D) All of these
Answer: D

103. A transaction must be:
A) Atomic and consistent
B) Atomic only
C) Isolated only
D) None
Answer: A

104. A schedule is serial if:
A) Transactions execute one after another
B) Transactions interleave
C) All transactions run concurrently
D) None
Answer: A

105. A schedule that preserves transaction results as a serial schedule is called:
A) Serializable schedule
B) Non-serializable
C) Cascading schedule
D) None
Answer: A

106. Two-phase locking protocol ensures:
A) Conflict serializability
B) Deadlock-free execution
C) Cascadeless execution
D) None
Answer: A

107. In 2PL, the two phases are:
A) Growing and Shrinking
B) Locking and Unlocking
C) Reading and Writing
D) None
Answer: A

108. Timestamp ordering protocol avoids:
A) Deadlocks
B) Cascading rollbacks
C) Serial execution
D) None
Answer: A

109. Cascading rollback occurs when:
A) One transaction rollback affects others
B) Data redundancy exists
C) System restarts
D) None
Answer: A

110. Which of these maintains log records for recovery?
A) System log
B) Transaction log
C) Data log
D) Rollback log
Answer: B

111. A log record typically contains:
A) Transaction ID
B) Operation type
C) Old and new values
D) All of these
Answer: D

112. The process of restoring the database after failure is called:
A) Recovery
B) Backup
C) Rollback
D) Redundancy
Answer: A

113. Checkpoint in recovery management is used to:
A) Reduce recovery time
B) Improve transaction speed
C) Prevent deadlocks
D) None
Answer: A

114. A distributed database means:
A) Data stored at multiple locations
B) Data stored in one central location
C) Backup database
D) None
Answer: A

115. Fragmentation in distributed databases refers to:
A) Dividing data into smaller pieces
B) Data duplication
C) Data encryption
D) None
Answer: A

116. Replication means:
A) Copying data across multiple sites
B) Splitting data
C) Removing data
D) Encrypting data
Answer: A

117. Data transparency means:
A) Users access distributed data as if centralized
B) Users see raw data
C) Data is encrypted
D) None
Answer: A

118. Horizontal fragmentation divides a relation by:
A) Rows
B) Columns
C) Keys
D) Attributes
Answer: A

119. Vertical fragmentation divides a relation by:
A) Columns
B) Rows
C) Tuples
D) Keys
Answer: A

120. Which is not a normalization form?
A) 1NF
B) 2NF
C) 7NF
D) 3NF
Answer: C

121. BCNF removes:
A) Partial and transitive dependencies
B) All anomalies
C) Functional dependency anomalies
D) None
Answer: C

122. 4NF deals with:
A) Multivalued dependencies
B) Transitive dependencies
C) Partial dependencies
D) None
Answer: A

123. 5NF removes:
A) Join dependency anomalies
B) Multivalued dependency
C) Partial dependency
D) None
Answer: A

124. Functional dependency X → Y means:
A) X determines Y
B) Y determines X
C) Both determine each other
D) None
Answer: A

125. If A → B and B → C, then A → C is an example of:
A) Transitive dependency
B) Partial dependency
C) Trivial dependency
D) None
Answer: A

126. A dependency is trivial if:
A) Right side is subset of left side
B) Both sides are equal
C) Left side is null
D) None
Answer: A

127. Decomposition is lossless if:
A) No information is lost
B) Some tuples lost
C) Some attributes lost
D) None
Answer: A

128. Which SQL function returns string length?
A) LENGTH()
B) SIZE()
C) COUNT()
D) STRLEN()
Answer: A

129. Which function is used to extract substring?
A) SUBSTRING()
B) MID()
C) SUBSTR()
D) All of these (DBMS dependent)
Answer: D

130. Which function converts text to uppercase in SQL?
A) UPPER()
B) UPCASE()
C) CAPITAL()
D) TOUPPER()
Answer: A

131. Which function returns current time?
A) NOW()
B) CURRENT_TIME()
C) SYSDATE()
D) All of these (DBMS dependent)
Answer: D

132. Which SQL function rounds a number to nearest integer?
A) ROUND()
B) FLOOR()
C) CEIL()
D) TRUNC()
Answer: A

133. Which function gives the smallest integer greater than or equal to a number?
A) CEIL()
B) FLOOR()
C) ROUND()
D) ABS()
Answer: A

134. Which SQL function removes extra spaces?
A) TRIM()
B) REMOVE()
C) CLEAN()
D) STRIP()
Answer: A

135. The function that returns absolute value is:
A) ABS()
B) POSITIVE()
C) VALUE()
D) MOD()
Answer: A

136. The modulo operator (%) in SQL returns:
A) Remainder
B) Quotient
C) Division result
D) None
Answer: A

137. Which function returns the position of a substring?
A) INSTR()
B) LOCATE()
C) POSITION()
D) All of these (depending on DBMS)
Answer: D

138. Which function concatenates strings?
A) CONCAT()
B) ADDSTRING()
C) APPEND()
D) MERGE()
Answer: A

139. Aggregate functions operate on:
A) Groups of rows
B) Individual columns
C) Single cell
D) None
Answer: A

140. Which aggregate function returns the largest value?
A) MAX()
B) GREATEST()
C) HIGH()
D) TOP()
Answer: A

141. Which function counts only non-null values?
A) COUNT(column_name)
B) COUNT(*)
C) COUNT(DISTINCT)
D) None
Answer: A

142. COUNT(*) includes:
A) All rows including nulls
B) Only non-null
C) Only distinct
D) None
Answer: A

143. The SQL command used to change column data type is:
A) ALTER TABLE MODIFY
B) UPDATE
C) CHANGE TYPE
D) ALTER COLUMN TYPE
Answer: A

144. A surrogate key is:
A) Artificial key created by system
B) Duplicate key
C) Foreign key
D) None
Answer: A

145. Which of these statements about index is true?
A) Improves search speed
B) Slows down inserts
C) Occupies storage
D) All of these
Answer: D

146. Bitmap indexes are best for:
A) Columns with few distinct values
B) Columns with unique values
C) Numeric columns only
D) None
Answer: A

147. Hash indexes are useful for:
A) Equality comparisons
B) Range queries
C) Sorting
D) None
Answer: A

148. B+ tree indexes are ideal for:
A) Range queries
B) Equality lookups only
C) Random data
D) None
Answer: A

149. Composite index includes:
A) Multiple columns
B) Only primary key
C) One attribute
D) None
Answer: A

150. Clustering in database refers to:
A) Storing related rows together
B) Grouping data randomly
C) Fragmentation
D) None
Answer: A

151. A self-join is used to:
A) Join a table with itself
B) Join two different tables
C) Compare two databases
D) None
Answer: A

152. In SQL, an alias is created using:
A) AS keyword
B) LIKE keyword
C) ALIAS keyword
D) None
Answer: A

153. The FULL OUTER JOIN returns:
A) All matching and non-matching rows from both tables
B) Only matching rows
C) Only left table rows
D) None
Answer: A

154. CROSS JOIN produces:
A) Cartesian product
B) Natural join
C) Equi join
D) None
Answer: A

155. NATURAL JOIN automatically matches columns:
A) With same name and datatype
B) With same name only
C) With same datatype only
D) None
Answer: A

156. Which join returns rows that have matching values in both tables?
A) INNER JOIN
B) OUTER JOIN
C) CROSS JOIN
D) None
Answer: A

157. Which join returns rows that do not have matching values in the other table?
A) LEFT OUTER JOIN with NULLs
B) INNER JOIN
C) CROSS JOIN
D) None
Answer: A

158. Equi join uses which operator?
A) =
B) <>
C) LIKE
D) >
Answer: A

159. Non-equi join uses operators like:
A) >, <, BETWEEN
B) = only
C) NULL
D) None
Answer: A

160. A subquery that uses values from the outer query is called:
A) Correlated subquery
B) Nested subquery
C) Inline view
D) None
Answer: A

161. Inline views are:
A) Subqueries used in FROM clause
B) Stored procedures
C) Joins
D) None
Answer: A

162. The WITH clause in SQL is used for:
A) Defining temporary named subqueries
B) Creating a permanent view
C) Updating records
D) None
Answer: A

163. Materialized views store:
A) Actual data of query results
B) Only query definition
C) Logs only
D) None
Answer: A

164. Views help in:
A) Simplifying complex queries
B) Enhancing security
C) Restricting access
D) All of these
Answer: D

165. Can we perform DML operations on a simple view?
A) Yes, if it is updatable
B) No
C) Only DELETE
D) Only INSERT
Answer: A

166. PL/SQL stands for:
A) Procedural Language extension to SQL
B) Program Language SQL
C) Programming Logic SQL
D) None
Answer: A

167. A PL/SQL block contains:
A) Declaration, Execution, Exception sections
B) Only Execution
C) Only Declaration
D) None
Answer: A

168. In PL/SQL, exceptions are handled using:
A) EXCEPTION block
B) ERROR block
C) TRY-CATCH
D) None
Answer: A

169. Which PL/SQL structure is used for repeating tasks?
A) LOOP
B) IF
C) CASE
D) DECLARE
Answer: A

170. A cursor in PL/SQL is used to:
A) Fetch multiple rows one by one
B) Update schema
C) Create tables
D) None
Answer: A

171. Which type of cursor is created automatically by Oracle?
A) Implicit cursor
B) Explicit cursor
C) Static cursor
D) Dynamic cursor
Answer: A

172. Explicit cursors must be:
A) Declared, opened, fetched, and closed manually
B) Auto-handled by system
C) Closed automatically
D) None
Answer: A

173. The %ROWCOUNT attribute returns:
A) Number of rows affected
B) Total rows in table
C) Error count
D) None
Answer: A

174. The %FOUND attribute in cursor returns TRUE when:
A) Row is fetched successfully
B) No row is fetched
C) Error occurs
D) None
Answer: A

175. Triggers can be defined on:
A) INSERT, UPDATE, DELETE events
B) SELECT queries
C) Procedures
D) None
Answer: A

176. A BEFORE trigger executes:
A) Before the DML event
B) After DML event
C) Randomly
D) None
Answer: A

177. Mutating table error occurs when:
A) A trigger modifies the same table
B) Table is missing
C) Database is full
D) None
Answer: A

178. Stored procedures are compiled:
A) Once and stored in the database
B) Every time they are run
C) At query time
D) None
Answer: A

179. Functions in SQL must always return:
A) A single value
B) A table
C) A trigger
D) None
Answer: A

180. Data warehousing is used for:
A) Analytical processing
B) Transactional processing
C) Both
D) None
Answer: A

181. OLTP stands for:
A) Online Transaction Processing
B) Online Table Processing
C) Offline Transaction Processing
D) None
Answer: A

182. OLAP stands for:
A) Online Analytical Processing
B) Offline Analytical Processing
C) Online Automated Processing
D) None
Answer: A

183. The process of cleaning and preparing data is called:
A) Data preprocessing
B) Data mining
C) Data warehousing
D) None
Answer: A

184. Fact tables store:
A) Quantitative data for analysis
B) Descriptive data
C) Metadata
D) None
Answer: A

185. Dimension tables contain:
A) Descriptive attributes
B) Numeric measures
C) Facts
D) None
Answer: A

186. A star schema contains:
A) One fact table and multiple dimension tables
B) Only fact tables
C) Only dimensions
D) None
Answer: A

187. Snowflake schema is an extension of:
A) Star schema
B) Galaxy schema
C) ER schema
D) None
Answer: A

188. Data mining involves:
A) Discovering patterns in large data
B) Deleting unwanted data
C) Encrypting data
D) None
Answer: A

189. ETL stands for:
A) Extract, Transform, Load
B) Enter, Transfer, Load
C) Edit, Transfer, Link
D) None
Answer: A

190. A data mart is:
A) Subset of a data warehouse
B) Full warehouse
C) Database copy
D) None
Answer: A

191. Metadata means:
A) Data about data
B) Raw data
C) Duplicate data
D) None
Answer: A

192. The top level of data warehouse architecture is:
A) Front-end tools layer
B) Data source layer
C) Staging area
D) None
Answer: A

193. The staging area in data warehousing is used for:
A) Data cleaning and transformation
B) Data visualization
C) Query execution
D) None
Answer: A

194. Big Data is characterized by:
A) Volume, Velocity, Variety
B) Value, Version, Validation
C) Speed, Size, Security
D) None
Answer: A

195. Hadoop is mainly used for:
A) Distributed storage and processing
B) Transactional systems
C) Small databases
D) None
Answer: A

196. HDFS stands for:
A) Hadoop Distributed File System
B) High Data File Storage
C) Hyper Distributed File Service
D) None
Answer: A

197. MapReduce in Hadoop is used for:
A) Parallel data processing
B) Data storage
C) Backup
D) None
Answer: A

198. Which language is used for querying data in Hadoop?
A) HiveQL
B) MySQL
C) SQL*Plus
D) None
Answer: A

199. NoSQL databases differ from traditional databases by being:
A) Schema-less
B) Scalable
C) Distributed
D) All of these
Answer: D

200. Which of the following is an example of a column-family NoSQL database?
A) Cassandra
B) MongoDB
C) Redis
D) Neo4j
Answer: A

Leave a Comment

Your email address will not be published. Required fields are marked *

You cannot copy content of this page

Scroll to Top