Database Interview Questions Hindi mein

Database Fundamentals कोर्स के 25 सवाल, हर सवाल के सही जवाब और explanation के साथ। जवाब देखने से पहले ख़ुद सोचें।

What a Database System Is

1. Which problem of file-based systems does a DBMS address with transactions?

  1. Atomicity: a crash halfway through an update leaving data partially changed
  2. Choosing file names
  3. Displaying data in colour
  4. Compressing images
जवाब देखें

जवाब: Atomicity: a crash halfway through an update leaving data partially changed

Transactions make multi-step updates all-or-nothing, even across crashes.

पाठ: Why Databases Instead of Files

2. Adding an index without changing any table definitions or applications is an example of what?

  1. Logical data independence
  2. Referential integrity
  3. Normalisation
  4. Physical data independence
जवाब देखें

जवाब: Physical data independence

Changing physical storage without affecting the conceptual schema is physical data independence.

पाठ: Three-Schema Architecture and Data Independence

3. Who proposed the relational model of data, and when?

  1. Larry Ellison, 1979
  2. Peter Chen, 1990
  3. E. F. Codd, 1970
  4. Edgar Dijkstra, 1965
जवाब देखें

जवाब: E. F. Codd, 1970

Codd described the relational model in his 1970 paper at IBM.

पाठ: Data Models

Entity-Relationship Modelling

4. In an ER diagram, how is a multi-valued attribute such as phone numbers drawn?

  1. A dashed oval
  2. A diamond
  3. A double oval
  4. An underlined rectangle
जवाब देखें

जवाब: A double oval

Multi-valued attributes use a double oval; derived attributes use a dashed one.

पाठ: Entities, Attributes and Relationships

5. What identifies a weak entity?

  1. Its own primary key alone
  2. Its partial key combined with the key of its owner entity
  3. A random number
  4. The relationship's attributes only
जवाब देखें

जवाब: Its partial key combined with the key of its owner entity

A weak entity is identified by the owner's key plus its own discriminator.

पाठ: Weak Entities, Specialisation and Aggregation

6. How is a many-to-many relationship between STUDENT and COURSE represented in tables?

  1. A separate junction table holding keys of both, plus relationship attributes
  2. A foreign key in STUDENT pointing to COURSE
  3. A comma-separated list of course IDs in STUDENT
  4. It cannot be represented
जवाब देखें

जवाब: A separate junction table holding keys of both, plus relationship attributes

M:N relationships map to their own table with a composite key from both entities.

पाठ: Mapping ER Diagrams to Tables

The Relational Model and Relational Algebra

7. Which statement about candidate keys is true?

  1. A candidate key is a minimal super key
  2. A relation can have only one candidate key
  3. Candidate keys may contain null values freely
  4. A foreign key is always a candidate key of its own relation
जवाब देखें

जवाब: A candidate key is a minimal super key

Candidate keys are super keys with no redundant attributes; a relation may have several.

पाठ: Relations, Keys and Integrity Constraints

8. Which relational algebra operator answers "students enrolled in all core courses"?

  1. Union
  2. Projection
  3. Rename
  4. Division
जवाब देखें

जवाब: Division

Division expresses "for all" queries over a set of required values.

पाठ: Relational Algebra

9. Why can a column alias defined in SELECT not be used in the WHERE clause?

  1. Aliases are not allowed in SQL
  2. WHERE only accepts numbers
  3. WHERE is evaluated logically before SELECT computes the aliased columns
  4. Aliases are only valid in GROUP BY
जवाब देखें

जवाब: WHERE is evaluated logically before SELECT computes the aliased columns

Logical processing order is FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY.

पाठ: SQL Essentials for Fundamentals

Functional Dependencies and Normalisation

10. Given R(A, B, C) and F = { A → B, B → C }, what is {A}⁺?

  1. {A}
  2. {A, B}
  3. {A, B, C}
  4. {B, C}
जवाब देखें

जवाब: {A, B, C}

A determines B, and B determines C, so the closure of A contains all three attributes.

पाठ: Functional Dependencies, Closures and Keys

11. A relation has key (roll_no, course_id) and the FD roll_no → name. Which normal form does it violate?

  1. 1NF
  2. 2NF
  3. Only BCNF
  4. None
जवाब देखें

जवाब: 2NF

name depends on part of the composite key, which is a partial dependency forbidden by 2NF.

पाठ: Normal Forms: 1NF, 2NF, 3NF and BCNF

12. When is the decomposition of R into R1 and R2 lossless?

  1. When the common attributes functionally determine all attributes of R1 or of R2
  2. When R1 and R2 have no attributes in common
  3. Whenever both are in BCNF
  4. Only when R has a single candidate key
जवाब देखें

जवाब: When the common attributes functionally determine all attributes of R1 or of R2

The shared attributes must form a key for at least one of the decomposed relations.

पाठ: Lossless Decomposition, Dependency Preservation and Denormalisation

Transactions and Isolation

13. Which ACID property guarantees that a committed transaction survives a power failure?

  1. Durability
  2. Atomicity
  3. Consistency
  4. Isolation
जवाब देखें

जवाब: Durability

Durability is provided by writing changes to stable storage, typically via the log, before commit completes.

पाठ: Transactions and ACID

14. When is a schedule conflict serializable?

  1. When transactions never read data
  2. When it has exactly two transactions
  3. When all operations are writes
  4. When its precedence graph contains no cycle
जवाब देखें

जवाब: When its precedence graph contains no cycle

An acyclic precedence graph means an equivalent serial order exists.

पाठ: Schedules and Serializability

15. Transaction T1 reads a row, T2 updates and commits it, and T1 reads it again getting a different value. Which anomaly is this?

  1. Dirty read
  2. Phantom read
  3. Non-repeatable read
  4. Deadlock
जवाब देखें

जवाब: Non-repeatable read

The same row read twice returns different committed values: a non-repeatable read.

पाठ: Anomalies and Isolation Levels

Concurrency Control and Recovery

16. Which variant of two-phase locking prevents cascading aborts by holding exclusive locks until commit?

  1. Basic 2PL
  2. Wait-die
  3. Strict 2PL
  4. Optimistic locking
जवाब देखें

जवाब: Strict 2PL

Strict 2PL keeps write locks until the transaction ends, so no one reads uncommitted data.

पाठ: Locking, Two-Phase Locking and Deadlocks

17. What is a key benefit of MVCC?

  1. It never stores more than one version of a row
  2. Readers see a consistent snapshot and do not block writers
  3. It removes the need for transactions
  4. It prevents all deadlocks between writers
जवाब देखें

जवाब: Readers see a consistent snapshot and do not block writers

Multiple versions let reads proceed without waiting for writes, and vice versa.

पाठ: Timestamps, Optimistic Control and MVCC

18. In write-ahead logging, what must reach stable storage before a modified data page is written?

  1. The log records describing that change
  2. The entire database backup
  3. The query plan
  4. Nothing; pages can be written at any time
जवाब देखें

जवाब: The log records describing that change

WAL requires log records to be durable before the corresponding data changes are written.

पाठ: Logging, Checkpoints and Crash Recovery

Storage, Indexing and Query Processing

19. What is the role of the buffer pool?

  1. To cache disk pages in memory to reduce I/O
  2. To store backups
  3. To hold the SQL parser
  4. To encrypt data
जवाब देखें

जवाब: To cache disk pages in memory to reduce I/O

The buffer pool keeps frequently used pages in RAM so most reads avoid disk I/O.

पाठ: Pages, Files and the Buffer Pool

20. Why are B+ trees well suited to range queries such as `score BETWEEN 80 AND 90`?

  1. They hash every key
  2. They store only one key per node
  3. They avoid using disk
  4. Their leaf nodes are sorted and linked, so the range can be scanned sequentially after one search
जवाब देखें

जवाब: Their leaf nodes are sorted and linked, so the range can be scanned sequentially after one search

One descent finds the start of the range; linked leaves then deliver the rest in order.

पाठ: Indexes: B+ Trees and Hashing

21. Which join algorithm builds an in-memory table on the smaller input and probes it with rows from the larger input?

  1. Nested loop join
  2. Sort-merge join
  3. Hash join
  4. Cartesian product
जवाब देखें

जवाब: Hash join

Hash joins build a hash table on one input and probe it with the other, efficient for large equality joins.

पाठ: Query Processing, Join Algorithms and EXPLAIN

Beyond a Single Relational Database and Revision

22. According to the CAP theorem, what must a distributed database choose between during a network partition?

  1. Speed and cost
  2. SQL and NoSQL
  3. Consistency and availability
  4. Indexes and joins
जवाब देखें

जवाब: Consistency and availability

Under a partition, a system can either refuse some requests (C) or answer with possibly stale data (A).

पाठ: NoSQL, CAP and BASE

23. What is a known weakness of two-phase commit?

  1. It cannot guarantee atomicity
  2. Participants can block, holding locks, if the coordinator fails after they voted yes
  3. It only works on one machine
  4. It requires NoSQL databases
जवाब देखें

जवाब: Participants can block, holding locks, if the coordinator fails after they voted yes

2PC is atomic but blocking when the coordinator fails at a critical point.

पाठ: Replication, Partitioning and Distributed Transactions

24. Why enforce rules such as foreign keys and CHECK constraints in the database rather than only in application code?

  1. Constraints protect the data from every application, script and manual change, not just one code path
  2. Databases run faster without constraints
  3. Application code cannot validate data
  4. Constraints replace the need for transactions
जवाब देखें

जवाब: Constraints protect the data from every application, script and manual change, not just one code path

Database constraints apply universally, so no client can bypass them.

पाठ: Practical Database Design Checklist

25. A relation is in 3NF but not in BCNF. What must be true?

  1. It has repeating groups
  2. It has no candidate keys
  3. It contains a partial dependency of a non-prime attribute
  4. Some FD X → A has a non-super-key X where A is a prime attribute
जवाब देखें

जवाब: Some FD X → A has a non-super-key X where A is a prime attribute

3NF allows X → A with A prime even when X is not a super key; BCNF does not.

पाठ: Revision and Exam Questions

← कोर्स पर वापस जाएँ