๐๏ธ Database Concepts Quiz โ Class 12 Computer Science (Code 083)
Practice 20 CBSE Class 12 Computer Science (Code 083) MCQs on database concepts and the relational data model โ what a database and DBMS are, data integrity, relations, attributes, tuples, domain, degree, cardinality, and keys (candidate key, primary key, alternate key, foreign key).
Every answer below has been checked for accuracy, including a correction where the original definitions of โcandidate keyโ and โprimary keyโ were worded identically, making them indistinguishable. Tap any question to reveal the answer with a clear explanation.
๐๏ธ Database Basics
What is a database?
- A structured collection of data
- A collection of files on a computer
- A type of computer programming language
- A graphical user interface
Show Answer & Explanation
โ Answer: (a) A structured collection of data
A database is a structured collection of data, organized so it can be efficiently stored, accessed, managed, and updated โ much more than just a loose folder of files.
๐๏ธ Database Basics
Why is a database needed in the context of information management?
- To slow down data access
- To limit data storage
- To prevent data retrieval
- To centralize and organize data
Show Answer & Explanation
โ Answer: (d) To centralize and organize data
Databases exist to centralize and organize data โ bringing scattered information into one well-structured system that’s easy to search, update, and keep consistent, rather than spread across disconnected files.
๐๏ธ Database Basics
What is the primary purpose of a database management system (DBMS)?
- To create computer programs
- To facilitate internet communication
- To manage and organize data in a database
- To design hardware components
Show Answer & Explanation
โ Answer: (c) To manage and organize data in a database
A DBMS is the software layer that lets users and applications create, manage, query, and organize data stored in a database โ examples include MySQL, Oracle, and PostgreSQL.
๐๏ธ Database Basics
In the context of databases, what is data integrity?
- The process of encrypting data
- The accuracy and consistency of data
- The speed of data retrieval
- The amount of data storage
Show Answer & Explanation
โ Answer: (b) The accuracy and consistency of data
Data integrity refers to keeping data accurate and consistent throughout its lifecycle โ ensuring, for example, that a value in one table correctly matches related data elsewhere, with no contradictions or corruption.
๐๏ธ Database Basics
How does a relational database differ from a simple, unstructured collection of files?
- It uses a table-based structure to organize data
- It stores data without any structure at all
- It stores everything in a single, undivided file
- It doesn’t allow any data retrieval
Show Answer & Explanation
โ Answer: (a) It uses a table-based structure to organize data
A relational database organizes data into structured tables (rows and columns), with defined relationships between them โ a far more organized and query-friendly approach than loose, unstructured files.
๐ Relational Model
What is a relation in the context of the relational data model?
- The connection between two databases
- The process of data retrieval
- The encryption of data
- A table that stores data
Show Answer & Explanation
โ Answer: (d) A table that stores data
In relational database terminology, a relation is simply the formal term for a table โ a structured collection of rows (tuples) and columns (attributes).
๐ Relational Model
In a relational data model, what is an attribute?
- A condition for data retrieval
- A column or field in a table
- A foreign key linking tables
- The encryption key for data
Show Answer & Explanation
โ Answer: (b) A column or field in a table
An attribute is a column (field) in a table โ representing one specific property of the data, like โNameโ or โAgeโ in a Students table.
๐ Relational Model
What is a tuple in the context of the relational data model?
- A type of data encryption
- A row or record in a table
- A query language for databases
- A primary key in a table
Show Answer & Explanation
โ Answer: (b) A row or record in a table
A tuple is a single row (record) in a table โ representing one complete entry, like one specific student’s full set of details.
๐ Relational Model
Define the term โdomainโ as it relates to the relational data model.
- The set of allowed values for an attribute
- The connection between tables
- The total number of tuples in a table
- The process of data insertion
Show Answer & Explanation
โ Answer: (a) The set of allowed values for an attribute
A domain is the set of all permissible values an attribute can take โ e.g. the domain for a โGenderโ column might be restricted to just โMโ or โFโ.
๐ Relational Model
What does the โdegreeโ of a relation represent?
- The level of encryption
- The number of attributes in a relation
- The number of tuples in a relation
- The process of data deletion
Show Answer & Explanation
โ Answer: (b) The number of attributes in a relation
The degree of a relation is simply the number of columns (attributes) it has โ e.g. a table with 5 columns has a degree of 5.
๐ Relational Model
In the relational data model, what is cardinality?
- The process of data retrieval
- The speed of data access
- The number of relationships in a database
- The number of tuples in a relation
Show Answer & Explanation
โ Answer: (d) The number of tuples in a relation
Cardinality is the number of rows (tuples) a relation contains โ e.g. a table with 100 records has a cardinality of 100.
๐ Keys
What is a candidate key in a relational database?
- An attribute with encrypted values
- A key used for data retrieval
- An attribute (or set of attributes) that COULD uniquely identify each tuple in a table
- The primary table in a database
Show Answer & Explanation
โ Answer: (c) An attribute (or set of attributes) that COULD uniquely identify each tuple in a table
A candidate key is any attribute (or combination) capable of uniquely identifying every row โ a table can have multiple candidate keys, each a valid โcandidateโ for becoming the table’s primary key.
๐ Keys
Define the term โprimary keyโ in the context of the relational data model.
- The candidate key that is specifically CHOSEN to be the main unique identifier for a table
- Any attribute in the table, regardless of uniqueness
- A secondary table in a database
- The number of attributes in a relation
Show Answer & Explanation
โ Answer: (a) The candidate key that is specifically CHOSEN to be the main unique identifier for a table
A primary key is the one candidate key selected by the database designer to serve as the table’s official unique identifier. (This question is corrected from a version whose definition โ โa unique identifier for a tupleโ โ was identical, word for word, to the definition given for โcandidate keyโ, making the two concepts indistinguishable. The real distinction is that a table can have several candidate keys, but only one of them is chosen as the primary key.)
๐ Keys
What is an alternate key in the relational data model?
- An attribute with encrypted values
- A key used for data retrieval
- A candidate key that is NOT selected as the primary key
- The process of data deletion
Show Answer & Explanation
โ Answer: (c) A candidate key that is NOT selected as the primary key
An alternate key is simply any candidate key that wasn’t chosen to be the primary key โ it could still uniquely identify rows, but the primary key role went to a different candidate instead.
๐ Keys
In the relational data model, what is a foreign key?
- A key used for data retrieval
- A unique identifier for a tuple in a table
- An attribute with encrypted values
- A field that links to the primary key in another table
Show Answer & Explanation
โ Answer: (d) A field that links to the primary key in another table
A foreign key is an attribute in one table that references the primary key of another table โ this is exactly how relational databases establish relationships between different tables.
๐ Keys
Can a single table have more than one candidate key, but only one primary key?
- No, a table can only ever have exactly one candidate key
- Yes โ a table may have several candidate keys, but the designer selects only ONE of them to serve as the primary key
- No, every candidate key automatically becomes a primary key
- Yes, but a table can also have multiple primary keys simultaneously
Show Answer & Explanation
โ Answer: (b) Yes โ a table may have several candidate keys, but the designer selects only ONE of them to serve as the primary key
This is exactly right: a table can have multiple candidate keys (each independently capable of uniquely identifying rows), but the designer picks just one to be the primary key โ the rest become alternate keys.
๐ Keys
Can a primary key column contain NULL (empty/missing) values?
- Yes, primary keys can contain NULL values freely
- No โ a primary key must always have a value for every row, and cannot be NULL
- Only the first row’s primary key can be NULL
- It depends entirely on the programming language used
Show Answer & Explanation
โ Answer: (b) No โ a primary key must always have a value for every row, and cannot be NULL
A core rule of the relational model is that a primary key can never be NULL โ since its whole job is to uniquely identify every row, allowing it to be empty would break that guarantee.
๐ Relational Model
A table named โStudentsโ has 6 columns (Roll No, Name, Class, Section, Marks, Grade) and currently holds 40 rows of student records. What are its degree and cardinality?
- Degree = 40, Cardinality = 6
- Degree = 6, Cardinality = 40
- Degree = 6, Cardinality = 6
- Degree = 40, Cardinality = 40
Show Answer & Explanation
โ Answer: (b) Degree = 6, Cardinality = 40
Degree counts the columns (attributes) โ there are 6. Cardinality counts the rows (tuples) โ there are 40. So Degree = 6, Cardinality = 40.
๐ Keys
What is the primary purpose of a foreign key in maintaining data across tables?
- To encrypt sensitive data across tables
- To maintain referential integrity by linking related records between two tables
- To speed up data retrieval by removing all relationships
- To automatically delete data from the referenced table
Show Answer & Explanation
โ Answer: (b) To maintain referential integrity by linking related records between two tables
A foreign key’s main job is to maintain referential integrity โ ensuring that a value in one table (like a โStudentIDโ in a Marks table) actually corresponds to a real, existing record in the table it references (the Students table), preventing orphaned or inconsistent data.
๐๏ธ Database Basics
Which of the following is a genuine benefit of using a DBMS over storing data in plain, unstructured files?
- It guarantees data is always 100% impossible to lose
- It reduces data redundancy and helps maintain consistency across related data
- It eliminates the need for any data backup ever
- It makes data completely inaccessible to any user
Show Answer & Explanation
โ Answer: (b) It reduces data redundancy and helps maintain consistency across related data
One of the biggest advantages of a DBMS is reducing data redundancy (avoiding the same information being duplicated inconsistently in multiple places) and maintaining consistency, since related data is properly linked through keys rather than copy-pasted everywhere.
