0% found this document useful (0 votes)
57 views22 pages

Unit-1, 2 and 3

The document contains 20 multiple choice questions related to relational databases and SQL. The questions cover topics such as relational algebra operations, functional dependencies, database normalization, integrity constraints, SQL queries using operators like SELECT, WHERE, ORDER BY, and aggregate functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views22 pages

Unit-1, 2 and 3

The document contains 20 multiple choice questions related to relational databases and SQL. The questions cover topics such as relational algebra operations, functional dependencies, database normalization, integrity constraints, SQL queries using operators like SELECT, WHERE, ORDER BY, and aggregate functions.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 22

MCQS

Unit- 1, 2 and 3
1. Given the relations
employee (name, salary, deptno) and
department (deptno, deptname, address)

Which of the following queries cannot be expressed using the basic


relational algebra operations (U, -, x, π, σ, p)?

(a) Department address of every employee


(b) Employees whose name is the same as their department name
(c) The sum of all employees’ salaries
(d) All employees of a given department
Solution: (c)
The 6 basic operators of relational algebra are selection(σ), projection(π), Cartesian
product (x) (also called the cross product or cross join), set union (U), set
difference (-), and the rename (p). Aggregation is not possible with these basic
relational algebra operations
2. Given relations r(w, x) and s(y, z), the result of:
SELECT distinct w, x
FROM r, s
is guaranteed to be same as r, provided

(a) r has no duplicates and s is non-empty


(b) r and s have no duplicates
(c) s has no duplicates and r is non-empty
(d) r and s have the same number of tuples

Solution: (a)
The query selects all attributes of r. Since we have distinct in query, result can be
equal to r only if r doesn’t have duplicates.
If we do not give any attribute on which we want to join two tables, then the
queries like above become equivalent to Cartesian product. Cartisian product of
two sets will be empty if any of the two sets is empty. So, s should have atleast one
record to get all rows of r.
3. Which of the following is TRUE?

(A) Every relation in 2NF is also in BCNF


(B) A relation R is in 3NF if every non-prime attribute of R is fully
functionally dependent on every key of R
(C) Every relation in BCNF is also in 3NF
(D) No relation can be in both BCNF and 3NF

Solution: (c)
BCNF is a stronger version 3NF. So every relation in BCNF will also be in 3NF.
4. Every time attribute A appears, it is matched with the same value
of attribute B, but not the same value of attribute C. Therefore, it is
true that:

A. A → B.
B. A → C.
C. A → (B,C).
D. (B,C) → A.
5. Consider a relational table with a single record for each registered
student with the following attributes.
1. Registration_Number: Unique registration number for each registered
student
2. UID: Unique Identity number, unique at the national level for each citizen
3. BankAccount_Number: Unique account number at the bank. A student
can have multiple accounts or joint accounts. This attributes stores the
primary account number
4. Name: Name of the Student
5. Hostel_Room: Room number of the hostel

Which of the following options is INCORRECT?


(A) BankAccount_Number is a candidate key
(B) Registration_Number can be a primary key
(C) UID is a candidate key if all students are from the same country
(D) If S is a superkey such that S ∩ UID is NULL then S ∪ UID is also a superkey
Solution: (a)

A Candidate Key value must uniquely identify the corresponding


row in table.

BankAccount_Number is not a candidate key. As per the question


“A student can have multiple accounts or joint accounts. This
attributes stores the primary account number”.

If two students have a joint account and if the joint account is


their primary account, then BankAccount_Number value cannot
uniquely identify a row.
6. Which of the following functional dependencies hold for relations
R(A, B, C) and S(B, D, E):
B → A,
A→C
The relation R contains 200 tuples and the relation S contains 100
tuples. What is the maximum number of tuples possible in the
natural join R◊◊S (R natural join S)
Solution: (a)
(A) 100 From the given set of functional dependencies, it can be
(B) 200 observed that B is a candidate key of R. So all 200 values of B
must be unique in R. There is no functional dependency given
(D) 300 for S. To get the maximum number of tuples in output, there
(D) 2000 can be two possibilities for S.
1) All 100 values of B in S are same and there is an entry in R
that matches with this value. In this case, we get 100 tuples in
output.
2) All 100 values of B in S are different and these values are
present in R also. In this case also, we get 100 tuples.
7. The following functional dependencies are given:
AB → CD, AF → D, DE → F, C → G , F → E, G → A

Which one of the following options is FALSE?


(A) CF+ = {ACDEFG}
(B) BG+ = {ABCDG}
(C) AF+ = {ACDEFG}
(D) AB+ = {ABCDG}

Solution: (c)
Closure of AF or AF+ = {ADEF}, closure of AF doesn’t contain C and G.
8. A top-to-bottom relationship among the items in a database is
established by a __________ .

A) Hierarchical schema
B) Network schema
C) Relational Schema
D) All of the above
9. State true or false.
i) The select operator is not a unary operator.
ii) The project operator chooses a subset of attributes or columns of
a relation.

A) i-True, ii-False
B) i-True, ii-True
C) i-False, ii-True
D) i-False, ii-False
10. Which of the syntax is CORRECT for insert statement?
i) insert into <table_name> values <list of values>
ii) insert into <table_name> (column list) values <list of values>

A) i-only
B) ii-only
C) Both of them
D) None of them
11. ____________ is a special type of integrity constraint that
relates two relations & maintains consistency across the relations.

A) Entity Integrity Constraints


B) Referential Integrity Constraints
C) Domain Integrity Constraints
D) Domain Constraints
12. Drop Table cannot be used to drop a table referenced by a
_______ constraint.

A) Local Key
B) Primary Key
C) Composite Key
D) Foreign Key
13. ________ is used to determine whether a table contains
duplicate rows.

A) Unique predicate
B) Like Predicate
C) Null predicate
D) In predicate
14. The number of tuples in a relation is called its _______While the
number of attributes in a relation is called it’s _________ .

A) Degree, Cardinality
B) Cardinality, Degree
C) Rows, Columns
D) Columns, Rows
15. __________ is a combination of two of more attributes used as a
primary key.

A) Composite Key
B) Alternate Key
C) Candidate Key
D) Foreign Key
16. Which of the following query is CORRECT for using comparison
operators in SQL?

A) SELECT sname, coursename FROM studentinfo WHERE age>50 and


<80;
B) SELECT sname, coursename FROM studentinfo WHERE age>50 and
age <80;
C) SELECT sname, coursename FROM studentinfo WHERE age>50 and
WHERE age<80;
D) None of the above
17. Select a query that retrieves all of the unique coursenames from
the student table?

A) SELECT DISTINCT coursename FROM studentinfo;


B) SELECT UNIQUE coursename FROM studentinfo;
C) SELECT DISTINCT coursename FROM TABLE studentinfo;
D) SELECT INDIVIDUAL coursename FROM studentinfo;
18. Which query is used for sorting data that retrieves the all the
fields from empinfo table and listed them in the ascending order?

A) SELECT * FROM empinfo ORDER BY age;


B) SELECT * FROM empinfo ORDER age;
C) SELECT * FROM empinfo ORDER BY COLUMN age;
D) SELECT * FROM empinfo SORT BY age;
19. Which of the following is NOT an aggregate operator?

A. MAX
B. MIN
C. TOTAL
D. AVG
20. In SQL, which of the following is a data definition language
commands?

A. RENAME

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy