DBMSMCQFINAL
DBMSMCQFINAL
a) Collection of values
b) Single value
c) Aggregate value
d) Both Collection of values & Single value
Answer: a
Answer: b
3. SELECT COUNT (____ ID) FROM teaches WHERE semester = ’Spring’ AND YEAR = 2010;
If we do want to eliminate duplicates, we use the keyword ______ in the aggregate expression.
a) Distinct
b) Count
c) Avg
d) Primary key
Answer: a
4. All aggregate functions except _____ ignore null values in their input collection.
a) Count (attribute)
b) Count(*)
c) Avg
d) Sum
Answer: b
Answer: a
6. The ____ connective tests for set membership, where the set is a collection of values produced by
a select clause. The ____ connective tests for the absence of set membership.
a) Or, in
b) Not in, in
c) In, not in
d) In, or
Answer: c
7. Which of the following should be used to find all the courses taught in the Fall 2009 semester but
not in the Spring 2010 semester.
a) SELECT DISTINCT course id FROM SECTION WHERE semester = ’Fall’ AND YEAR= 2009 AND course
id NOT IN (SELECT course id FROM SECTION WHERE semester = ’Spring’ AND YEAR= 2010);
b) SELECT DISTINCT course_id FROM instructor WHERE name NOT IN (’Fall’, ’Spring’);
c) (SELECT course idFROM SECTIONWHERE semester = ’Spring’ AND YEAR= 2010)
d) SELECT COUNT (DISTINCT ID) FROM takesWHERE (course id, sec id, semester, YEAR) IN (SELECT
course id, sec id, semester, YEARFROM teachesWHERE teaches.ID= 10101);
Answer: a
Answer: d
Answer: b
10. We can test for the nonexistence of tuples in a subquery by using the _____ construct.
a) Not exist
b) Not exists
c) Exists
d) Exist
Answer: b
A. SELECT dept_id, MIN (salary), MAX (salary) FROM employees WHERE MIN(salary) <
5000 AND MAX (salary) > 15000;
B. SELECT dept_id, MIN (salary), MAX (salary) FROM employees WHERE MIN (salary) <
5000 AND MAX (salary) 15000 GROUP BY dept_id;
C. SELECT dept_id, MIN(salary), MAX(salary) FROM employees HAVING MIN (salary) <
5000 AND MAX (salary)
D. SELECT dept_id, MIN (salary), MAX (salary) FROM employees GROUP BY dept_id
HAVING MIN(salary) < 5000 AND MAX (salary) > 15000
E. SELECT dept_id, MIN (salary), MAX (salary) FROM employees GROUP BY dept_id,
salary HAVING MIN (salary) < 5000 AND MAX (salary) > 15000;
ANS: D
ANS: A
3. You would like to display the system date in the format "Monday, 01 June, 2001". Which
SELECT statement should you use?
Ans: C
4. What is true about joining tables through an Equijoin?
A. You can join a maximum of two tables through an Equijoin.
B. You can join a maximum of two columns through an Equijoin.
C. You specify an Equijoin condition in the SELECT or FROM clauses of a SELECT statement.
D. To join two tables through an Equijoin, the columns in the join condition must be primary key
and foreign key columns.
E. You can join n tables (all having single column primary keys) in a SQL statement by
specifying a minimum of n-1 join conditions.
Ans. E
a. A,B,C
b. B,C,D
c. D,E,F
d. A,E,F
Ans: d
Ans A
7. Evaluate the SQL statement:
TRUNCATE TABLE DEPT;
Which three are true about the SQL statement?
Answer: b
A. Multiple columns or expressions can be compared between the main query and sub
query.
B. Main query and sub query can get data from different tables
C. Sub queries can contain GROUP BY and ORDER BY clauses
D. Main query and sub query must get data from the same tables
E. Sub queries can contain ORDER BY but not the GROUP BY clause
F. Only one column or expression can be compared between the main query and
subquery
a. A,B,C
b. B,C,D
c. C,D,E
d. A,D,E
Answer: B
9. View the Exhibit and examine the structure of the PRODUCTS, SALES, and
SALE_SUMMARY tables.
SALE_VW is a view created using the following command:
SQL>CREATE VIEW sale_vw AS SELECT prod_id, SUM(quantity_sold) QTY_SOLD FROM sales
GROUP BY prod_id;
You issue the following command to add a row to the SALE_SUMMARY table:
SQL>INSERT INTO sale_summary (SELECT prod_id, prod_name, qty_sold FROM sale_vw JOIN
products USING (prod_id) WHERE prod_id = 16);
Answer: D
10. Which statements are true regarding the FOR UPDATE clause in a SELECT statement?
a. It locks only the columns specified in the SELECT list.
b. It locks the rows that satisfy the condition in the SELECT statement.
c. It can be used only in SELECT statements that are based on a single table.
d. It can be used in SELECT statements that are based on a single or multiple tables.
e. After it is enforced by a SELECT statement, no other query can access the same rows until a
COMMIT or ROLLBACK is issued.
A. a,b,c
B. b,d,e
C. b,c
D. b,d
E. a,b,c,d,e
Answer: B,D
11. View the Exhibits and examine the structures of the COSTS and PROMOTIONS tables.
Evaluate the following SQL statement:
SQL> SELECT prod_id FROM costs WHERE promo_id IN (SELECT promo_id FROM promotions
WHERE promo_cost < ALL (SELECT MAX(promo_cost) FROM promotions GROUP BY
(promo_end_datepromo_begin_date)));
What would be the outcome of the above SQL statement?
Answer: D
Which statement is true regarding the above query if one of the values generated by the subquery is
NULL?
a. It produces an error.
b. It executes but returns no rows.
c. It generates output for NULL as well as the other values produced by the subquery.
d. It ignores the NULL value and generates output for the other values produced by the
subquery.
Answer: C
13. Which of the following is true about the PL/SQL data structure VARRAY?
A - It also has a maximum size that cannot be changed.
B - A VARRAY type is created with the CREATE VARRAY statement, at the schema level.
C - Maximum size of a VARRAY can be changed using the ALTER TYPE statement.
D - Maximum size of a VARRAY can be changed using the ALTER VARRAY statement.
Ans: C
Ans: A
15. What is the value of customer_id within the nested block in the example below?
/* Start main block */
DECLARE
customer_id NUMBER(9) := 678;
credit_limit NUMBER(10,2) := 10000;
BEGIN
/* Start nested block */
DECLARE
customer_id VARCHAR2(9) := 'AP56';
current_balance NUMBER(10,2) := 467.87;
BEGIN
-- what is the value of customer_id at this point?
NULL;
END;
END;
Please select the best answer.
A. 678
B. 10000
C. 'AP56'
D. 467.87
Ans: B.
DBMS MCQ
1.You can add a row using SQL in a database with which of the following?
A. ADD B. CREATE
C. INSERT D.MAKE
Answer-c
2.Which of the following is the correct order of keywords for SQL SELECT statements?
A.SELECT,FROM,WHERE B.FROM,WHERE,SELECT
C.WHERE,FROM,SELECT D.SELECT,WHERE,FROM
Answer-A
Answer-D
Answer-A
Answer-D
8.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.
Answer-B
Answer-A
Answer-D
6. Which of the following keyword is used with Data Control Language (DCL)
statements?
A. SELECT
B. INSERT
C. DELETE
D. GRANT
Answer-D
7. A type of query that is placed within a WHERE or HAVING clause of another query
is called
A. Master query
B. Sub query
C. Super query
D. Multi-query
Answer-B
B. PROJECT
C. JOIN
D. PRODUCT
Answer-C
B. INTERSECTION
C. DIFFERENCE
D. ALL OF THESE
Answer-D
Answer-B
B. Distinct values
C. Group By
D. Columns
Answer-A
6. The virtual table that its created by data from the result of an SQL 'Select'
statement is called _________
A. View
B. Synonym
C. Sequence
D. Transaction
Answer-A
a) Equi Join
b) In Join
c) Out Join
d) All of the above
Answer-A
Answer-C
9-What is the purpose of index in SQL server?
Answer-B
1. Consider the above tables A, B and C. How many tuples does the result of the following
SQL query contains?
Table A
Id Name Age
----------------
12 Arun 60
15 Shreya 24
99 Rohit 11
Table B
Id Name Age
----------------
15 Shreya 24
25 Hari 40
98 Rohit 20
99 Rohit 11
Table C
Id Phone Area
-----------------
10 2200 02
99 2100 01
SELECT A.id
FROM A
WHERE A.age > ALL (SELECT B.age
FROM B
WHERE B. name = "arun")
a. 4 b. 3 c. 0 d. 1
Answer-B
Explanation. The meaning of “ALL” is the A.Age should be greater than all the values
returned by the subquery. There is no entry with name “arun” in table B. So the subquery will
return NULL. If a subquery returns NULL, then the condition becomes true for all rows of A
(See this for details). So all rows of table A are selected.
Explanation: Following will be the result of natural join of above two tables. The key thing
to note is that the natural join happens on column name with same name which is
Bank_Manager in the above example. “Sunderajan” appears two times in Bank_Manager
column, so their will be four entries with Bank_Manager as “Sunderajan”.
Borrower Bank_Manager Load_Amount
------------------------------------
Ramesh Sunderajan 10000.00
Ramesh Sunderajan 7000.00
Suresh Ramgopal 5000.00
Mahesh Sunderajan 10000.00
Mahesh Sunderajan 7000.00
3. 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
Answer-A
Explanation: 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 attribute 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.
Table : Reservation
pid class tid
---------------
0 AC 8200
1 AC 8201
2 SC 8201
5 AC 8203
1 SC 8204
3 AC 8202
What pids are returned by the following SQL query for the above instance of the
tables?
SELECT pid FROM Reservation WHERE class ‘AC’ AND EXISTS (SELECT * FROM
Passenger WHERE age > 65 AND Passenger. pid = Reservation.pid)
(A) 1, 0
(B) 1, 2
(C) 1, 3
(D) 1, 5
Answer-C
Explanation: When a subquery uses values from outer query, the subquery is called correlated
subquery. The correlated subquery is evaluated once for each row processed by the outer
query.
The outer query selects 4 entries (with pids as 0, 1, 5, 3) from Reservation table. Out of these
selected entries, the subquery returns Non-Null values only for 1 and 3.
5. Consider the following relational schema:
Suppliers(sid:integer, sname:string, city:string, street:string)
Parts(pid:integer, pname:string, color:string)
Catalog(sid:integer, pid:integer, cost:real)
Consider the following relational query on the above database:
SELECT S.sname
FROM Suppliers S
WHERE S.sid NOT IN (SELECT C.sid
FROM Catalog C
WHERE C.pid NOT IN (SELECT P.pid
FROM Parts P
WHERE P.color<> 'blue'))
Assume that relations corresponding to the above schema are not empty. Which one of the
following is the correct interpretation of the above query?
a. Find the names of all suppliers who have supplied a non-blue part.
b. Find the names of all suppliers who have not supplied a non-blue part.
c. Find the names of all suppliers who have supplied only blue parts.
d. Find the names of all suppliers who have not supplied only blue
parts.
Answer-D
Explanation: (A): False, as this may include blue parts and may not include "null"
parts. (B): Obviously false because it returning other than any blue part. (C): Obviously false
because it does not return this. (D): Correct
‘GOOD’ rating.
b. Names of all the employees with at most one of their customers having a
‘GOOD’ rating.
c. Names of all the employees with none of their customers having a ‘GOOD’
rating.
d. Names of all the employees with all their customers having a ‘GOOD’
rating.
Answer-D
7. Consider the relation "enrolled(student, course)" in which (student, course) is the primary
key, and the relation "paid(student, amount)" where student is the primary key. Assume no
null values and no foreign keys or integrity constraints. Given the following four queries:
Query1: select student from enrolled where
student in (select student from paid)
Query2: select student from paid where
student in (select student from enrolled)
Query3: select E.student from enrolled E, paid P
where E.student = P.student
Query4: select student from paid where exists
(select * from enrolled where enrolled.student
= paid.student)
Which one of the following statements is correct?
A-All queries return identical row sets for any database
B-Query2 and Query4 return identical row sets for all databases but there
exist databases for which Query1 and Query2 return different row sets.
C-There exist databases for which Query3 returns strictly fewer rows than
Query2
D-There exist databases for which Query4 will encounter an integrity
violation at runtime.
Explanation:
Take an example:
Table enrolled
student course
----------------
abc c1
xyz c1
abc c2
pqr c1
Table paid
student amount
-----------------
abc 20000
xyz 10000
rst 10000
Output of Query 1
abc
abc
xyz
Output of Query 2
abc
xyz
Output of Query 3
abc
xyz
Output of Query 4
abc
xyz
Query 1 and Query 3 may return repetitive student values as "student" is not a key in relation
enrolled, however query 2 and query 4 always return same row sets. So, option (B) is correct.
8. The following table has two attributes A and C where A is the primary key and C is
the foreign key referencing A with on-delete cascade.
A C
-----
2 4
3 4
4 3
5 2
7 2
9 5
6 4
The set of all tuples that must be additionally deleted to preserve referential integrity
when the tuple (2,4) is deleted is:
(a) (3,4) and (6,4)
(b) (5,2) and (7,2)
(c) (5,2), (7,2) and (9,5)
(d) (3,4), (4,3) and (6,4)
Answer-C
When (2,4) is deleted. Since C is a foreign key referring A with delete on cascade, all entries
with value 2 in C must be deleted. So (5, 2) and (7, 2) are deleted. As a result of this 5 and 7
are deleted from A which causes (9, 5) to be deleted.
9. 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 book
(d) Titles of the five most expensive books
Answer-D
Explanation: When a subquery uses values from outer query, the subquery is
called correlated subquery. The correlated subquery is evaluated once for each row processed
by the outer query.
The outer query selects all titles from book table. For every selected book, the subquery
returns count of those books which are more expensive than the selected book. The where
clause of outer query will be true for 5 most expensive book. For example count (*) will be 0
for the most expensive book and count(*) will be 1 for second most expensive book.
Explanation: The result of the natural join is the set of all combinations of tuples in R and S
that are equal on their common attribute names. What is the maximum possible number of
tuples? The result of natural join becomes equal to the Cartesian product when there are no
common attributes. The given tables have a common attribute, so the result of natural join
cannot have more than the number of tuples in larger table.
Student
-------------------------------------
Rollno name Address
-------------------------------------
1 a abc
2 b bcd
3 c cde
Enroll
----------------------------------------------
Rollno Courseno Coursename
----------------------------------------------
1 12 pqr
1 14 qrs
1 15 rst
2 13 uvw
2 14 qrs
It might be possible that there is no rollno common. In that case, the number of tuples would
be 0. But in the question rollno is a primary key in Student table and it is a prime attribute in
the Enroll table. So there is no chance of having null values in the rollno column in enroll
table and Student table and every tuple in Enroll will have a parent. So minimum number of
tuples possible are 8 (only 8 tuples in the Enroll table). Option (A) is correct.
b. the average salary of male employees is more than the average salary of all
c. the average salary of male employees is more than the average salary of
d. the average salary of male employees is more than the average salary
in the company
Answer-D
13. 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
Answer-C
Explanation:
The query gives the name of all the students who have scored "A" grade in any of the courses
that are taught by Korth. So, C is the correct choice.
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)
Answer-A
Explanation:
When the ALL condition is followed by a list, the optimizer expands the initial condition to
all elements of the list and strings them together with AND operators. When
the ANY condition is followed by a list, the optimizer expands the initial condition to all
elements of the list and strings them together with OR operators
15. Consider the relations r1(P, Q, R) and r2(R, S, T) with primary keys P and R respectively.
The relation r1 contains 2000 tuples and r2 contains 2500 tuples. The maximum size of the
join r1⋈ r2 is :
a. 2000
b 2500
c. 4500
d. 5000
Answer-A
Explanation:
r1⋈ r2 is a join operation done on the common attribute R. Further R is the primary key of
R2 When we take a , the value of common attribute( R2 in this case) should match.The value
of R in r2 is matched with corresponding R in r1 . So it will have 2000 tuples. So correct
option is (A).
B. Option B
C. Option C
D. Option D
E. Option E
F. Options F
Answer: F
3. View the Exhibit and examine the structure of the products table.
Using the products table, you issue the following query to generate the names,
current list price, and discounted list price for all those products whose list price falls
below $10 after a discount of 25% is applied on it.
The query generates an error. What is the reason for the error?
A. The parenthesis should be added to enclose the entire expression.
B. The double quotation marks should be removed from the column alias.
C. The column alias should be replaced with the expression in the where clause.
D. The column alias should be put in uppercase and enclosed within double
quotation marks in the where clause.
Answer: C
4. Examine the structure proposed for the transactions table:
Which two statements are true regarding the creation and storage of data in the
above table structure?
Answer: F
Answer: E
You want to update the CUST_CREDIT_LIMIT column to NULL for all the customers,
where CUST_INCOME_LEVEL has NULL in the CUSTOMERS table. Which SQL
statement will accomplish the task?
A. UPDATE customers
SET cust_credit_limit = NULL
WHERE cust_income_level = NULL;
B. UPDATE customers
SET cust_credit_limit = NULL
WHERE cust_income_level IS NULL;
C. UPDATE customers
SET cust_credit_limit = TO_NUMBER(NULL)
WHERE cust_income_level = TO_NUMBER(NULL);
D. UPDATE customers
SET cust_credit_limit = TO_NUMBER(' ',9999)
WHERE cust_income_level IS NULL;
Answer: B
12. Where can sub queries be used? (Choose all that apply)
A. field names in the SELECT statement
B. the FROM clause in the SELECT statement
C. the HAVING clause in the SELECT statement
D. the GROUP BY clause in the SELECT statement
E. Options A, B
F. the WHERE clause in SELECT as well as all DML statements
G. Options A, B, C, F
Answer: G
13. Consider the following ER diagram.
d. None of above
Answer-C
15. Which of the following are the features of PL/SQL.
It offers extensive error checking
It offers numerous data types.
It offers a variety of programming structures.
All of the mentioned
Answer-D
2) Which SQL command would you use to define the primary key for a new table called
'Employee' with the primary column to be 'empid'?
A: ADD TABLE Employee ADD PRIMARY KEY (empid)
Answer-D
Answer-C
Answer-D
5) To change the value of a customer’s discount from 3 to 5, what command do we need
to use:
6) The WHERE keyword comes before the condition in a normal Select query. When using the
command GROUP BY in the Select query, what keyword is used to start the condition section
?
A) Having B) Find C) Order D) Provide
Answer-A
7) The term first normal form (1NF) describes the tabular format in which
(check only one)
Answer-D
Answer-D
14) The process of converting complex object data structures into well-structured relations is
called:
b. object-relational modeling. b. normalization.
c. referential integrity. d. determinant analysis.
Answer-B
15) A relation is considered to be in second normal form if it is in first normal form and it has no
____________ dependencies.
a. referential b. functional c. partial key d. transitive
Answer-C
15) SELECT __________ FROM instructor WHERE dept name= ‘Comp. Sci.’;
Which of the following should be used to find the mean of the salary ?
a) Mean(salary)
b) Avg(salary)
c) Sum(salary)
d) Count(salary)
Answer-B
1. .Consider the following two statements about database transaction schedules:
I. Strict two-phase locking protocol generates conflict serializable schedules that are
also recoverable.
II. Timestamp-ordering concurrency control protocol with Thomas’ Write Rule can generate
A. Neither I nor II
B. I only
C. II only
D. Both I and II
Ans. (d)
2. A relational database contains two tables Student and Performance as shown below:
A. 5
B. 11
C. 2
D. NONE OF ABOVE
ANS. A
3. Consider the following relational schemes for a library database: Book (Title, Author, Catalog_no, Publisher,
Year, Price) Collection (Title, Author, Catalog_no) with in the following functional dependencies:
4. Consider two transactions T1 and T2, and four schedules S1, S2, S3, S4 of
T1 and T2 as given below:
T1 = R1[X] W1[X] W1[Y]
T2 = R2[X] R2[Y] W2[Y]
S1 = R1[X] R2[X] R2[Y] W1[X] W1[Y] W2[Y]
S2 = R1[X] R2[X] R2[Y] W1[X] W2[Y] W1[Y]
S3 = R1[X] W1[X] R2[X] W1[Y] R2[Y] W2[Y]
S1 = R1[X] R2[Y]R2[X]W1[X] W1[Y] W2[Y]
Which of the above schedules are conflict-serializable?
(A) S1 and S2
(B) S2 and S3
(C) S3 only
(D) S4 only
Answer (B)
Answer (d)
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+ = {ABCDFG}
Answer (C)
7. 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
Answer A
Create a table like this:
Q2 returns empId of those employees who get salary more than the minimum salary
offered in department 5. It returns 1,3,4 for the above table.
According the question the answer should be 1 for the above table.
The question implies that the required employee must not be from
department 5.
8. Consider the table R with attributes A, B and C. The functional dependencies that
hold on R are : A → B, C → AB. Which of the following statements is/are True ? I.
The decomposition of R into R1(C, A) and R2(A, B) is lossless. II. The decomposition
of R into R1(A, B) and R2(B, C) is lossy.
a) Only I
b) Only II
c) Both I and II
d) Neither I nor II
Answer c
B. It gives an error because all the aggregate functions used in the having clause
must be specified in the select list.
C. It displays the item nos with their average quantity where the average
quantity is more than double the minimum quantity of that item in the table.
D. It displays the item nos with their average quantity where the average quantity
is more than double the overall minimum quantity of all the items in the table.
Answer: C
ANS: a
11. We indicate roles in E-R diagrams by labeling the lines that connect ___________ to
__________
a) Diamond , diamond
b) Rectangle, diamond
c) Rectangle, rectangle
d) Diamond, rectangle
ANS: d
12. Examine the data in the ename and hiredate columns of the employees table:
You want to generate a list of user IDs as follows:
Answer: A
13. View the Exhibit and examine the data in the promotions table.
Answer: B
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A: Correct because the requirement is add salary with not null
constraint only. Although, B will execute successfully but default constraint is
not required.
2- You issue the following command to alter the country column in the
departments table:
B. It executes successfully and all the rows that have a null value for the country
column will be updated with the value 'USA'.
D. It produces an error because the data type for the column is not specified.
Answer: C
3- Examine the structure of the customers table:
CUSTNO is the primary key in the table. You want to find out if any customers'
details have been entered more than once using different CUSTNO, by listing all the
duplicate names.
Which two methods can you use to get the required result?
A. Self-join
B. Subquery
C. Left outer-join with self-join
D. Both A and B
Answer: Correct D
create table customer(
CUSTNO number primary key,
CUSTNAME varchar2(2))
View the Exhibit and examine the data in the products table.
You need to display product names from the products table that belong to the
'software/other' category with minimum prices as either S2000 or S4000 and no
unit of measure.
You issue the following query:
Which statement is true regarding the above query?
A. It executes successfully but returns no result.
D. It generates an error because the condition specified for the prod category column
is not valid.
Answer: A
A. Option A
B. Option B
C. Option C
D. Option D
Answer: B
Which statement shows the department ID, minimum salary, and maximum salary paid in that department,
only if the minimum salary is less than 5000 and maximum salary is more than 15000?
A. SELECT dept_id, MIN (salary), MAX (salary) FROM employees WHERE MIN(salary) < 5000 AND
MAX (salary) > 15000;
B. SELECT dept_id, MIN (salary), MAX (salary) FROM employees WHERE MIN (salary) < 5000 AND
MAX (salary) 15000 GROUP BY dept_id;
C. SELECT dept_id, MIN(salary), MAX(salary) FROM employees HAVING MIN (salary) < 5000 AND
MAX (salary)
D. SELECT dept_id, MIN (salary), MAX (salary) FROM employees GROUP BY dept_id HAVING
MIN(salary) < 5000 AND MAX (salary) > 15000
ANS: D
7. You would like to display the system date in the format "Monday, 01 June, 2001". Which SELECT
statement should you use?
Ans: C
format_mask parameter begins with "FM"
8. What is true about joining tables through an Equijoin?
9. What is the value of customer_id within the nested block in the example below?
/* Start main block */
DECLARE
customer_id NUMBER(9) := 678;
credit_limit NUMBER(10,2) := 10000;
BEGIN
/* Start nested block */
DECLARE
customer_id VARCHAR2(9) := 'AP56';
current_balance NUMBER(10,2) := 467.87;
BEGIN
-- what is the value of customer_id at this point?
NULL;
END;
END;
Please select the best answer.
A. 678
B. 10000
C. AP56
D. 467.87
Ans: C
10. Which of the following is used to store movie and image files?
a) Clob
b) Blob
c) Binary
d) Image
Answer:-B
Answer:-B
Answer:-C
13. How many relations can a delete command operate on?
a) 0
b) 1
c) 2
d) Infinitely many
Answer:-B
Answer:-D
15. The join operations that do not retain mismatched tuples are called as _________ operations
a) outer join
b) natural join
c) full outer join
d) inner join
Correct B,D
DBMS MCQ
(a)Removes duplicates (b) Ignore nulls (c) add readability (d) none of the above
Answer:-A
Answer:-D
2. Which DDL command is used to delete all the data from the table but preserving the structure?
Answer:-D
3. Select name, contact from emp where dno= (Select dno from dept where dname=’EC’)
Which of the following field may be used as a foreign key in the above database context?
Answer:-C
Answer:-D
5. The combination of arithmetic operators used to show not equal to condition is:
Answer:-D
Answer:-C
6. The attribute name could be structured as an attribute consisting of first name, middle initial, and
last name. This type of attribute is called
a) Simple attribute
b) Composite attribute
c) Multi valued attribute
d) Derived attribute
Answer:-B
Answer:-B
Answer:-B
Answer:-B
10. Which of the following creates a virtual relation for storing the query?
a) Function
b) View
c) Procedure
d) None of the mentioned
Answer:-B
Answer:-C
12. How many relations can a delete command operate on?
a) 0
b) 1
c) 2
d) Infinitely many
Answer:-B
13. Choose the correct option regarding the following query
INSERT INTO course ('CS-67' , 'course name', 'any' , 5);
a) Data is inserted into the course relation
b) Data is not inserted into the course relation due to incorrect specification
c) Data is inserted into the CS-67 relation
d) Data is not inserted due to the incorrect use of syntax
Answer:-D
14. The join operations that do not retain mismatched tuples are called as _________ operations
a) outer join
b) natural join
c) full outer join
d) inner join
Answer:-D
15. Create view student select ID, address, name from student;
Answer:-D
multiuser environment
single-user environment
in a multiuser environment
in a single-user environment
Answer D
b. Query2 and Query4 return identical row sets for all databases but
there exist databases for which Query1 and Query2 return different
row sets.
c. There exist databases for which Query3 returns strictly fewer rows
than Query2
violation at runtime.
Answer B
3. 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
Answer A
4. In SQL, relations can contain null values, and comparisons with null values
are treated as unknown. Suppose all comparisons with a null value are
treated as false. Which of the following pairs is not equivalent?
a. x = 5 AND not(not(x = 5))
c. x ≠ 5 AND not (x = 5)
Answer C
b. 4
c. 5
d. 6
Answer C
6.
following relations:
SELECT S. Student_Name, sum(P.Marks)
FROM Student S, Performance P
WHERE S.Roll_No = P.Roll_No
GROUP BY S.Student_Name
The number of rows that will be returned by the SQL query is _________
0
1
2
Answer C
d. Only I is correct.
Answer d
8) The following table has two attributes A and C where A is the primary key
and C is the foreign key referencing A with on-delete cascade.
A C
-----
2 4
3 4
4 3
5 2
7 2
9 5
6 4
The set of all tuples that must be additionally deleted to preserve referential
integrity when the tuple (2,4) is deleted is:
(a) (3,4) and (6,4)
(b) (5,2) and (7,2)
(c) (5,2), (7,2) and (9,5)
(d) (3,4), (4,3) and (6,4)
Answer (C)
9. Given the following relation instance.
x y z
1 4 2
1 5 3
1 6 3
3 2 2
Which of the following functional dependencies are satisfied by the instance?
(GATE CS 2000)
(a) XY -> Z and Z -> Y
(b) YZ -> X and Y -> Z
(c) YZ -> X and X -> Z
(d) XZ -> Y and Y -> X
Answer: (b)
10) Consider the following schedules involving two transactions. Which one of
the following statements is TRUE?
Answer (C)
11) 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 rel ation S contains 100 tuples.
What is the
maximum number of tuples possible in the natural join R◊◊S (R natural join S)
(A) 100
(B) 200
(D) 300
(D) 2000
Answer (A)
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+ = {ABCDFG}
Answer (C, D)
13. 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?
D-{M1, P1}
Answer (A)
14. Which of the following is the preferred way to recover a database after a system failure?
a. Rollback
b. Rollforward
d. Reprocess transactions
Answer: c
15. What SQL command will allow you to change the table STUDENT to add the constraint
named GradeCheck that states that the values of the Grade column must be greater than 0?
c. ALTER TABLE STUDENT ADD CONSTRAINT GradeCheck CHECK (Grade > 0);
Answer: c
Answer: (D)
3. Consider a relation book (title, price) which 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) < 7
(A) Titles of the six most expensive books.
(B) Title of the sixth most expensive books.
(C) Titles of the seven most expensive books.
(D) Title of the seventh most expensive books.
Answer: (C)
Answer: (C)
Answer: (D)
22 Dustin 7 45
29 Borg 1 33
31 Pathy 8 55
32 Robert 8 25
58 Raghu 10 17
64 Herald 7 35
71 Vishnu 10 16
74 King 9 35
85 Archer 3 26
84 Bob 3 64
96 Flinch 3 17
Answer: (D)
7. Below Query using Case Expression is:
UPDATE Customer
SET State_Code = CASE State_Code
WHEN 'CDG' THEN 'CHANDIGARH'
WHEN 'NDG' THEN 'NEW DELHI'
WHEN 'RJS' THEN 'RAJASTHAN'
ELSE NULL
END
A) Valid
B) Invalid
Answer: (A)
A. Use employee.lname%type.
B. Use employee.lname%rowtype.
C. Look up datatype for EMPLOYEE column on LASTNAME table and use that.
D. Declare it to be type LONG.
Ans: A
A. customer_12
B. loop
C. customer@orgA
D. 12customer
Ans: A
10. The || is is an example of what function
FROM employees;
A. Incantination
B. Integration
C. Continuation
D. Concatenation
E. None of the above
ANS: D
13. Which of the following deletes all tuples in the instructor relation for those instructors associated
with a department located in the Watson building which is in department relation.
a)
DELETE FROM instructor
WHERE dept_name IN 'Watson';
b)
DELETE FROM department
WHERE building='Watson';
d)None
Answer: c
14. Which of the following relation updates all instructors with salary over $100,000 receive a 3
percent raise, whereas all others receive a 5 percent raise.
a)
UPDATE instructor
SET salary = salary * 1.03
WHERE salary > 100000;
UPDATE instructor
SET salary = salary * 1.05
WHERE salary <= 100000;
b)
UPDATE instructor
SET salary = salary * 1.05
WHERE salary < (SELECT avg (salary)
FROM instructor);
c)
UPDATE instructor
SET salary = CASE
WHEN salary <= 100000 THEN salary * 1.03
ELSE salary * 1.05
END
Answer: a
15..SELECT *
FROM student JOIN takes USING (ID);
b)
SELECT *
FROM student OUTER JOIN takes USING (ID);
c)
SELECT *
FROM student LEFT OUTER JOIN takes USING (ID);
Answer: a
b. 3
c. 4
d. 5
Answer b
Answer b
6)
CREATE TABLE course
( . . .
FOREIGN KEY (dept name) REFERENCES department
. . . );
Which of the following is used to delete the entries in the referenced table when the tuple is deleted in
course table?
a) Delete
b) Delete cascade
c) Set null
d) All of the mentioned
Answer b
7) If you were collecting and storing information about your music collection, an album would be
considered a(n) _____
a) Relation
b) Entity
c) Instance
d) Attribute
Answer b
Answer: D
A. 1, 2
B. 1, 3, 6
C. 1, 2, 3, 6
D. 1, 2, 6
Answer: C
You inserted some rows in the table. After some time, you want to alter the table by creating the
PRIMARY KEY constraint on the ORD_ID column.
11. You need to extract details of those products in the SALES table where the PROD_ID column
contains the string '_D123'. Which WHERE clause could be used in the SELECT statement to get the
required output?
A. WHERE prod_id LIKE '%_D123%' ESCAPE '_'
B. WHERE prod_id LIKE '%\_D123%' ESCAPE '\'
C. WHERE prod_id LIKE '%_D123%' ESCAPE '%_'
D. WHERE prod_id LIKE '%\_D123%' ESCAPE '\_'
14)
Examine the description of the STUDENTS table:
STD_ID NUMBER(4)
COURSE_ID VARCHARD2(10)
START_DATE DATE
END_DATE DATE
Which two aggregate functions are valid on the START_DATE column?
A. SUM(start_date)
B. AVG(start_date)
C. COUNT(start_date)
D. AVG(start_date, end_date)
Answer: C,
Explanation:
It is possible to apply COUNT() and MIN() functions on the column with DATE data type.
15
What does the TRUNCATE statement do?
A. Removes the table
B. Removes all rows from a table
C. Shortens the table to 10 rows
D. Removes all columns from a table
E. Removes foreign keys from a table
Answer: B
Q.1 - Consider the following schema −
STUDENTS(student_code,first_name,last_name, email,
phone_no,date_of_birth,honours_subject,percentage_of_marks);
Which query will display the names and honours subjects of all students and if a
student has not yet been given ahonours subject yet, then it should display ‘No
Honours Yet’.
A - selectfirst_name, last name, nvl(honours_subject, ‘No Honours Yet’) from
students;
B - selectfirst_name, last name, nvl2(honours_subject, ‘No Honours Yet’) from
students;
C - selectfirst_name, last name, honours_subject, from students;
D - selectfirst_name, last name, nullif(honours_subject, ‘No Honours Yet’) from
students;
ANSWER A
Q 2 - Consider the following schema −
STUDENTS(student_code,first_name,last_name, email,
phone_no,date_of_birth,honours_subject,percentage_of_marks);
Which of the following query would correctly display the students’ first name, last name, honours
subject and date of birth, born between July 1st 1996, and 30th June 1999.
A - selectfirst_name, last name, honours_subject, date_of_birth from students where
date_of_birth between ’30-JUN-1999’ and ’01-JUL-1996’;
B - selectfirst_name, last name, honours_subject, date_of_birth from students where
date_of_birth in (’30-JUN-1999’ , ’01-JUL-1996’);
C - selectfirst_name, last name, honours_subject, date_of_birth from students where
date_of_birth like ’30-JUN-1999’ and ’01-JUL-1996’;
D - selectfirst_name, last name, honours_subject, date_of_birth from students where
date_of_birth between ’01-JUL-1996’ and ’30-JUN-1999’;
ANSWER D
Q 3 - Which of the following is not true about single row functions?
A - They operate on single rows only and return one result per row.
B - They accept arguments that could be a column or any expression.
C - They cannot be nested.
D - They may modify the data type.
ANSWER C
Q4 - Which of the following is not a character manipulation function?
A - concat
B - substr
C - instr
D - coalesce
ANSWER D
Q 5 - What is returned by INSTR(‘TUTORIALS PPOINT’, ‘P’)?
A - 11
B- 2
C - PPOINT
D- 12
ANSWER A
Q 6 - What is returned by SUBSTR(‘TUTORIALS POINT’, 1, 9)?
A - TUTORIAL
B- T S
C - TUTORIALS
D - UTORIALS
ANSWER C
Q 7 - What is returned by SUBSTR(‘TUTORIALS POINT’, -1, 1)?
A-T
B - NULL
C-0
D-N
ANSWER A
Q 8- Which of the following is/are true with reference to ‘view’ in DBMS ? (a) A ‘view’
is a special stored procedure executed when certain event occurs. (b) A ‘view’ is a
virtual table, which occurs after executing a pre-compiled query. code:
A – TRUE A
B – FALSE A
C - Both TRUE
D - Both FALSE
ANSWER B
Q 9-
B- 4
C- 8
D- NONE
ANSWER B
Q-10 Consider the set of relations given 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 =Sriram AND Grades.Grade = A
AND Courses.Course_number = Grades.Course_number
A- Name of all students who are either enrolled in "DBMS" or "OS" courses
B- Name of all students who are enrolled in "DBMS" and "OS"
C- Name of all students who are either enrolled in "DBMS" or "OS" or both.
D- NONE
ANSWER B
12. 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
Answer-B
13. …………………… is the process of organizing data into related tables.
A) Normalization
B) Generalization
C) Specialization
D) None of the above
Answer-A
14) 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
Answer-B
15) The language that requires a user to specify the data to be retrieved without specifying exactly
how to get it is
A. Procedural DML
B. Non-Procedural DML
C. Procedural DDL
D. Non-Procedural DDL
Answer-B
What is the cardinality of table with 1000 rows and 100 column?
a) 10
b) 100
c) 1000
d) None of these
ANS: c
You want to display the names of the products that have the highest total
value for UNIT_PRICE * QTY_IN_HAND.
Which SQL statement gives the required output?
A. Option A
B. Option B
C. Option C
D. Option D
Answer: A
You need to produce a report where each customer's credit limit has been
incremented by $1000. In the output, the customer's last name should have
the heading Name and the incremented credit limit should be labeled New
credit Limit. The column headings should have only the first letter of each
word in uppercase.
A. Option A
B. Option B
C. Option C
D. Option D
Answer: C
View the Exhibit and examine the data in the costs table:
You need to generate a report that displays the IDs of all products in the costs table
whose unit price is at least 25% more than the unit cost. The details should be
displayed in the descending order of 25% of the unit cost.
You issue the following query:
Answer: A
View the Exhibit and examine the structure of the products table
Evaluate the following query:
Examine the create table statements for the stores and sales tables.
SQL> CREATE TABLE stores(store_id NUMBER(4) CONSTRAINT
store_id_pk PRIMARY KEY, store_name VARCHAR2(12), store_address
VARCHAR2(20), start_date DATE);
SQL> CREATE TABLE sales(sales_id NUMBER(4) CONSTRAINT
sales_id_pk PRIMARY KEY, item_id NUMBER(4), quantity NUMBER(10),
sales_date DATE, store_id NUMBER(4), CONSTRAINT store_id_fk
FOREIGN KEY(store_id) REFERENCES stores(store_id));
You executed the following statement:
SQL> DELETE from stores
WHERE store_id=900;
The statement fails due to the integrity constraint error:
ORA-02292: integrity constraint (HR.STORE_ID_FK) violated
Which three options ensure that the statement will execute successfully?
A. Disable the primary key in the STORES table.
B. Use CASCADE keyword with DELETE statement.
C. DELETE the rows with STORE_ID = 900 from the SALES table and
then delete rows from STORES table.
D. Disable the FOREIGN KEY in SALES table and then delete the rows.
E. Options A, C, D
Answer: E
A. 3
B. 4
C. 5
D. 6
Answer: B
Answer: (C)
10. Consider a relational table with a single record for each registered student with
the following attributes.
1. Registration_Num: Unique registration number
of each registered student
2. UID: Unique identity number, unique at the
national level for each citizen
3. BankAccount_Num: Unique account number at
the bank. A student can have multiple accounts
or join accounts. This attribute stores the
primary account number.
4. Name: Name of the student
5. Hostel_Room: Room number of the hostel
Which one of the following option is INCORRECT?
(A) BankAccount_Num is candidate key
(B) Registration_Num can be a primary key
(C) UID is 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
Answer: (A)
Answer: (A)
13. The maximum number of super keys for the relation schema R(E,F,G,H) with E as the
key is
(A) 5
(B) 6
(C) 7
(D) 8
Answer: (D)
Answer: (D)
15. The relation scheme Student Performance (name, courseNo, rollNo, grade) has
the following functional dependencies:
name, courseNo → grade
rollNo, courseNo → grade
name → rollNo
rollNo → name
The highest normal form of this relation scheme is
(A) 2 NF
(B) 3 NF
(C) BCNF
(D) 4NF
Answer: (B)
DBMS MCQ
Q1) can use the following three rules to find logically implied functional dependencies. This
collection of rules is called
a) Axioms
b) Armstrong’s axioms
c) Armstrong
d) Closure
2. Relational databases store structured data while Big Data stores data in any format. Most
of real world data is of which type?
(a) Hierarchical (b) Relational (c) Big data (d)Cloud
Ans c
Ans d
4) Suppose relation R(A,B) currently has tuples {(1,2), (1,3), (3,4)} and relation S(B,C) currently
has {(2,5), (4,6), (7,8)}. Then the number of tuples in the result of the SQL query:
SELECT*
FROM R NATURALOUTERJOIN S;
a) 2
b) 4
c) 6
Ans: A
5. Which one of the following depicts the property of transaction that, it must be performed
completely or nor performed at all?
(a) Atomicity (b) Durability (c) Consistency(d) Isolation
Ans A
6.Consider two statements about outer and inner queries in context of SQL sub-queries?
i. The inner queries can get data from only one table
ii. The inner queries can get data from more than one table
Which of the above statements are true?
A. (i)
B. (ii)
C. Both (i) and (ii)
D. Neither (i) nor (ii)
Ans b
7. The value of ‘age’ filed can be calculated by using ‘date-of-birth’ field. This type of
attribute is called
a) Simple attribute
b) Composite attribute
c) Multi valued attribute
d) Derived attribute
Ans d
8. This property express the number of entities to which another entity can be associated in
a relationship:
a) Degree
b) Cardinality
c) Redundancy
d) Anomaly
Ans b
9. Which of the following statements creates a new table temp instructor that has the same
schema as an instructor with no data.
a) create table temp_instructor as select * from instructor;
b) Create table temp_instructoras select * from instructor where 1=2;
c) Create Table as temp_instructor;
d) Create table like temp_instructor;
Ans b
10: In a large DBMS
a. each user can "see" only a small part of the entire database
b. each subschema contains every field in the logical schema
c. each user can access every subschema
d. all of the above
Answer: a
11) Functional Dependencies are the types of constraints that are based on______
a) Key
b) Key revisited
c) Superset key
d) None of the mentioned
Ans A
12) Which prefixes are available to Oracle triggers?
a) : new only
b) : old only
c) Both :new and : old
d) Neither :new nor : old
Ans: c
Answer: c
11. Select invalid variable types
A. CHAR
B. VARCHAR1
C. VARCHAR2
D. INTEGER
Answer-B
12. Which of the following keyword is used with Data Control Language (DCL)
statements?
A. SELECT
B. INSERT
C. DELETE
D. GRANT
Answer-D
13. A type of query that is placed within a WHERE or HAVING clause of another
query is called
A. Master query
B. Sub query
C. Super query
D. Multi-query
Answer-B
14. A command that lets you change one or more fields in a record is
A. Insert
B. Modify
C. Look-up
Answer-B
15. Which of the following is a Data Model?
A. Entity-Relationship model
B. Relational data model
C. Object-Based data model
D. All of the above
Answer-D
A. TRUE
B. FALSE
Answer-B
18.Which of the following is a comparison operator in SQL?
A. Double equal sign ( == )
B. LIKE
C. BETWEEN
Answer-A
9. Which function is used to divides one numeric expression by another and get
the remainder ?
A. POWER
B. MOD
C. ROUND
D. REMAINDER
Answer-B
10. The virtual table that its created by data from the result of an SQL
'Select' statement is called _________
A. View
B. Synonym
C. Sequence
D.Transaction
Answer-A
Answer-B
Answer-C
Answer-C
14. What is an SQL virtual table that is constructed from other tables?
a. Just another table
b. A view
c. A relation
d. Query results
Answer-B
Answer-D
DBMS MCQ
1. Display EmployeeId and EmployeeName of those employees where their Company is
‘Wipro’ or ‘Datamane’.
The EmployeeId should display only the numeric value of the EmployeeId. for example e101
should be displayed as 101.?
(a) Select substr(Empid,2),Ename from emp where company_name in(‘Wipro’,’Datamane’)
(b) Select Empid,Ename from emp where company_name=’Wipro’,’Datamane’
(c) Select Ename,Empid from emp where company_name=’Wipro’ or
company_name=’Datamane’
(d) none of the above
Ans A
2. Relational databases store structured data while Big Data stores data in any format. Most
of real world data is of which type?
(a) Hierarchical (b) Relational (c) Big data (d)Cloud
Ans c
Ans d
4. Which DDL command is used to delete all the data from the table but preserving the
structure?
(a) Drop (b) Delete (c) Alter (d) Truncate
Ans d
Ans c
Ans b
7. Which one of the following depicts the property of transaction that, it must be performed
completely or nor performed at all?
(a) Atomicity (b) Durability (c) Consistency (d) Isolation
Ans A
8. Consider two statements about outer and inner queries in context of SQL sub-queries?
i. The inner queries can get data from only one table
ii. The inner queries can get data from more than one table
Which of the above statements are true?
A. (i)
B. (ii)
C. Both (i) and (ii)
D. Neither (i) nor (ii)
Ans b
9. The value of ‘age’ filed can be calculated by using ‘date-of-birth’ field. This type of
attribute is called
a) Simple attribute
b) Composite attribute
c) Multi valued attribute
d) Derived attribute
Ans d
10. This property express the number of entities to which another entity can be associated
in a relationship:
a) Degree
b) Cardinality
c) Redundancy
d) Anomaly
Ans b
11. Which of the following statements creates a new table temp instructor that has the
same schema as an instructor with no data.
a) create table temp_instructor as select * from instructor;
b) Create table temp_instructor as select * from instructor where 1=2;
c) Create Table as temp_instructor;
d) Create table like temp_instructor;
Ans b
Ans b
13. Which of the following makes the transaction permanent in the database?
a) View
b) Commit
c) Rollback
d) Flashback
Ans: B
15) Functional Dependencies are the types of constraints that are based on______
a) Key
b) Key revisited
c) Superset key
d) None of the mentioned
Ans A
C. The statement produces an error because a subquery in the from clause and
outer-joinscannot be used together.
Answer: A
Answer: B
4. . A pilot can fly three types of planes and a plane can be piloted by any qualified pilot. The pilot-
plane type relationship is
(a) N:3
(b) 3:N
(c) 1:3
(d) 3:1
Answer: A
Answer: D
6. What will be appropriate SQL Query to find the name of cities with temperature and condition
whose condition is neither sunny nor cloudy
a) SELECT city, temperature, condition FROM weather WHERE condition NOT IN ('sunny', 'cloudy')
b) SELECT city, temperature, condition FROM weather WHERE condition NOT BETWEEN ('sunny',
'cloudy')
c) SELECT city, temperature, condition FROM weather WHERE condition IN ('sunny', 'cloudy')
d) SELECT city, temperature, condition FROM weather WHERE condition BETWEEN ('sunny', 'cloudy')
Answer: A
7. Which of the following is true about the execution section of a PL/SQL block?
a) It is enclosed between the keywords BEGIN and END.
b) It is a mandatory section.
c) It consists of the executable PL/SQL statements.
d) All of the above.
Answer: D
Answer: B
9. Which of the following is the syntax for views where v is view name?
a) Create view v as “query name”;
b) Create “query expression” as view;
c) Create view v as “query expression”;
d) Create view “query expression”;
Answer:C
10.Which are the two ways in which entities can participate in a relationship?
(A)Passive and active (B)Total and Partial (C)Simplex and Complex (D)All of the above
Answer: B
Answer A
Answer C
Answer : Option D
1. An advantage of the database management approach is
a) Data is dependent on programs.
b) Data redundancy increases.
c) Data is integrated and can be accessed by multiple programs.
d) None of the above.
Answer: C
2. Which one of the following is used to define the structure of the relation, deleting relations and
relating schemas?
a) DML(Data Manipulation Language)
b) DDL(Data Definition Language)
c) Query
d) Relational Schema
Answer: B
3. Aggregate functions can be used in the select list or the_______clause of a select statement or
subquery. They cannot be used in a ______ clause.
a) Where, having
b) Having, where
c) Group by, having
d) Group by, where
Answer: B
Answer: B
7. Which of the following options is true regarding the NATURAL JOIN in Oracle DB?
a. While using NATURAL JOIN mentioning the names of all the columns from both the tables is
mandatory
b. NATURAL JOIN can be used only if the names of all the columns of both the tables are identical
c. The join in NATURAL JOIN happens only when the user specifies the columns of the source and the
target tables.
d. There is no need to mention the columns when using NATURAL JOINS.
Answer: D
Answer: D
Answer:D
10. The ______ clause allows us to select only those rows in the result relation of the ____
clause that satisfy a specified predicate.
a) Where, from
b) From, select
c) Select, from
d) From, where
Answer: A
Answer: B
13. The _____________ is essentially used to search for patterns in target string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
Answer: A
14. ______ 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
Answer: B
B.Data manipulation
C.Database schema
D.Data definition
Answer:C
1. View the Exhibit for the structure of the student and faculty tables.
You need to display the faculty name followed by the number of students handled by the
faculty at the base location.
Examine the following two SQL statements:
D. Both statements 1 and 2 execute successfully and give the same required result.
Answer: D
For which substitution variables are you prompted for the input?
A. None, because no input required
B. Both the substitution variables 'hiredate' and 'mgr_id’
C. Only 'hiredate'
D. Only 'mgr_id'
Answer: B
5. View the Exhibit and examine the data in the employees table:
You want to display all the employee names and their corresponding manager
names.
Evaluate the following query:
Which join option can be used in the blank in the above query to get the required
output?
A. INNER JOIN
B. FULL OUTER JOIN
C. LEFT OUTER JOIN
D. RIGHT OUTER JOIN
Answer: C
A. >=
B. <
C. =
D. All of the above
Answer: D.
7.You need to find the salaries for all the employees who have a
higher salary than the Vice President of a company 'ABC'.Which of
the following queries will give you the required result? (Consider the
table structure as given)
-----------------------------------------------
FIRST_NAME VARCHAR2(20)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
(a)
FROM employees
FROM employees
(b)
FROM employees
FROM employees
(c)
FROM employees
-----------------------------------------------
FIRST_NAME VARCHAR2(20)
PHONE_NUMBER VARCHAR2(20)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
FROM employees
FROM employees);
A. It executes successfully and gives the employees who have salaries equal to
the max salary.
B. It executes successfully but does not give the required results
C. It throws an error as a group function is used in the sub-query
D. It throws an error as a single row sub-query should contain a multi-row
operator
Answer: A.
FROM employees
GROUP BY department_id
HAVING MIN(salary)>
(SELECT min(salary)
FROM employees
A. It executes successfully and gives the names and minimum salary greater
than department 100 of all employees
B. It executes successfully and gives the salaries of the employees in
department 100
C. It executes successfully and gives the names and minimum salaries of all the
employees.
D. It throws an error.
Answer: A.
10. Which of the following is not a format for Outer Joins in Oracle
DB?
A. Right
B. Left
C. Centre
D. Full
Answer: C.
11. For which two constraints does the Oracle Server implicitly create a unique index?
A. NOT NULL
B. PRIMARY KEY
C. FOREIGN KEY
D. CHECK
E. Default
Answer: B
Answer: D
13. Consider the following code snippet: how many times the loop will run?
DECLARE
a number(2) := 9;
BEGIN
WHILE a < 30 LOOP
a := a + 3;
dbms_output.put_line(a);
END LOOP;
END;
a) 10
b) 8
c) 7
d) 9
Answer: C
14.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:
Answer: A
12. If the closure of an attribute set is the entire relation then the attribute set is a
(A) superkey
(B) candidate key
(C) primary key
(D) not a key
Ans: (A)
14. Which of the following statement on the view concept in SQL is invalid?
(A) All views are not updateable
(B) The views may be referenced in an SQL statement whenever tables are
referenced.
(C) The views are instantiated at the time they are referenced and not when they
are defined.
(D) The definition of a view should not have GROUP BY clause in it.
Ans: (D)
2. View the Exhibit and examine the data in the employees table:
You want to display all the employee names and their corresponding manager
names.
Evaluate the following query:
Which join option can be used in the blank in the above query to get the required
output?
A. INNER JOIN
B. FULL OUTER JOIN
C. LEFT OUTER JOIN
D. RIGHT OUTER JOIN
Answer: C
E. >=
F. <
G. =
H. All of the above
Answer: D.
4.You need to find the salaries for all the employees who have a
higher salary than the Vice President of a company 'ABC'.Which of
the following queries will give you the required result? (Consider the
table structure as given)
-----------------------------------------------
FIRST_NAME VARCHAR2(20)
PHONE_NUMBER VARCHAR2(20)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
(a)
FROM employees
FROM employees
FROM employees
FROM employees
(c)
FROM employees
Answer: A.
-----------------------------------------------
FIRST_NAME VARCHAR2(20)
PHONE_NUMBER VARCHAR2(20)
SALARY NUMBER(8,2)
COMMISSION_PCT NUMBER(2,2)
MANAGER_ID NUMBER(6)
DEPARTMENT_ID NUMBER(4)
FROM employees
FROM employees);
E. It executes successfully and gives the employees who have salaries equal to
the max salary.
F. It executes successfully but does not give the required results
G. It throws an error as a group function is used in the sub-query
H. It throws an error as a single row sub-query should contain a multi-row
operator
Answer: A.
FROM employees
GROUP BY department_id
HAVING MIN(salary)>
(SELECT min(salary)
FROM employees
E. It executes successfully and gives the names and minimum salary greater
than department 100 of all employees
F. It executes successfully and gives the salaries of the employees in
department 100
G. It executes successfully and gives the names and minimum salaries of all the
employees.
H. It throws an error.
Answer: A.
7. Which of the following is not a format for Outer Joins in Oracle
DB?
E. Right
F. Left
G. Centre
H. Full
Answer: C.
8. For which two constraints does the Oracle Server implicitly create a unique index?
A. NOT NULL
B. PRIMARY KEY
C. FOREIGN KEY
D. CHECK
E. Default
Answer: B
9.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:
Answer: A
12 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
7. 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
8. What do you mean by one to many relationship between Teacher and Class
table?
A.One class may have many teachers
B.One teacher can have many classes
C.Many classes may have many teachers
D.Many teachers may have many classes
Ans: B
Answer : Option A
11. If the tuples are satisfying the where predicate, then they are placed
into groups by the
Having clause
Group by clause
Like clause
Distinct clause
Answer : Option B
We want to find the total sum (total order) of each customer. Which of the below statement
should we use:
15. What needs to be added when user want to show results by Descending Order?