Professional Documents
Culture Documents
Dbms MCQ PDF
Dbms MCQ PDF
Q.12 An entity set that does not have sufficient attributes to form a primary key is a
(A) strong entity set. (B) weak entity set.
(C) simple entity set. (D) primary entity set.
Ans: B
Q.20 The database environment has all of the following components except:
(A) users. (B) separate files.
(C) database. (D) database administrator.
Ans: A
Q.21 The language which has recently become the defacto standard for interfacing
application
programs with relational database system is
(A) Oracle. (B) SQL.
(C) DBase. (D) 4GL.
Ans: B
Q.22 The way a particular application views the data from the database that the
application
uses is a
(A) module. (B) relational model.
(C) schema. (D) sub schema.
Ans: D
Q.40 The statement in SQL which allows to change the definition of a table is
(A) Alter. (B) Update.
(C) Create. (D) select.
Ans: A
Q.41 E-R model uses this symbol to represent weak entity set ?
(A) Dotted rectangle.
(B) Diamond
(C) Doubly outlined rectangle
(D) None of these
Ans: C
Q.46 The file organization that provides very fast access to any arbitrary record of a file
is
(A) Ordered file (B) Unordered file
(C) Hashed file (D) B-tree
Ans: C
Q.49 In a relation
(A) Ordering of rows is immaterial
(B) No two rows are identical
(C) (A) and (B) both are true
(D) None of these.
Ans: C
Q.50 Which of the following is correct:
(A) a SQL query automatically eliminates duplicates.
(B) SQL permits attribute names to be repeated in the same relation.
(C) a SQL query will not work if there are no indexes on the relations
(D) None of these
Ans: D
Q.54 Which of the following operation is used if we are interested in only certain
columns of a
table?
(A) PROJECTION (B) SELECTION
(C) UNION (D) JOIN
Ans: A
Q.57 Which of the following operations need the participating relations to be union
compatible?
(A) UNION (B) INTERSECTION
(C) DIFFERENCE (D) All of the above
Ans:
Q.58 The full form of DDL is
(A Dynamic Data Language (B) Detailed Data Language
(C) Data Definition Language (D) Data Derivation Language
Ans: C
Q.63 Which are the two ways in which entities can participate in a relationship?
(A) Passive and active (B) Total and partial
(C) Simple and Complex (D) All of the above
Ans: B
Q.64 The result of the UNION operation between R1 and R2 is a relation that includes
(A) all the tuples of R1
(B) all the tuples of R2
(C) all the tuples of R1 and R2
(D) all the tuples of R1 and R2 which have common columns
Ans: D
Q.67 Which of the operations constitute a basic set of operations for manipulating
relational
data?
(A) Predicate calculus (B) Relational calculus
(C) Relational algebra (D) None of the above
Ans:C
Q.69 Which of the following database object does not physically exist?
(A) base table (B) index
(C) view (D) none of the above
Ans: C
Q.70 NULL is
(A) the same as 0 for integer
(B) the same as blank for character
(C) the same as 0 for integer and blank for character
(D) not a value
Ans: D
Q.73 A file manipulation command that extracts some of the records from a file is called
(A) SELECT (B) PROJECT
(C) JOIN (D) PRODUCT
Ans: A
Q.75 Using Relational Algebra the query that finds customers, who have a balance of
over
1000 is
(A) ΠCustomer_name(σ balance >1000(Deposit))
(B) σ Customer_name(Πbalance >1000(Deposit))
(C) ΠCustomer_name(σ balance >1000(Borrow))
(D) σ Customer_name(Πbalance >1000(Borrow))
Ans: A
Q.80 Consider the join of a relation R with relation S. If R has m tuples and S has n
tuples,
then the maximum size of join is:
(A) mn (B) m+n
(C) (m+n)/2 (D) 2(m+n)
Ans: A
Q.90 _____________ function divides one numeric expression by another and returns the
remainder.
(A) POWER (B) MOD
(C) ROUND (D) REMAINDER
Ans: B
Q.91 A data manipulation command the combines the records from one or more tables is
called
(A) SELECT (B) PROJECT
(C) JOIN (D) PRODUCT
Ans: C
Q.93 _________ is a virtual table that draws its data from the result of an SQL
SELECT statement.
(A) View (B) Synonym
(C) Sequence (D) Transaction
Ans: A
Q.94 The method of access which uses key transformation is known as
(A) Direct (B) Hash
(C) Random (D) Sequential
Ans: B
Q.97 Which two files are used during operation of the DBMS
(A) Query languages and utilities
(B) DML and query language
(C) Data dictionary and transaction log
(D) Data dictionary and query language
Ans: C
1)
You want to retrieve all employees, whether or not they have matching departments
in the departments table. Which query would you use?
A) SELECT last_name, department_name
FROM employees e LEFT OUTER
JOIN departments d ON (e.department_id = d.department_id);
B) SELECT last_name, department_name
FROM employees e RIGHT OUTER
JOIN departments d ON (e.department_id = d.department_id);
C) SELECT last_name, department_name
FROM employees e FULL OUTER
JOIN departments d ON (e.department_id = d.department_id);
2)
Which two statements about views are true? (Choose two.)
3)
Evaluate this SQL statement:
5)
Evaluate this SQL statement:
SELECT e.EMPLOYEE_ID,e.LAST_NAME,e.DEPARTMENT_ID,
d.DEPARTMENT_NAME
FROM EMP e, DEPARTMENT d WHERE e.DEPARTMENT_ID =
d.DEPARTMENT_ID;
6)
What is true about joining tables through an equijoin?
7)
Which three are true regarding the use of outer joins? (Choose three.)
8)
In which three cases would you use the USING clause? (Choose three.)
9)
Examine the structure of the EMPLOYEES and DEPARTMENTS tables:
EMPLOYEES
EMPLOYEE_ID NUMBER
DEPARTMENT_ID NUMBER
MANAGER_ID NUMBER
LAST_NAME VARCHAR2(25)
DEPARTMENTS
DEPARTMENT_ID NUMBER
MANAGER_ID NUMBER
DEPARTMENT_NAME VARCHAR2(35)
LOCATION_ID NUMBER
You want to create a report displaying employee last names, department names,
and locations. Which query should you use to create an equi-join?
11)
A SELECT statement can be used to perform these three functions:
Question 99
Suppose you are given a relation R = (A,B,C,D,E) with the following functional
dependencies: {CE -> D,D -> B,C -> A}.
a. Find all candidate keys.
b. Identify the best normal form that R satisfies (1NF, 2NF, 3NF, or BCNF).
c. If the relation is not in BCNF, decompose it until it becomes BCNF. At each step,
identify a new relation, decompose and re-compute the keys and the normal forms they
satisfy.
Answer.
a. The only key is {C,E}
b. The relation is in 1NF
c. Decompose into R1=(A,C) and R2=(B,C,D,E). R1 is in BCNF, R2 is in 2NF.
Decompose R2 into, R21=(C,D,E) and R22=(B,D). Both relations are in BCNF.
Question 100
Suppose you are given a relation R=(A,B,C,D,E) with the following functional
dependencies:
{BC ->ADE,D -> B}.
a. Find all candidate keys.
b. Identify the best normal form that R satisfies (1NF, 2NF, 3NF, or BCNF).
c. If the relation is not in BCNF, decompose it until it becomes BCNF. At each step,
identify a new relation, decompose and re-compute the keys and the normal forms they
satisfy.
Answer.
a. The keys are {B,C} and {C,D}
b. The relation is in 3NF
c. It cannot be put into BCNF, even if I remove D and put into a relation of the form
(B,C,D) (I need C for the functional dependency), the resulting relation would not be in
BCNF.
Question 101
You are given the following set of functional dependencies for a relation
R(A,B,C,D,E,F),
F = {AB -> C,DC ->AE,E -> F}.
a. What are the keys of this relation?
b. Is this relation in BCNF? If not, explain why by showing one violation.
c. Is the decomposition (A,B,C,D) (B,C,D,E,F) a dependency preserving decomposition?
If not,explain briefly.
Answer.
a. What are the keys of this relation?
{A,B,D} and {B,C,D}.
b. Is this relation in BCNF? If not, explain why by showing one violation.
No, all functional dependencies are actually violating this. No dependency contains a
superkey on its left side.
c. Is the decomposition (A,B,C,D) (B,C,D,E,F) a dependency preserving decomposition?
If not, explain briefly.
Yes, AB -> C and DC -> A are preserved in the first relation. DC -> E and E ->F are
preserved in the second relation.
Question 102
You are given the below functional dependencies for relation R(A,B,C,D,E), F =
{AB -> C,AB -> D,D ->A,BC -> D,BC -> E}.
a. Is this relation is in BCNF? If not, show all dependencies that violate it.
b. Is this relation in 3NF? If not, show all dependencies that violate it.
c. Is the following dependency implied by the above set of dependencies? If so, show
how using the Amstrong’s Axioms :ABC -> AE
Answer.
Keys for the relation: {A,B}, {B,D}, {B,C}.
a. Not in BCNF since D -> A does have a superkey on the left hand side.
b. In 3NF since in D -> A, A is part of a key.
c. BC -> E (given)
ABC -> AE by the augmentation rule.
Question 103
You are given the below set of functional dependencies for a relation R(A,B,C,D,E,F,G),
F = {AD -> BF,CD -> EGC,BD -> F,E -> D, F -> C,D -> F}.
a. Find the minimal cover for the above set of functional dependencies using the
algorithm described in class. Give sufficient detail to show your reasoning, but be
succinct. You do not have to list all the cases you test/consider for the algorithm. Show
all steps where you make changes to the above set in detail.
b. Using the functional dependencies that you computed in step a, find the keys for this
relation.
Is it in BCNF? Explain your reasoning.
Answers.
a.
Step 1.
{AD -> B,AD -> F,CD -> E,CD -> G,CD -> C,BD -> F,E -> D, F -> C,D -> F}
Step 2. removeCD-> C, AD -> F, and BD -> F.
{AD -> B,CD -> E,CD -> G, F -> C,D -> F,E -> D}
Step 3. remove D from CD ->E and CD -> G
{AD -> B,D -> E,D -> G, F -> C,D -> F,E -> D}
Finally recombine
{AD ->B,D -> EGF, F -> C,E -> D}.
b. Keys: {A,D}, {A,E}. Not in BCNF since the last three functional dependencies do not
have a superkey on the left hand side.
Question 104
You are given the following set F of functional dependencies for a relation
R(A,B,C,D,E,F):
F = {ABC -> D,ABD -> E,CD -> F,CDF -> B,BF -> D}.
a. Find all keys of R based on these functional dependencies.
b. Is this relation in Boyce-Codd Normal Form? Is it 3NF? Explain your answers.
c. Can the set F be simplified (by removing functional dependencies or by removing
attributes from the left hand side of functional dependencies) without changing the
closure of F (i.e. F+)?
Hint. Consider the steps of the minimal cover algorithm. Do any of them apply to this
functional dependency?
Answer.
a. Keys: {A,B,C} and {A,C,D}
b. It is not in BCNF. Counterexample ABD -> E and ABD is not a superkey.
It is not in 3NF. Counterexample ABD -> E, and ABD is not a superkey and E is not
prime attribute (part of a key).
c. Let F’ be obtained by replacing CDF -> B with CD -> B.
According to F and F’, CD+ = {C,D,B, F}. Hence, we can remove F from this functional
dependency without changing the meaning of the system.
Question 105
Answer.
a. {V,W}, {X,W}
b. X+ = {X, V, Y,Z}
c. Yes it is lossless. To be lossless the attributes in common between the two relations
must functionally determine all the attributes in one of the two relations. The only
attribute in common is X and it functionally determines all the attributes in R2.
Question 106
Given relation R(W, X, Y, Z) and set of functional dependencies F = {X ->
W,WZ !->XY, Y -> WXZ}. Compute the minimal cover for F.
Answer.
Step 1: X -> W,WZ -> X,WZ -> Y, Y -> W, Y -> X, Y -> Z
Step 2: Don’t need WZ -> X, since WZ -> Y and Y ->X
Don’t need Y -> W, since Y -> X and X -> W
This leaves {X -> WWZ -> Y, Y -> X, Y -> Z}
Step 3: Only need to consider WZ -> Y . Can’t eliminate W or Z. So nothing is
eliminated.
Step 4: {X -> WWZ -> Y, Y -> XZ} is the minimal cover
Question 107
Consider a relation named EMP DEPT with attributes: ENAME, SSN, BDATE,
ADDRESS, DNUMBER, DNAME, and DMGRSSN. Consider also the set G of
functional dependencies for EMP DEPT:
G = {SSN -> ENAME BDATE ADDRESS DNUMBER,DNUMBER -
>DNAME,DMGRSSM}.
a) Calculate the closures SSN+ and DNAME+ with respect to G.
b) Is the set of functional dependences G minimal? If not, find a minimal set of functional
dependencies that is equivalent to G.
c) List an update anomaly that can occur for relation EMP DEPT.
d) List an insertion anomaly that can occur for relation EMP DEPT.
e) List a deletion anomaly that can occur for relation EMP DEPT.
Answer.
a) SSN+ = {SSN,ENAME,BDATE,ADDRESS,DNUMBER,DNAME,DMGRSSN}
DNAME+ = {DNAME}
b) It is minimal.
c) Since every member of a department has a reference to the manager of that department
(i.e.,Dmgrssn), when the department manager changes this reference must be changed
multiple places.This leads to the possibility of an inconsistency in the database if they are
not all changed.
d) You cannot enter data about a department until you have employees for the
department.
e) If you delete the last employee for a department, you lose all information about the
department.