1.
It is mandatory to define constraint for each attribute of a table.
Correct Answer
B. False
Explanation
It is not mandatory to define a constraint for each attribute of a table. Constraints are used to enforce rules and restrictions on the data in a table, such as ensuring that certain columns cannot have null values or that values must be unique. While it is good practice to define constraints for attributes that require them, it is not required for every attribute in a table.
2.
Each table can contain more than one primary key.
Correct Answer
B. False
Explanation
Each table can have only one primary key. A primary key is a unique identifier for each row in a table and ensures that each row is uniquely identified. Having more than one primary key in a table would contradict this purpose.
3.
SQL Server automatically sets the NOT NULL constraint for all the primary key columns if the NOT NULL constraint is not specified for these columns.
Correct Answer
A. True
Explanation
In SQL Server, when a primary key column is defined, it is automatically set with the NOT NULL constraint. This means that the column cannot have a null value, ensuring that each record in the table will have a unique value for the primary key column. Therefore, the statement "True" is correct.
4.
Unique constraints ensures that all the values in a column are distinct/unique.
Correct Answer
A. True
Explanation
Unique constraints are used in a database to ensure that all values in a specific column are unique. This means that no two rows in that column can have the same value. By enforcing this constraint, it helps maintain data integrity and prevents duplicate entries. Therefore, the given statement is true.
5.
The result of a SELECT statement can contain duplicate rows.
Correct Answer
A. True
Explanation
A SELECT statement in SQL retrieves data from a database table. It is possible for the result of a SELECT statement to contain duplicate rows if the table being queried has duplicate data. This can happen if there are multiple records in the table with the same values for all columns. Therefore, the statement "The result of a SELECT statement can contain duplicate rows" is true.
6.
Primary Key does allow the Null Values. where as in Unique key doesn't accept the Null values
Correct Answer
B. False
Explanation
The explanation for the given correct answer is that the statement is incorrect. In a database, a primary key is a column or a set of columns that uniquely identifies each record in a table. Primary keys do not allow null values, meaning that every record must have a value in the primary key column. On the other hand, a unique key also ensures uniqueness but allows null values. Therefore, the statement that primary keys allow null values is false.
7.
A NULL value is treated as a blank or zero.
Correct Answer
B. False
Explanation
A NULL value is not treated as a blank or zero. In databases, a NULL value represents the absence of a value or unknown information. It is different from a blank or zero, as it indicates that the value is missing or undefined.
8.
By default, each attribute can take NULL values except for the primary key.
Correct Answer
A. True
Explanation
In a database, NULL represents the absence of a value. By default, each attribute in a table can have NULL values unless it is specified as the primary key. The primary key is a unique identifier for each record and cannot have NULL values. Therefore, the statement "By default, each attribute can take NULL values except for the primary key" is true.
9.
A relation may have multiple foreign keys.
Correct Answer
A. True
Explanation
In a relational database, a foreign key is a field or a set of fields that refers to the primary key of another table. Since a table can have multiple relationships with other tables, it is possible for it to have multiple foreign keys. These foreign keys establish the connections and maintain the integrity of the data across different tables. Therefore, the statement is true.
10.
Each foreign key is defined on a multiple attribute.
Correct Answer
B. False
Explanation
Foreign keys are used to establish a relationship between two tables in a database. They are defined on a single attribute or column in a table, not on multiple attributes. The purpose of a foreign key is to ensure referential integrity, meaning that the values in the foreign key column must match the values in the referenced primary key column. Therefore, the given statement is incorrect, and the correct answer is False.
11.
We can use DROP statement to remove a database or table permanently from the system.
Correct Answer
A. True
Explanation
The DROP statement in SQL is used to permanently remove a database or table from the system. When we execute the DROP statement, it deletes the specified database or table, including all its data and associated objects. This action cannot be undone, so it is important to use the DROP statement with caution. Therefore, the given statement is true.
12.
We can insert two records with same roll number in a table if roll is assigned as primary key.
Correct Answer
B. False
Explanation
It is not possible to insert two records with the same roll number in a table if the roll number is assigned as a primary key. A primary key is a unique identifier for each record in a table, and it ensures that no two records have the same value for that particular column. Therefore, if the roll number is set as the primary key, it will enforce uniqueness and prevent the insertion of duplicate records with the same roll number.