## Important Questions for Class 12 Computer Science (Python) – Database Concepts

**Short Answer Type Questions-I**

**Question 1:**

Observe the following PARTICIPANTS and EVENTS table cerefully and write the name of the RDBMS operation which will be used to produce the output as shown in RESULT? Also, find the Degree and Cardinality of the RESULT.

**Answer:**

Cartesian Product

Degree — 4

Cardinality = 6

**Question 2:**

Define degree and cardinality. Also, Based upon given table write degree and cardinality.

**Answer:**

Degree is the number of attributes or columns present in a table.

Cardinality is the number of tuples or rows present in a table.

Patients Degree = 4

Cardinality = 5

**Question 3:**

Observe the following table and answer the parts (i) and (ii):

- In the above table, can we have Qty as primary key.
- What is the cardinality and degree of the above table?

**Answer:**

- We cannot use Qty as primary key because there is a duplication of values and primary key value cannot be duplicate.
- Degree =4

Cardinality = 5

**Question 4:**

Explain the concept of union between two tables, with the help of appropriate example.

**Answer:
**The union operation denoted by ‘U’ combines two or more relations. The resultant of union operation contain tuples that are in either of the table or in both tables.

**Question 5:**

Observe the following STUDENTS and EVENTS tables carefully and write the name of the RDBMS operation which will be used to produce the output as shown in LIST table? Also, find the degree and cardinality of the table.

**Answer:
**Cartesian Product

Degree = 4

Cardinality = 6

**Question 6:**

Observe the following MEMBER and ACTIVITY tables carefully and write the name of the RDBMS operation, which will be used to produce the output as shown in REPORT? Also, find the Degree and Cardinality of the REPORT.

**Answer:
**Join operation or MEMBER U ACTIVITY

Degree of Report = No of columns

(No of Attributes) = 3

Candinality Report = No of Rows

(No of tuples) = 6

**Question 7:
**Observe the table ‘Club’ given below:

- What is the cardinality and degree of the given table?
- If a new column Contact_No has been added and three more members have joined the club then

**Answer:**

- Cardinality = 4 Degree = 5
- Cardinality = 7
- Degree = 6

**Question 8:**

What do you understand by Union & Cartesian product in the relational algebra?

**Answer:
**

**Union of R ans S :**The Union of two relations is a relation that includes all the tuples that are either in R or in S or in both R and S. Duplicate tuples are eliminated.

The Union is an operator which works on two how sets. It combines the tuples of one relation with all the tuples of the other relation such that there is no duplication.

**Cartesian Product:** The cartesian product is an operator which works on two sets. It combines the tuples of one relation with all the tuples of the other relation.

**Example:** Cartesian Product

**Question 9:**

Differentiate between the Alternate key of a table with the help of an example.

**Answer:
**

**Primary Key:**A primary key is a value that can be used to identify a unique row in a table .

**Alternate Key:**An alternate key is any candidate key which is not selected to be the primary key

**Example:**

So, (Bank Account Number, Aadhaar Number) are candidate keys for the table.

Aadhaar Number — Primary key

Bank Account Number — Alternate key

**Question 10:**

Explain the concept of candidate key with the help of an appropriate example.

**Answer:
**Candidate key is a column or set of columns that can help in identifying records uniquely.

Example, consider a Table STUDENT.

Here, AdmnNo & Roll No define Table uniquely.

Hence, they are candiadate keys

**Question 11:**

What do you understand by degree & cardinality of a Table ?

**Answer:
**Degree refers to the number of columns in a table.

Cardinality refers to the number of rows.

**Question 12:
**Observe the following table and answer the part (i) and (ii) accordingly.

- In the above table, can we take Mno as Primary key ? (Answer as [Yes/No] only.) Justify your answer with a valid reason.
- What is the degree and the cardinality of the above table?

**Answer:**

- No
- Degree = 4

Cardinality = 5

[**Hint:**Because Pencil and Eraser are having the same Mno = 2. Primary key needs to be unique]

**Question 13:**

Give a suitable example of a table with sample data and illustrate Primary and Candidate keys in it.

**Answer:
**A table may have more than one such attribute or a group of attribute that identifies a row/ tuple uniquely, all such attribute(s) are known as Candidate keys. Out of the Candidate keys, one is selected as Primary key.

Id = Primary key Id and Qty = Candidates Keys

**Question 14:**

What do you understand by selection and projection operations in the relational algebra?

**Answer:
**Projection (n): In relational algebra, projection is a unary operation. The result of such projection is defined as the set obtained when the components of the tuple R are restricted to the set {a

_{1}…,a

_{n}} – it discards (or exculdes) the other attributes.

Selection (): In relational algebra, a selection is a unary operation written as (R) or (R) where:

- a and b are attribute names
- i is a binary operation in the set
- v is a value constant
- R is a relation

The selection (R) selects all those tuples in R for which i holds between the a atribute and the b attribute.

**Example: Selection and Projection**

**Question 15:**

What do you understand by Primary key and Candidate keys.

**Answer:
**An attribute or set of attributes which are used to identify a tuple uniquely is known as primary key. If a tuple has more than one such attribute which identify a tuple uniquely, than all such attributes are known as candidate keys.

**Question 16:**

What is relation? Define the relational data model.

**Answer:
**A relation is a table having atomic values, unique row, and unordered rows and columns. The relational model represent data and relationship among data by a collection of tables known as relation, each of which has a number of columns with unique names.

**Question 17:
**Define domain with respect to database. Give an example.

**Answer:**

A domain is a pool of values from which the actual values appearing in a given column are drawn.

For example: The values appearing in the Supp# column of both the suppliers table and the Shipment table are drawn from the same domain.

**Question 18:
**Expand the following:

- SQL
- DBMS

**Answer:**

- SQL – Structured Query Language.
- DBMS – Data Base Management System.

**Question 19:**

What do you understand by candidate keys in a table? Give a suitable example of candidate keys from a table containing some meaningful data.

**Answer:
**

**Candidate key:**A candidate key is one that can identify each row of a table uniquely. Generally, a candidate key becomes the primary key of the table. If the table has more than one candidate key, one of them will become the primary key, and the rest are called alternate keys.

**Example:**

**Question 20:**

What are all the domain names possible in gender ?

**Answer:**

Male and Female

**Question 21:**

A table ‘customer’ has 10 columns but no row. Later, 10 new rows are inserted and 3 rows are deleted in the table. What is the degree and cardinality of the table customer.

**Answer:
**Degree = 10 [no. of cols]

Cardinality = 10-3 = 7 [no. of rows]

**Question 22:**

A table ‘student’ has 3 columns and 10 rows and another table ‘student 2’ has the same columns as student but 15 rows. 5 rows are common in both the tables. If we take union, what is the degree and cardinality of the resultant table ?

**Answer:
**Degree = 3

Cardinality = 30 (20 + 15 – 5)

**Question 23:**

A table ‘student’ has 4 columns and 10 rows and ‘student 2’ has 5 columns and 5 rows. If we take cartesian product of these two tables, what is the degree and cardinality of the resultant table ?

**Answer:
** Degree = 4 x 5 = 20 [no. of columns]

Cardinality = 10 x 5 = 50 [no. of rows]

**Question 24:**

In the following 2 tables, find the union value of Student 1 and Student 2.

**Answer:**