0% found this document useful (0 votes)
130 views

Dbms Placement Ques

The document describes a relational schema with three tables: Students, Courses, and Registration. It asks to summarize the English meaning of a query finding the distinct names of students who scored more than 90% in course 107. The query finds the names of all distinct students who scored over 90% in the course with number 107, as recorded in the Registration table.

Uploaded by

achaparala4499
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
130 views

Dbms Placement Ques

The document describes a relational schema with three tables: Students, Courses, and Registration. It asks to summarize the English meaning of a query finding the distinct names of students who scored more than 90% in course 107. The query finds the names of all distinct students who scored over 90% in the course with number 107, as recorded in the Registration table.

Uploaded by

achaparala4499
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 27

Consider the following relational schema.

I,
Students(rollno: integer, sname: string) II
Courses(courseno: integer, cname: string)
Registration(rollno: integer, courseno: integer, percent: real)
,
Which of the following queries are equivalent to this query in English? II
"Find the distinct names of all students who score I,
more than 90% in the course numbered 107"
I
V

Given the basic ER and relational models, which of the following is


INCORRECT?

A An attribute of an entity can have more than one value


B An attribute of an entity can be composite
In a row of a relational table, an attribute can have more

than one value


In a row of a relational table, an attribute can have exactly

one value or a NULL value


Consider the following ER
diagram. 

 
The minimum number of tables needed to represent M, N, P, R1, R2 is

A2
3
C4
D5

Consider the data given in above question. Which of the following is a


correct attribute set for one of the tables for the correct answer to the
above question?

A {M1, M2, M3, P1}


B {M1, P1, N1, N2}
C {M1, P1, N1}
D {M1, P1}

Information about a collection of students is given by the


relation studinfo(studId, name, sex). The relation enroll(studId,
courseId) gives which student has enrolled for (or taken) that course(s).
Assume that every course is taken by at least one male and at least one
female student. What does the following relational algebra expression
represent?

A Courses in which all the female students are enrolled.


Courses in which a proper subset of female students are
B enrolled.
C Courses in which only male students are enrolled.
D None of the above

Consider the relation employee(name, sex, supervisorName) with name


as the key. supervisorName gives the name of the supervisor of the
employee under consideration. What does the following Tuple Relational
Calculus query produce?

A Names of employees with a male supervisor.


Names of employees with no immediate male
B subordinates.
Names of employees with no immediate female
C subordinates.
D Names of employees with a female supervisor.

Consider a join (relation algebra) between relations r(R)and s(S) using the
nested loop method. There are 3 buffers each of size equal to disk block
size, out of which one buffer is reserved for intermediate results. Assuming
size(r(R)) < size(s(S)), the join will have fewer number of disk block
accesses if

A relation r(R) is in the outer loop.


B relation s(S) is in the outer loop.
join selection factor between r(R) and s(S) is more than
C 0.5.
D join selection factor between r(R) and s(S) is less than 0.5.

Consider the relational schema given below, where eId of the relation
dependent is a foreign key referring to empId of the relation employee.
Assume that every employee has at least one associated dependent in the
dependent relation. 
employee (empId, empName, empAge)
dependent(depId, eId, depName, depAge)
Consider the following relational algebra query:

 
The above query evaluates to the set of empIds of employees whose age
is greater than that of

A some dependent.
B all dependents.
C some of his/her dependents
D all of his/her dependents.

Let E1 and E2 be two entities in an E/R diagram with simple single-valued


attributes. R1 and R2 are two relationships between E1 and E2, where R1
is one-to-many and R2 is many-to-many. R1 and R2 do not have any
attributes of their own. What is the minimum number of tables required to
represent this situation in the relational model?

A2
B3
C4
D5
In a schema with attributes A, B, C, D and E following set of functional
dependencies are given
A → B A → C CD → E B → D E → A
Which of the following functional dependencies is NOT implied by the
above set?

A CD → AC
B BD → CD
C BC → CD
D AC → BC
A database of research articles in a journal uses the following schema.
(VOLUME, NUMBER, STARTPGE, ENDPAGE, TITLE, YEAR, PRICE)
The primary key is (VOLUME, NUMBER, STARTPAGE, ENDPAGE) and
the following functional dependencies exist in the schema. 
(VOLUME, NUMBER, STARTPAGE, ENDPAGE) -> TITLE
(VOLUME, NUMBER) -> YEAR
(VOLUME, NUMBER, STARTPAGE, ENDPAGE) -> PRICE
The database is redesigned to use the following schemas. 
(VOLUME, NUMBER, STARTPAGE, ENDPAGE, TITLE, PRICE)
(VOLUME, NUMBER, YEAR)
Which is the weakest normal form that the new database satisfies, but the
old one does not?

A 1NF
B 2NF
C 3NF
D BCNF
A Relation R with FD set {A->BC, B->A, A->C, A->D, D->A}. How many
candidate keys will be there in R?

A1
B2
C3
D4

What is the min and max number of tables required to convert an ER


diagram with 2 entities and 1 relationship between them with partial
participation constraints of both entities?

A Min 1 and max 2


B Min 1 and max 3
C Min 2 and max 3
D Min 2 and max 2
Consider the join of a relation R with a relation S. If K has m tuples and S
has n tuples, then the maximum and minimum sizes of the join
respectively are:

A m+n and 0
B mn and 0
C m+n and m-n
D mn and m+n

Given two union compatible relations R1(A,B) and R2(C,D). What is the
result of the operation R1⋈A=C∧ B=D R2    A. R1 ∪ R2 B. R1 Χ R2 C. R1 - R2 D. R1 ∩
R2

Aa
Bb
Cc
Dd

A library relational database system uses the following schema


USERS (User#, UserName, HomeTown)
BOOKS (Book#, BookTitle, AuthorName)
ISSUED (Book#, User#, Date)
Explain in one English sentence, what each of the following relational
algebra queries is designed to determine

Consider the following tables T1 and T2:


In table T1, P is the primary key, Q is the foreign key referencing R in table
T2 with on-delete cascade and on-update cascade. In table T2, R is the
primary key and S is the foreign key referencing P in the table T1 with on-
delete set NULL and on-update cascade. In order to delete record (3,8)
from table, numbers of additional record that need to be deleted from table
T1 is ______. Note: This question appeared as Numerical Answer Type.
0
1

C2
D3
Match the following with respect to
RDBMS

A (1)
(2)

C (3)
D (4)
Consider the following schema :
Sailors (sid, sname, rating, age)
Boats (bid, bname, colour)
Reserves (sid, bid, day)
Two boats can have the same name but the colour differentiates them.
The two relations
ρ (Tempsids, (Ⲡ sid, bid Reserves)/(Ⲡ bid ( σ bname ='Ganga' Boats))),
Ⲡ sname (Tempsids ⋈ Sailors)
If / is division operation, the above set of relations represents the query

A Names of sailors who have reserved all boats called Ganga


B Names of sailors who have not reserved any Gangaboat
C Names of sailors who have reserved at least one Gangaboat
D Names of sailors who have reserved at most one Ganga boat
Consider a relation R (A, B, C, D, E, F, G, H), where each attribute is
atomic, and following functional dependencies exist.
CH → G
A → BC
B → CFH
E → A
F → EG
The relation R is __________ .

A in 1NF but not in 2NF


B in 2NF but not in 3NF
C in 3NF but not in BCNF
D in BCNF
Integrity constraints ensure that changes made to the database by
authorized users do not result into loss of data consistency. Which of the
following statement(s) is (are) true w.r.t. the examples of integrity
constraints ? (A) An instructor Id. No. cannot be null, provided Intructor Id
No. being primary key. (B) No two citizens have same Adhar-Id. (C)
Budget of a company must be zero. 

A (A), (B) and (C) are true.


B (A) false, (B) and (C) are true. 
C (A) and (B) are true; (C) false. 
D (A), (B) and (C) are false
Let M and N be two entities in an E-R diagram with simple single value
attributes. R1 and R2 are two relationship between M and N, where as R1 is
one-to-many and R2 is many-to-many. The minimum number of tables
required to represent M, N, R1 and R2 in the relational model are _______. 

A4
B6
C7
D3
Which one is correct w.r.t. RDBMS ?

A primary key ⊆ super key ⊆ candidate key


B primary key ⊆ candidate key ⊆ super key
C super key ⊆ candidate key ⊆ primary key
D super key ⊆ primary key ⊆ candidate key

Let pk(R) denotes primary key of relation R. A many-to-one relationship


that exists between two relations R1 and R2 can be expressed as follows :

A pk(R ) → pk(R )
2 1

B pk(R ) → pk(R )
1 2

C pk(R ) → R  ∩ R
2 1 2

D pk(R ) → R  ∩ R
1 1 2

Consider the join of a relation R , with a relation S . If R has m number of


tuples and S has n number of tuples then the maximum and minimum
sizes of the join respectively are:

A m+n&0
B mn & 0
C m+n&|m-n|
D mn & m + n

Let R(a, b, c) and S(d, e, f) be two relations in which d is the foreign key of
S that refers to the primary key of R. Consider the following four
operations R and S. I. Insert into R II. Insert into S III. Delete from R IV.
Delete from S Which of the following can cause violation of the referential
integrity constraint above?

A Both I and IV
B Both II and III
C All of these
D None of these
Given the relations employee (name, salary, dept-no), and department
(dept-no, dept-name,address) Which of the following queries cannot be
expressed using the basic relational algebra operations (σ, π, 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

Relational database schema normalization is NOT for:

A reducing the number of joins required to satisfy a query.


B eliminating uncontrolled redundancy of data stored in the database.
eliminating number of anomalies that could otherwise occur with inserts and
C deletes.
D ensuring that functional dependencies are enforced.

Consider the following statements regarding relational database model: (a)


NULL values can be used to opt a tuple out of enforcement of a foreign
key. (b) Suppose that table T has only one candidate key. If Q is in 3NF,
then it is also in BCNF. (c) The difference between the project operator (Π)
in relational algebra and the SELECT keyword in SQL is that if the
resulting table/set has more than one occurrences of the same tuple, then
Π will return only one of them, while SQL SELECT will return all. One can
determine that:

A (a) and (b) are true.


B (a) and (c) are true.
C (b) and (c) are true.
D (a), (b) and (c) are true.
Which of the following statement(s) is/are FALSE in the context of
Relational DBMS ? I. Views in a database system are important because
they help with access control by allowing users to see only a particular
subset of the data in the database. II. E-R diagrams are useful to logically
model concepts. III. An update anomaly is when it is not possible to store
information unless some other, unrelated information is stored as well. IV.
SQL is a procedural language.

A I and IV only
B III and IV only
C I, II and III only
D II, III and IV only
In a relational database model, NULL values can be used for all but which
one of the following ?
To allow duplicate tuples in the table by filling the primary key column(s) with
A NULL.
To avoid confusion with actual legitimate data values like 0 (zero) for integer
B columns and ’’ (the empty string) for string columns.
To leave columns in a tuple marked as ’’unknown’’ when the actual value is
C unknown.
To fill a column in a tuple when that column does not really ”exist” for that
D particular tuple.

Consider the following two commands C1 and C2 on the relation R from


an SQL database: C1 : drop table R; C2 : delete from R; Which of the
following statements is TRUE ? I. Both C1 and C2 delete the schema for
R. II. C2 retains relation R, but deletes all tuples in R. III. C1 deletes not
only all tuples of R, but also the schema for R.
A I only
B I and II only
C II and III only
D I, II and III
Consider the following database table having A, B, C and D as its four
attributes and four possible candidate keys (I, II, III and IV) for this

table :   I : {B} II : {B, C} III : {A, D} IV : {C,


D} If different symbols stand for different values in the table (e.g., d 1 is
definitely not equal to d2), then which of the above could not be the
candidate key for the database table ?

A I and III only


B III and IV only
C II only
D I only
A relation R = {A, B, C, D, E, F,G} is given with following set of functional
dependencies: F = {AD → E, BE → F, B → C, AF → G} Which of the
following is a candidate key ?

A A 
B AB
C ABC
D ABD

Drop Table cannot be used to drop a Table referenced by __________


constraint. (a)Primary key (b)Sub key (c)Super key (d)Foreign key

A (a)
B (a), (b) and (c)
C (d)
D (a) and (d)

Which of the following statements is FALSE about weak entity set? 


Weak entities can be deleted automatically when their strong entity is
A deleted. 
Weak entity set avoids the data duplication and consequent possible
B inconsistencies caused by duplicating the key of the strong entity. 
A weak entity set has no primary keys unless attributes of the strong entity
C set on which it depends are included
Tuples in a weak entity set are not partitioned according to their relationship
D with tuples in a strong entity set.
The join operation can be defined as
a cartesian product of two relations followed by a selection

B a cartesian product of two relations


C a union of two relations followed by cartesian product of the two relations
D a union of two relations

In RDBMS, which type of Join returns all rows that satisfy the join
condition?
Inner Join

B Outer Join
C Semi Join
D Anti Join

Which of the following statements are TRUE about an SQL query? P : An


SQL query can contain a HAVING clause even if it does not have a
GROUP BY clause Q : An SQL query can contain a HAVING clause only if
it has a GROUP BY clause R : All attributes used in the GROUP BY
clause must appear in the SELECT clause S : Not all attributes used in the
GROUP BY clause need to appear in the SELECT clause 

A P and R
B P and S
C Q and R
D Q and S
Which of the following statements are TRUE about an SQL query? P : An
SQL query can contain a HAVING clause even if it does not have a
GROUP BY clause Q : An SQL query can contain a HAVING clause only if
it has a GROUP BY clause R : All attributes used in the GROUP BY
clause must appear in the SELECT clause S : Not all attributes used in the
GROUP BY clause need to appear in the SELECT clause 

A P and R
P and S

C Q and R
Q and S

Database table by name Loan_Records is given below.


Borrower Bank_Manager Loan_Amount
Ramesh Sunderajan 10000.00
Suresh Ramgopal 5000.00
Mahesh Sunderajan 7000.00
What is the output of the following SQL query?
SELECT Count(*)
FROM ( (SELECT Borrower, Bank_Manager
FROM Loan_Records) AS S
NATURAL JOIN (SELECT Bank_Manager,
Loan_Amount
FROM Loan_Records) AS T );

A3
B9
C5
D6
Consider the table employee(empId, name, department, salary) and the
two queries Q1 ,Q2 below. Assuming that department 5 has more than
one employee, and we want to find the employees who get higher salary
than anyone in the department 5, which one of the statements is TRUE for
any arbitrary employee table?
Q1 : Select e.empId
From employee e
Where not exists
(Select * From employee s where s.department = “5” and
s.salary >=e.salary)
Q2 : Select e.empId
From employee e
Where e.salary > Any
(Select distinct salary From employee s Where s.department
= “5”)

A Q1 is the correct query


B Q2 is the correct query
C Both Q1 and Q2 produce the same answer.
D Neither Q1 nor Q2 is the correct query
Given the following schema: 
employees(emp-id, first-name, last-name, hire-date, dept-
id, salary)
departments(dept-id, dept-name, manager-id, location-id)
You want to display the last names and hire dates of all latest hires in their
respective departments in the location ID 1700. You issue the following
query:
SQL> SELECT last-name, hire-date
FROM employees
WHERE (dept-id, hire-date) IN
(SELECT dept-id, MAX(hire-date)
FROM employees JOIN departments USING(dept-id)
WHERE location-id = 1700
GROUP BY dept-id);
What is the outcome?

A It executes but does not give the correct result.


B It executes and gives the correct result.
C It generates an error because of pairwise comparison.
It generates an error because the GROUP BY clause cannot be used with
D table joins in a subquery

Consider the following relational schema:


employee(empId, empName, empDept)
customer(custId, custName, salesRepId, rating)
salesRepId is a foreign key referring to empId of the employee relation.
Assume that each employee makes a sale to at least one customer. What
does the following query return?
SELECT empName
FROM employee E
WHERE NOT EXISTS (SELECT custId
FROM customer C
WHERE C.salesRepId = E.empId
AND C.rating <> `GOOD`);
Names of all the employees with at least one of their customers having a
A ‘GOOD’ rating.
Names of all the employees with at most one of their customers having a
B ‘GOOD’ rating.
Names of all the employees with none of their customers having a ‘GOOD’
C rating.
D Names of all the employees with all their customers having a ‘GOOD’ rating.
The statement that is executed automatically by the system as a side
effect of the modification of the database is

A backup
B assertion
C recovery
trigger

The relation book (title, price) contains the titles and prices of different
books. Assuming that no two books have the same price, what does the
following SQL query list?
select title
from book as B
where (select count(*)
from book as T
where T.price > B.price) < 5

A Titles of the four most expensive books


B Title of the fifth most inexpensive book
C Title of the fifth most expensive bookTitles of the five most expensive books
D Titles of the five most expensive books
The employee information in a company is stored in the relation
Employee (name, sex, salary, deptName)
Consider the following SQL query
select deptName
from Employee
where sex = 'M'
group by deptName
having avg (salary) > (select avg (salary) from
Employee)
It returns the names of the department in which

A the average salary is more than the average salary in the company
the average salary of male employees is more than the average salary of all
B male employees in the company
the average salary of male employees is more than the average salary of
C employees in the same department
the average salary of male employees is more than the average salary in the
D company

Consider the set of relations shown below and the SQL query that follows.
Students: (Roll_number, Name, Date_of_birth)
Courses: (Course number, Course_name, Instructor)
Grades: (Roll_number, Course_number, Grade)
select distinct Name
from Students, Courses, Grades
where Students. Roll_number = Grades.Roll_number
and Courses.Instructor = Korth
and Courses.Course_number = Grades.Course_number
and Grades.grade = A
Which of the following sets is computed by the above query?

A Names of students who have got an A grade in all courses taught by Korth
B Names of students who have got an A grade in all courses
Names of students who have got an A grade in at least one of the courses
C taught by Korth
D None of the above
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 
Consider the following relation 
Cinema (theater, address, capacity)
Which of the following options will be needed at the end of the SQL query 
SELECT P1. address
FROM Cinema P1
Such that it always finds the addresses of theaters with maximum
capacity?

A WHERE P1. Capacity> = All (select P2. Capacity from Cinema P2)
B WHERE P1. Capacity> = Any (select P2. Capacity from Cinema P2)
C WHERE P1. Capacity > All (select max(P2. Capacity) from Cinema P2)
D WHERE P1. Capacity > Any (select max (P2. Capacity) from Cinema P2)
Consider the following tables :

What will be the output of following SQL query ?


SELECT * FROM EMPLOYEE E
WHERE 2 = (SELECT COUNT(DISTINCT E1.SALARY)
FROM EMPLOYEE E1
WHERE E1.SALARY>E.SALARY)

A Second highest salary


B Two distinct salary of employees
C Third highest salary
D Employee with second highest salary
Given two relations R1(A, B) and R2(C, D), the result of following query
Select distinct A, B
from R1, R2
is guaranteed to be same as R1 provided one of the following condition is
satisfied.

A R1 has no duplicates and R2 is empty.


B R1 has no duplicates and R2 is non - empty.
C Both R1 and R2 have no duplicates.
D R2 has no duplicates and R1 is non - empty.
The relation book (title,price) contains the titles and prices of different
books. Assuming that no two books have the same price, what does the
following SQL query list? select title from book as B where (select count(*)
from book as T where T.price>B.price)<5
Titles of the four most expensive books

B Title of the fifth most inexpensive book


C Title of the fifth most expensive book
Titles of the five most expensive books

Consider the following transactions with data items P and Q


initialized to zero:
T1: read (P) ;
read (Q) ;
if P = 0 then Q : = Q + 1 ;
write (Q) ;
T2: read (Q) ;
read (P) ;
if Q = 0 then P : = P + 1 ;
write (P) ;
Any non-serial interleaving of T1 and T2 for concurrent execution
leads to

A A serializable schedule
B A schedule that is not conflict serializable
C A conflict serializable schedule
D A schedule for which a precedence graph cannot be drawn
Consider the following schedule for transactions T1, T2 and

T3:   W
hich one of the schedules below is the correct serialization of the above?

A T1->>T3->>T2
B T2->>T1->>T3
C T2->>T3->>T1
D T3->>T1->>T2
Consider the following four schedules due to three transactions (indicated
by the subscript) using read and write on a data item x, denoted by r(x)
and w(x) respectively. Which one of them is conflict serializable.
AA
BB
CC
DD
Consider the following log sequence of two transactions on a bank
account, with initial balance 12000, that transfer 2000 to a mortgage
payment and then apply a 5% interest. 
1. T1 start
2. T1 B old=12000 new=10000
3. T1 M old=0 new=2000
4. T1 commit
5. T2 start
6. T2 B old=10000 new=10500
7. T2 commit
Suppose the database system cra shes just before log record 7 is written.
When the system is restarted, which one statement is true of the recovery
procedure?

A We must redo log record 6 to set B to 10500


We must undo log record 6 to set B to 10000 and then redo log records 2 and
B 3.
We need not redo log records 2 and 3 because transaction T1 has
C committed.
We can apply redo and undo operations in arbitrary order because they are
D idempotent
Which of the following scenarios may lead to an irrecoverable error in a
database system ?

A A transaction writes a data item after it is read by an uncommitted transaction


B A transaction reads a data item after it is read by an uncommitted transaction
C A transaction reads a data item after it is written by a committed transaction
A transaction reads a data item after it is written by an uncommitted
D transaction

Consider three data items D1, D2 and D3 and the following execution
schedule of transactions T1, T2 and T3. In the diagram, R(D) and W(D)
denote the actions reading and writing the data item D
respectively. 

Which of the following statements is correct?


A The schedule is serializable as T2; T3; T1
The schedule is serializable as T2; T1; T3

C The schedule is serializable as T3; T2; T1


The schedule is not serializable

Consider the following transaction involving two bank accounts x and y. 
read(x); x := x – 50; write(x); read(y); y := y + 50;
write(y)
The constraint that the sum of the accounts x and y should remain
constant is that of

A Atomicity 
B Consistency
C Isolation
D Durability
Consider the following database schedule with two transactions, T1 and
T2.
S = r2(X); r1(X); r2(Y); w1(X); r1(Y); w2(X); a1; a2;
where ri(Z) denotes a read operation by transaction Ti on a variable Z,
wi(Z) denotes a write operation by Ti on a variable Z and ai denotes an
abort by transaction Ti . Which one of the following statements about the
above schedule is TRUE?

A S is non-recoverable
B S is recoverable, but has a cascading abort
C S does not have a cascading abort
D S is strict
Consider the following three schedules of transactions T1, T2 and T3.
[Notation: In the following NYO represents the action Y (R for read, W for
write) performed by transaction N on object O.]
(S1) 2RA 2WA 3RC 2WB 3WA 3WC 1RA 1RB 1WA 1WB
(S2) 3RC 2RA 2WA 2WB 3WA 1RA 1RB 1WA 1WB 3WC
(S3) 2RA 3RC 3WA 2WA 2WB 3WC 1RA 1RB 1WA 1WB
Which of the following statements is TRUE?
A S1, S2 and S3 are all conflict equivalent to each other
B No two of S1, S2 and S3 are conflict equivalent to each other
C S2 is conflict equivalent to S3, but not to S1
D S1 is conflict equivalent to S2, but not to S3

You might also like