Topic / 89 questions

DBMS and SQL MCQs

DBMS and SQL MCQs cover database management concepts and the SQL query language, a core subject in computer science degrees, IT recruitment tests and lecturer exams. Questions range from keys and normal forms to joins, GROUP BY and HAVING, transactions and concurrency control. Each answer includes an explanation, and SQL output questions were checked by running the queries.

Advertisement
Question 05 DBMS and SQL

Why must a secondary index, built on a key that is not the file’s sort order, be a dense index?

Correct answer C. Because the records are not sorted on that key, so every key value needs its own index entry

Open question
Advertisement
Question 14 DBMS and SQL

What does strict two-phase locking add to basic 2PL, and what problem does it remove?

Correct answer B. Exclusive locks are held until commit or abort, which removes cascading aborts

Open question
Advertisement
Question 18 DBMS and SQL

What does the write-ahead logging (WAL) rule require?

Correct answer B. Log records describing a change must reach stable storage before the changed data page does

Open question

About DBMS and SQL MCQs

The first part covers database fundamentals: why a DBMS is preferred to file systems, data independence, the three-schema architecture, data models and the entity-relationship model with entities, attributes, relationships, cardinality and weak entities.

The relational model section deals with super, candidate, primary, foreign and composite keys, integrity constraints, NULL values and relational algebra. Normalisation questions test functional dependencies, attribute closure, 1NF to BCNF, update anomalies and lossless decomposition.

SQL questions cover DDL, DML, DCL and TCL commands, the difference between DELETE, TRUNCATE and DROP, WHERE versus HAVING, aggregate functions and NULLs, joins, subqueries, UNION versus UNION ALL and views. The last part covers indexing with B+ trees, transactions and ACID properties, serializability, locking protocols, deadlocks and log-based recovery.

Key facts to remember

  • A primary key cannot contain NULL values and must be unique.
  • WHERE filters rows before grouping; HAVING filters groups after GROUP BY.
  • COUNT(*) counts all rows, while COUNT(column) ignores NULLs.
  • ACID stands for Atomicity, Consistency, Isolation and Durability.
  • Two-phase locking guarantees conflict serializability but not freedom from deadlock.

Exams that include DBMS and SQL MCQs

Pakistan

  • NTS
  • PPSC Computer Science Lecturer
  • FPSC Database Administrator and IT posts
  • University exams

India

  • GATE CS
  • UGC NET Computer Science
  • Campus placements
  • IBPS IT Officer

Bangladesh

  • BCS (technical cadre)
  • Bank IT officer tests
  • Government programmer and database posts

How to prepare for DBMS and SQL MCQs

  1. Practise finding candidate keys from a set of functional dependencies using attribute closure.
  2. Learn the normal forms in order and the exact condition each one adds.
  3. For SQL output questions, work through FROM, WHERE, GROUP BY, HAVING, SELECT and ORDER BY in that logical order.
  4. Draw a precedence graph to test conflict serializability: a cycle means the schedule is not serializable.

Frequently asked questions

What is the difference between DELETE, TRUNCATE and DROP?

DELETE is a DML command that removes selected rows and can use a WHERE clause. TRUNCATE removes all rows quickly but keeps the table structure. DROP removes the table itself, including its structure and data.

Which DBMS topics are most important for GATE and job tests?

Normalisation and functional dependencies, keys, SQL queries with joins and aggregates, relational algebra, transactions and serializability, and indexing with B and B+ trees are asked most often.

Last reviewed October 2026