0% found this document useful (0 votes)
193 views139 pages

Unique User ID Expansion in Databases

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
193 views139 pages

Unique User ID Expansion in Databases

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Database Questions and Answers – Relational Answer: b

Database and Database Schema Explanation: Attribute is a specific domain in the relation
which has entries of all tuples.
This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “Relational Database and 5. For each attribute of a relation, there is a set of
Database Schema”. permitted values, called the ________ of that attribute.
a) Domain
1. A relational database consists of a collection of
b) Relation
a) Tables
c) Set
b) Fields
d) Schema
c) Records
View Answer
d) Keys
View Answer Answer: a
Explanation: The values of the attribute should be
Answer: a
present in the domain. Domain is a set of values
Explanation: Fields are the column of the relation or
permitted.
tables. Records are each row in a relation. Keys are the
constraints in a relation. Subscribe Now: DBMS Newsletter | Important Subjects
Newsletters
2. A ________ in a table represents a relationship
among a set of values. 6. Database __________ which is the logical design of
a) Column the database, and the database _______ which is a
b) Key snapshot of the data in the database at a given instant
c) Row in time.
d) Entry a) Instance, Schema
View Answer b) Relation, Schema
c) Relation, Domain
Answer: c
d) Schema, Instance
Explanation: Column has only one set of values. Keys are
View Answer
constraints and row is one whole set of attributes. Entry
is just a piece of data. Answer: d
Explanation: Instance is an instance of time and schema
3. The term _______ is used to refer to a row.
is a representation.
a) Attribute
b) Tuple 7. Course(course_id,sec_id,semester)
c) Field Here the course_id,sec_id and semester are
d) Instance __________ and course is a _________
View Answer a) Relations, Attribute
b) Attributes, Relation
Answer: b
c) Tuple, Relation
Explanation: Tuple is one entry of the relation with
d) Tuple, Attributes
several attributes which are fields.
View Answer
advertisement
Answer: b
4. The term attribute refers to a ___________ of a table. Explanation: The relation course has a set of attributes
a) Record course_id,sec_id,semester .
b) Column
8. Department (dept name, building, budget) and
c) Tuple
Employee (employee_id, name, dept name, salary)
d) Key
Here the dept_name attribute appears in both the
View Answer
relations. Here using common attributes in relation
Page 1 of 139
schema is one way of relating ___________ relations. 2. Consider attributes ID, CITY and NAME. Which one of
a) Attributes of common this can be considered as a super key?
b) Tuple of common a) NAME
c) Tuple of distinct b) ID
d) Attributes of distinct c) CITY
View Answer d) CITY, ID
View Answer
Answer: c
Explanation: Here the relations are connected by the Answer: b
common attributes. Explanation: Here the id is the only attribute which can
be taken as a key. Other attributes are not uniquely
9. A domain is atomic if elements of the domain are
identified.
considered to be ____________ units.
a) Different 3. The subset of a super key is a candidate key under
b) Indivisbile what condition?
c) Constant a) No proper subset is a super key
d) Divisible b) All subsets are super keys
View Answer c) Subset is a super key
d) Each subset is a super key
Answer: b
View Answer
Explanation: None.
Answer: a
10. The tuples of the relations can be of ________ order.
Explanation: The subset of a set cannot be the same set.
a) Any
Candidate key is a set from a super key which cannot be
b) Same
the whole of the super set.
c) Sorted
d) Constant advertisement
View Answer
4. A _____ is a property of the entire relation, rather
Answer: a than of the individual tuples in which each tuple is
Explanation: The values only count. The order of the unique.
tuples does not matter. a) Rows
b) Key
Database Questions and Answers – Keys
c) Attribute
This set of Database Multiple Choice Questions & d) Fields
Answers (MCQs) focuses on “Keys”. View Answer

1. Which one of the following is a set of one or more Answer: b


attributes taken collectively to uniquely identify a Explanation: Key is the constraint which specifies
record? uniqueness.
a) Candidate key
5. Which one of the following attribute can be taken as a
b) Sub key
primary key?
c) Super key
a) Name
d) Foreign key
b) Street
View Answer
c) Id
Answer: c d) Department
Explanation: Super key is the superset of all the keys in a View Answer
relation.
Answer: c
Explanation: The attributes name, street and
Page 2 of 139
department can repeat for some tuples. But the id d) Referred relation
attribute has to be unique. So it forms a primary key. View Answer

Sanfoundry Certification Contest of the Month is Live. Answer: c


100+ Subjects. Participate Now! Explanation: None.

6. Which one of the following cannot be taken as a 10. A _________ integrity constraint requires that the
primary key? values appearing in specified attributes of any tuple in
a) Id the referencing relation also appear in specified
b) Register number attributes of at least one tuple in the referenced
c) Dept_id relation.
d) Street a) Referential
View Answer b) Referencing
c) Specific
Answer: d
d) Primary
Explanation: Street is the only attribute which can occur
View Answer
more than once.
Answer: a
7. An attribute in a relation is a foreign key if the
Explanation: A relation, say r1, may include among its
_______ key from one relation is used as an attribute in
attributes the primary key of another relation, say r2.
that relation.
This attribute is called a foreign key from r1, referencing
a) Candidate
r2. The relation r1 is also called the referencing relation
b) Primary
of the foreign key dependency, and r2 is called the
c) Super
referenced relation of the foreign key.
d) Sub
View Answer atabase Questions and Answers – Relational Query
Operations and Relational Operators
Answer: b
Explanation: The primary key has to be referred in the This set of Database MCQs focuses on “Relational Query
other relation to form a foreign key in that relation. Operations and Relational Operators”.

8. The relation with the attribute which is the primary 1. Using which language can a user request information
key is referenced in another relation. The relation which from a database?
has the attribute as a primary key is called a) Query
______________ b) Relational
a) Referential relation c) Structural
b) Referencing relation d) Compiler
c) Referenced relation View Answer
d) Referred relation
Answer: a
View Answer
Explanation: Query language is a method through which
Answer: c the database entries can be accessed.
Explanation: None.
2. Student(ID, name, dept name, tot_cred)
9. The ______ is the one in which the primary key of In this query which attributes form the primary key?
one relation is used as a normal attribute in another a) Name
relation. b) Dept
a) Referential relation c) Tot_cred
b) Referencing relation d) ID
c) Referenced relation View Answer

Page 3 of 139
Answer: d c) Product
Explanation: The attributes name, dept and tot_cred can d) Intersect
have same values unlike ID. View Answer

3. Which one of the following is a procedural language? Answer: a


a) Domain relational calculus Explanation: Union just combines all the values of
b) Tuple relational calculus relations of same attributes.
c) Relational algebra
7. The most commonly used operation in relational
d) Query language
algebra for projecting a set of tuple from a relation is
View Answer
a) Join
Answer: c b) Projection
Explanation: Domain and Tuple relational calculus are c) Select
non-procedural language. Query language is a method d) Union
through which database entries can be accessed. View Answer

advertisement Answer: c
Explanation: Select is used to view the tuples of the
4. The_____ operation allows the combining of two
relation with or without some constraints.
relations by merging pairs of tuples, one from each
relation, into a single tuple. 8. The _______ operator takes the results of two queries
a) Select and returns only rows that appear in both result sets.
b) Join a) Union
c) Union b) Intersect
d) Intersection c) Difference
View Answer d) Projection
View Answer
Answer: b
Explanation: Join finds the common tuple in the Answer: b
relations and combines it. Explanation: The union operator gives the result which
is the union of two queries and difference is the one
5. The result which operation contains all pairs of tuples
where query which is not a part of second query.
from the two relations, regardless of whether their
attribute values match. 9. A ________ is a pictorial depiction of the schema of a
a) Join database that shows the relations in the database, their
b) Cartesian product attributes, and primary keys and foreign keys.
c) Intersection a) Schema diagram
d) Set difference b) Relational algebra
View Answer c) Database diagram
d) Schema flow
Answer: b
View Answer
Explanation: Cartesian product is the multiplication of
all the values in the attributes. Answer: a
Explanation: None.
Sanfoundry Certification Contest of the Month is Live.
100+ Subjects. Participate Now! 10. The _________ provides a set of operations that
take one or more relations as input and return a relation
6. The _______operation performs a set union of two
as an output.
“similarly structured” tables
a) Schematic representation
a) Union
b) Relational algebra
b) Join
c) Scheme diagram
Page 4 of 139
d) Relation flow d) Integrity constraint
View Answer View Answer

Answer: b Answer: b
Explanation: None. Explanation: Data Definition language is the language
which performs all the operation in defining structure of
Database Questions and Answers – SQL Basics and SQL
relation.
Data Definition
Subscribe Now: DBMS Newsletter | Important Subjects
This set of Database Multiple Choice Questions &
Newsletters
Answers (MCQs) focuses on “SQL Basics and SQL Data
Definition”. 4.

1. Which one of the following is used to define the SELECT * FROM employee
structure of the relation, deleting relations and relating
What type of statement is this?
schemas?
a) DML
a) DML(Data Manipulation Langauge)
b) DDL
b) DDL(Data Definition Langauge)
c) View
c) Query
d) Integrity constraint
d) Relational Schema
View Answer
View Answer
Answer: a
Answer: b
Explanation: Select operation just shows the required
Explanation: Data Definition language is the language
fields of the relation. So it forms a DML.
which performs all the operation in defining structure of
relation. 5. The basic data type char(n) is a _____ length
character string and varchar(n) is _____ length
2. Which one of the following provides the ability to
character.
query information from the database and to insert
a) Fixed, equal
tuples into, delete tuples from, and modify tuples in the
b) Equal, variable
database?
c) Fixed, variable
a) DML(Data Manipulation Langauge)
d) Variable, equal
b) DDL(Data Definition Langauge)
View Answer
c) Query
d) Relational Schema Answer: c
View Answer Explanation: Varchar changes its length accordingly
whereas char has a specific length which has to be filled
Answer: a
by either letters or spaces.
Explanation: DML performs the change in the values of
the relation. 6. An attribute A of datatype varchar(20) has the value
“Avi”. The attribute B of datatype char(20) has value
3.
”Reed”. Here attribute A has ____ spaces and attribute B
advertisement has ____ spaces.
a) 3, 20
CREATE TABLE employee (name VARCHAR, id INTEGER)
b) 20, 4
What type of statement is this? c) 20, 20
a) DML d) 3, 4
b) DDL View Answer
c) View
Answer: a
Explanation: Varchar changes its length accordingly
Page 5 of 139
whereas char has a specific length which has to be filled Answer: a
by either letters or spaces. Explanation: Integrity constraint has to be maintained in
the entries of the relation.
7. To remove a relation from an SQL database, we use
the ______ command. Database Questions and Answers – SQL Queries
a) Delete
This set of Database Multiple Choice Questions &
b) Purge
Answers (MCQs) focuses on “SQL Queries”.
c) Remove
d) Drop table 1.
View Answer

Answer: d Name
Explanation: Drop table deletes the whole structure of
the relation .purge removes the table which cannot be Annie
obtained again.

8. Bob
DELETE FROM r; //r - relation

This command performs which of the following action? Callie


a) Remove relation
b) Clear relation entries Derek
c) Delete fields
d) Delete rows
Which of these query will display the the table given
View Answer
above ?
Answer: b a) Select employee from name
Explanation: Delete command removes the entries in b) Select name
the table. c) Select name from employee
d) Select employee
9. View Answer
INSERT INTO instructor VALUES (10211, ’Smith’, Answer: c
’Biology’, 66000); Explanation: The field to be displayed is included in
What type of statement is this? select and the table is included in the from clause.
a) Query 2. Here which of the following displays the unique
b) DML values of the column?
c) Relational
d) DDL advertisement
View Answer
SELECT ________ dept_name
Answer: b FROM instructor;
Explanation: The values are manipulated. So it is a DML.
a) All
10. Updates that violate __________ are disallowed. b) From
a) Integrity constraints c) Distinct
b) Transaction control
d) Name
c) Authorization View Answer
d) DDL constraints
View Answer

Page 6 of 139
Answer: c 6. This Query can be replaced by which one of the
Explanation: Distinct keyword selects only the entries following?
that are unique.
SELECT name, course_id
Sanfoundry Certification Contest of the Month is Live.
FROM instructor, teaches
100+ Subjects. Participate Now!
WHERE instructor_ID= teaches_ID;
3. The ______ clause allows us to select only those rows
in the result relation of the ____ clause that satisfy a a) Select name,course_id from teaches,instructor where
specified predicate. instructor_id=course_id;
a) Where, from b) Select name, course_id from instructor natural join
b) From, select teaches;
c) Select, from c) Select name, course_id from instructor;
d) From, where d) Select course_id from instructor join teaches;
View Answer View Answer
Answer: a Answer: b
Explanation: Where selects the rows on a particular Explanation: Join clause joins two tables by matching
condition. From gives the relation which involves the the common column.
operation.
7.
4. The query given below will not give an error. Which
one of the following has to be replaced to get the SELECT * FROM employee WHERE salary>10000 AND
desired output? dept_id=101;

SELECT ID, name, dept name, salary * 1.1 Which of the following fields are displayed as output?
a) Salary, dept_id
WHERE instructor; b) Employee
c) Salary
a) Salary*1.1
d) All the field of employee relation
b) ID
View Answer
c) Where
d) Instructor Answer: d
View Answer Explanation: Here * is used to select all the fields of the
relation.
Answer: c
Explanation: Where selects the rows on a particular 8.
condition. From gives the relation which involves the
operation. Since Instructor is a relation it has to have Employee_id
from clause.

5. The ________ clause is used to list the attributes 1001


desired in the result of a query.
a) Where
b) Select 1009
c) From
d) Distinct 1018
View Answer

Answer: b This is Employee table.


Explanation: None Which of the following employee_id will be displayed
for the given query?
Page 7 of 139
SELECT * FROM employee WHERE employee_id>1009; WHERE [Link]= [Link];

a) 1009, 1001, 1018 Which keyword must be used here to rename the field
b) 1009, 1018 name?
c) 1001 a) From
d) 1018 b) Rename
View Answer c) As
d) Join
Answer: d
View Answer
Explanation: Greater than symbol does not include the
given value unlike >=. Answer: c
Explanation: As keyword is used to rename.
9. Which of the following statements contains an error?
a) Select * from emp where empid = 10003; advertisement
b) Select empid from emp where empid = 10006;
2.
c) Select empid from emp;
d) Select empid where empid = 1009 and lastname = SELECT * FROM employee WHERE dept_name="Comp
‘GELLER’; Sci";
View Answer
In the SQL given above there is an error . Identify the
Answer: d error.
Explanation: This query do not have from clause which a) Dept_name
specifies the relation from which the values has to be b) Employee
selected. c) “Comp Sci”
d) From
10. In the given query which of the keyword has to be
View Answer
inserted?
Answer: c
INSERT INTO employee _____ (1002,Joey,2000);
Explanation: For any string operations single quoted(‘)
a) Table must be used to enclose.
b) Values
Sanfoundry Certification Contest of the Month is Live.
c) Relation
100+ Subjects. Participate Now!
d) Field
View Answer 3.
Answer: b SELECT emp_name
Explanation: Value keyword has to be used to insert the
values into the table. FROM department

Sanfoundry Global Education & Learning Series – WHERE dept_name LIKE ’ _____ Computer Science’;
Database Management Syste Which one of the following has to be added into the
Database Questions and Answers – Basic SQL blank to select the dept_name which has Computer
Operations Science as its ending string?
a) %
This set of Database Multiple Choice Questions & b) _
Answers (MCQs) focuses on “Basic SQL Operations”. c) ||
d) $
1.
View Answer
SELECT name ____ instructor name, course id
Answer: a
FROM instructor, teaches Explanation: The % character matches any substring.
Page 8 of 139
4. ’_ _ _ ’ matches any string of ______ three characters. 7.
’_ _ _ %’ matches any string of at ______ three
SELECT name
characters.
a) Atleast, Exactly FROM instructor
b) Exactly, Atleast
c) Atleast, All WHERE salary <= 100000 AND salary >= 90000;
d) All, Exactly This query can be replaced by which of the following ?
View Answer a)
Answer: b SELECT name
Explanation: None.
FROM instructor
5.
WHERE salary BETWEEN 90000 AND 100000;
SELECT name
b)
FROM instructor
SELECT name
WHERE dept name = ’Physics’
FROM employee
ORDER BY name;
WHERE salary <= 90000 AND salary>=100000;
By default, the order by clause lists items in ______
order. c)
a) Descending SELECT name
b) Any
c) Same FROM employee
d) Ascending
WHERE salary BETWEEN 90000 AND 100000;
View Answer
d)
Answer: d
Explanation: Specification of descending order is SELECT name
essential but it not for ascending.
FROM instructor
6.
WHERE salary BETWEEN 100000 AND 90000;
SELECT *
View Answer
FROM instructor
Answer: a
ORDER BY salary ____, name ___; Explanation: SQL includes a between comparison
operator to simplify where clauses that specify that a
To display the salary from greater to smaller and name
value be less than or equal to some value and greater
in ascending order which of the following options
than or equal to some other value.
should be used?
a) Ascending, Descending
b) Asc, Desc
c) Desc, Asc
8.
d) Descending, Ascending
View Answer SELECT instructor.*
Answer: c FROM instructor, teaches
Explanation: None.
WHERE [Link]= [Link];
Page 9 of 139
This query does which of the following operation? 2. The intersection operator is used to get the _____
a) All attributes of instructor and teaches are selected tuples.
b) All attributes of instructor are selected on the given a) Different
condition b) Common
c) All attributes of teaches are selected on given c) All
condition d) Repeating
d) Only the some attributes from instructed and teaches View Answer
are selected
Answer: b
View Answer
Explanation: Intersection operator ignores unique tuples
Answer: b and takes only common ones.
Explanation: The asterisk symbol “ * ” can be usedin the
3. The union operation automatically __________ unlike
select clause to denote “all attributes.”
the select clause.
9. In SQL the spaces at the end of the string are a) Adds tuples
removed by _______ function. b) Eliminates unique tuples
a) Upper c) Adds common tuples
b) String d) Eliminates duplicate
c) Trim View Answer
d) Lower
Answer: d
View Answer
Explanation: None.
Answer: c
advertisement
Explanation: The syntax of trim is Trim(s); where s-
string. 4. If we want to retain all duplicates, we must write
________ in place of union.
10. _____ operator is used for appending two strings.
a) Union all
a) &
b) Union some
b) %
c) Intersect all
c) ||
d) Intersect some
d) _
View Answer
View Answer
Answer: a
Answer: c
Explanation: Union all will combine all the tuples
Explanation: || is the concatenation operator.
including duplicates.

5.
Database Questions and Answers – Set Operations
Sanfoundry Certification Contest of the Month is Live.
This set of Database Multiple Choice Questions & 100+ Subjects. Participate Now!
Answers (MCQs) focuses on “Set Operations”.
(SELECT course id
1. The union operation is represented by
FROM SECTION
a) ∩
b) U WHERE semester = ’Fall’ AND YEAR= 2009)
c) –
d) * EXCEPT
View Answer (SELECT course id
Answer: b FROM SECTION
Explanation: Union operator combines the relations.
Page 10 of 139
WHERE semester = ’Spring’ AND YEAR= 2010); Answer: c
Explanation: Having is used to provide additional
This query displays
aggregate filtration to the query.
a) Only tuples from second part
b) Only tuples from the first part which has the tuples 9. _________ joins are SQL server default
from second part a) Outer
c) Tuples from both the parts b) Inner
d) Tuples from first part which do not have second part c) Equi
View Answer d) None of the mentioned
View Answer
Answer: d
Explanation: Except keyword is used to ignore the Answer: b
values. Explanation: It is optional to give the inner keyword with
the join as it is default.
6. For like predicate which of the following is true.
10. The _____________ is essentially used to search for
i) % matches zero OF more characters.
patterns in target string.
ii) _ matches exactly one CHARACTER. a) Like Predicate
b) Null Predicate
a) i-only c) In Predicate
b) ii-only d) Out Predicate
c) i & ii View Answer
d) None of the mentioned
View Answer Answer: a
Explanation: Like predicate matches the string in the
Answer: c given pattern.
Explanation: The % wildcard matches zero or more
characters, while the _ wildcard matches exactly one Database Questions and Answers – Null Values
character. Together, they offer flexibility and precision in Operations
pattern matching within the like predicate.
This set of Database Multiple Choice Questions &
7. The number of attributes in relation is called as its Answers (MCQs) focuses on “Null Values Operations”.
a) Cardinality
1. A _____ indicates an absent value that may exist but
b) Degree
be unknown or that may not exist at all.
c) Tuples
a) Empty tuple
d) Entity
b) New value
View Answer
c) Null value
Answer: b d) Old value
Explanation: None. View Answer

8. _____ clause is an additional filter that is applied to Answer: c


the result. Explanation: None.
a) Select
2. If the attribute phone number is included in the
b) Group-by
relation all the values need not be entered into the
c) Having
phone number column. This type of entry is given as
d) Order by
a) 0
View Answer
b) –
c) Null

Page 11 of 139
d) Empty space Answer: b
View Answer Explanation: Not null constraint removes the tuples of
null values.
Answer: c
Explanation: Null is used to represent the absence of a 6. Using the ______ clause retains only one copy of such
value. identical tuples.
a) Null
3. The predicate in a where clause can involve Boolean
b) Unique
operations such as and. The result of true and unknown
c) Not null
is_______ false and unknown is _____ while unknown
d) Distinct
and unknown is _____
View Answer
a) Unknown, unknown, false
b) True, false, unknown Answer: d
c) True, unknown, unknown Explanation: Unique is a constraint.
d) Unknown, false, unknown
7.
View Answer
CREATE TABLE employee (id INTEGER,name
Answer: d
VARCHAR(20),salary NOT NULL);
Explanation: None.
INSERT INTO employee VALUES (1005,Rach,0);
advertisement
INSERT INTO employee VALUES (1007,Ross, );
4.
INSERT INTO employee VALUES (1002,Joey,335);
SELECT name
Some of these insert statements will produce an error.
FROM instructor
Identify the statement.
WHERE salary IS NOT NULL; a) Insert into employee values (1005,Rach,0);
b) Insert into employee values (1002,Joey,335);
Selects
c) Insert into employee values (1007,Ross, );
a) Tuples with null value d) None of the mentioned
b) Tuples with no null values View Answer
c) Tuples with any salary
Answer: c
d) All of the mentioned
Explanation: Not null constraint is specified which
View Answer
means sone value (can include 0 also) should be given.
Answer: b
8. The primary key must be
Explanation: Not null constraint removes the tpules of
a) Unique
null values.
b) Not null
Sanfoundry Certification Contest of the Month is Live. c) Both Unique and Not null
100+ Subjects. Participate Now! d) Either Unique or Not null
View Answer
5. In an employee table to include the attributes whose
value always have some value which of the following Answer: c
constraint must be used? Explanation: Primary key must satisfy unique and not
a) Null null condition for sure.
b) Not null
9. You attempt to query the database with this
c) Unique
command:
d) Distinct
View Answer SELECT nvl (100 / quantity, NONE)

Page 12 of 139
FROM inventory; Which of the following should be used to find the mean
of the salary ?
Why does this statement cause an error when
a) Mean(salary)
QUANTITY values are null?
b) Avg(salary)
a) The expression attempts to divide by a null value
c) Sum(salary)
b) The data types in the conversion function are
d) Count(salary)
incompatible
View Answer
c) The character string none should be enclosed in single
quotes (‘ ‘) Answer: b
d) A null value used in an expression cannot be Explanation: Avg() is used to find the mean of the
converted to an actual value values.
View Answer
advertisement
Answer: a
3.
Explanation: The expression attempts to divide by a null
value is erroneous in sql. Note: Join free Sanfoundry classes
at Telegram or Youtube
10. The result of _____unknown is unknown.
a) Xor SELECT COUNT (____ ID)
b) Or
c) And FROM teaches
d) Not WHERE semester = ’Spring’ AND YEAR = 2010;
View Answer
If we do want to eliminate duplicates, we use the
Answer: d keyword ______in the aggregate expression.
Explanation: Since unknown does not hold any value the a) Distinct
value cannot have a reverse value. b) Count
Database Questions and Answers – Aggregate c) Avg
Functions and Nested Subqueries – 1 d) Primary key
View Answer
This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “Aggregate Functions and Answer: a
Nested Subqueries – 1”. Explanation: Distinct keyword is used to select only
unique items from the relation.
1. Aggregate functions are functions that take a
___________ as input and return a single value. 4. All aggregate functions except _____ ignore null
a) Collection of values values in their input collection.
b) Single value a) Count(attribute)
c) Aggregate value b) Count(*)
d) Both Collection of values & Single value c) Avg
View Answer d) Sum
View Answer
Answer: a
Explanation: None. Answer: b
Explanation: * is used to select all values including null.
2.
5. A Boolean data type that can take values true, false,
SELECT __________ and________
a) 1
FROM instructor
b) 0
WHERE dept name= ’Comp. Sci.’; c) Null
Page 13 of 139
d) Unknown SELECT COUNT (DISTINCT ID)
View Answer
FROM takes
Answer: d
WHERE (course id, sec id, semester, YEAR) IN (SELECT
Explanation: Unknown values do not take null value but
course id, sec id, semester, YEAR
it is not known.
FROM teaches
6. The ____ connective tests for set membership, where
the set is a collection of values produced by a select WHERE [Link]= 10101);
clause. The ____ connective tests for the absence of set
membership. View Answer
a) Or, in Answer: a
b) Not in, in Explanation: None.
c) In, not in
d) In, or
View Answer

Answer: c 8. The phrase “greater than at least one” is represented


Explanation: In checks, if the query has the value but in SQL by _____
not in checks if it does not have the value. a) < all
b) < some
7. Which of the following should be used to find all the c) > all
courses taught in the Fall 2009 semester but not in the d) > some
Spring 2010 semester . View Answer
a)
Answer: d
SELECT DISTINCT course id Explanation: >some takes atlest one value above it .
FROM SECTION 9. Which of the following is used to find all courses
WHERE semester = ’Fall’ AND YEAR= 2009 AND taught in both the Fall 2009 semester and in the Spring
2010 semester .
course id NOT IN (SELECT course id a)
FROM SECTION SELECT course id
WHERE semester = ’Spring’ AND YEAR= 2010); FROM SECTION AS S
b) WHERE semester = ’Fall’ AND YEAR= 2009 AND
SELECT DISTINCT course_id EXISTS (SELECT *
FROM instructor FROM SECTION AS T
WHERE name NOT IN (’Fall’, ’Spring’); WHERE semester = ’Spring’ AND YEAR= 2010 AND
c) [Link] id= [Link] id);
(SELECT course id b)
FROM SECTION SELECT name
WHERE semester = ’Spring’ AND YEAR= 2010) FROM instructor
d) WHERE salary > SOME (SELECT salary

Page 14 of 139
FROM instructor SELECT dept_name, ID, avg (salary)

WHERE dept name = ’Biology’); FROM instructor

c) GROUP BY dept_name;

SELECT COUNT (DISTINCT ID) This statement IS erroneous because

FROM takes a) Avg(salary) should not be selected


b) Dept_id should not be used in group by clause
WHERE (course id, sec id, semester, YEAR) IN (SELECT
c) Misplaced group by clause
course id, sec id, semester, YEAR
d) Group by clause is not valid in this query
FROM teaches View Answer

WHERE [Link]= 10101); Answer: b


Explanation: Any attribute that is not present in the
d) group by clause must appear only inside an aggregate
(SELECT course id function if it appears in the select clause, otherwise the
query is treated as erroneous.
FROM SECTION
advertisement
WHERE semester = ’Spring’ AND YEAR= 2010)
2. SQL applies predicates in the _______ clause after
View Answer groups have been formed, so aggregate functions may
Answer: a be used.
Explanation: None. a) Group by
b) With
c) Where
d) Having
View Answer
10. We can test for the nonexistence of tuples in a
subquery by using the _____ construct. Answer: d
a) Not exist Explanation: The Having clause in SQL is used to apply
b) Not exists predicates after groups have been formed using the
c) Exists Group By clause. This allows aggregate functions to be
d) Exist used and filters the grouped data based on specified
View Answer conditions.
Answer: b 3. Aggregate functions can be used in the select list or
Explanation: Exists is used to check for the existence of the_______clause of a select statement or subquery.
tuples. They cannot be used in a ______ clause.
a) Where, having
Sanfoundry Global Education & Learning Series –
b) Having, where
Database Managem
c) Group by, having
Database Questions and Answers – Aggregate d) Group by, where
Functions and Nested Subqueries – 2 View Answer

This set of Database Interview Questions and Answers Answer: b


focuses on “Aggregate Functions and Nested Subqueries Explanation: To include aggregate functions having
– 2”. clause must be included after where.
1.

Page 15 of 139
Sanfoundry Certification Contest of the Month is Live. In the query given above which one of the following is a
100+ Subjects. Participate Now! temporary relation?
a) Budget
4. The ________ keyword is used to access attributes of
b) Department
preceding tables or subqueries in the from clause.
c) Value
a) In
d) Max_budget
b) Lateral
View Answer
c) Having
d) With Answer: d
View Answer Explanation: With clause creates a temporary relation.

Answer: b 7. Subqueries cannot:


Explanation: a) Use group by or group functions
b) Retrieve data from a table different from the one in
Eg : SELECT name, salary, avg salary
the outer query
FROM instructor I1, lateral (SELECT avg(salary) AS c) Join tables
avg salary d) Appear in select, update, delete, insert statements.
View Answer
FROM instructor I2
Answer: c
WHERE [Link] name= [Link] name); Explanation: None.
Without the lateral clause, the subquery cannot access 8. Which of the following is not an aggregate function?
the correlation variable a) Avg
I1 from the outer query. b) Sum
5. Which of the following creates a temporary relation c) With
for the query on which it is defined? d) Min
a) With View Answer
b) From Answer: c
c) Where Explanation: With is used to create temporary relation
d) Select and its not an aggregate function.
View Answer
9. The EXISTS keyword will be true if:
Answer: a a) Any row in the subquery meets the condition only
Explanation: The with clause provides a way of defining b) All rows in the subquery fail the condition only
a temporary relation whose definition is available only c) Both of these two conditions are met
to the query in which the with clause occurs. d) Neither of these two conditions is met
6. View Answer

WITH max_budget (VALUE) AS Answer: a


Explanation: EXISTS keyword checks for existance of a
(SELECT MAX(budget) condition.
FROM department) 10. How can you find rows that do not match some
SELECT budget specified condition?
a) EXISTS
FROM department, max_budget b) Double use of NOT EXISTS
c) NOT EXISTS
WHERE [Link] = MAX [Link];
d) None of the mentioned
View Answer
Page 16 of 139
Answer: b Note: Join free Sanfoundry classes
Explanation: None. at Telegram or Youtube

Database Questions and Answers – Modification of INSERT INTO course (course id, title, dept name,
Database credits)

This set of Database Multiple Choice Questions & VALUES (’CS-437’, ’DATABASE Systems’, ’Comp. Sci.’, 4);
Answers (MCQs) focuses on “Modification of Database”.
b)
1. A Delete command operates on ______ relation.
INSERT INTO instructor
a) One
b) Two SELECT ID, name, dept name, 18000
c) Several
d) Null FROM student
View Answer WHERE dept name = ’Music’ AND tot cred > 144;
Answer: a c)
Explanation: Delete can delete from only one table at a
time. INSERT INTO course VALUES (’CS-437’, ’DATABASE
Systems’, ’Comp. Sci.’, 4);
2.
d) Not possible
Delete from r where P; View Answer
The above command Answer: b
a) Deletes a particular tuple from the relation Explanation: Using select statement in insert will include
b) Deletes the relation rows which are the result of the selection.
c) Clears all entries from the relation
d) All of the mentioned 5. Which of the following deletes all tuples in the
View Answer instructor relation for those instructors associated with
a department located in the Watson building which is in
Answer: a department relation.
Explanation: Here P gives the condition for deleting a)
specific rows.
DELETE FROM instructor
advertisement
WHERE dept_name IN 'Watson';
3. Which one of the following deletes all the entries but
keeps the structure of the relation. b)
a) Delete from r where P; DELETE FROM department
b) Delete from instructor where dept name= ’Finance’;
c) Delete from instructor where salary between 13000 WHERE building='Watson';
and 15000;
c)
d) Delete from instructor;
View Answer DELETE FROM instructor

Answer: d WHERE dept_name IN (SELECT dept name


Explanation: Absence of condition deletes all rows.
FROM department
4. Which of the following is used to insert a tuple from
WHERE building = ’Watson’);
another relation?
a) d) None of the mentioned
View Answer
Page 17 of 139
Answer: c ...
Explanation: The query must include building=watson
WHEN predn ... resultn
condition to filter the tuples.
ELSE result0
6.
END
UPDATE instructor
b)
_____ salary= salary * 1.05;
CASE
Fill in with correct keyword to update the instructor
relation. WHEN pred1 THEN result1
a) Where
b) Set WHEN pred2 THEN result2
c) In ...
d) Select
View Answer WHEN predn THEN resultn

Answer: b ELSE result0


Explanation: Set is used to update the particular value. END
7. _________ are useful in SQL update statements, c)
where they can be used in the set clause.
a) Multiple queries CASE
b) Sub queries
WHEN pred1 THEN result1
c) Update
d) Scalar subqueries WHEN pred2 THEN result2
View Answer
...
Answer: d
WHEN predn THEN resultn
Explanation: None.
ELSE result0
8. The problem of ordering the update in multiple
updates is avoided using d) All of the mentioned
a) Set View Answer
b) Where
c) Case Answer: b
d) When Explanation: None.
View Answer 10. Which of the following relation updates all
Answer: c instructors with salary over $100,000 receive a 3
Explanation: The case statements can add the order of percent raise, whereas all others receive a 5 percent
updating tuples. raise.
a)
9. Which of the following is the correct format for case
statements. UPDATE instructor
a) SET salary = salary * 1.03
CASE WHERE salary > 100000;
WHEN pred1 ... result1 UPDATE instructor
WHEN pred2 ... result2 SET salary = salary * 1.05
Page 18 of 139
WHERE salary <= 100000; b) Right outer join
c) Inner join
b)
d) Natural join
UPDATE instructor View Answer

SET salary = salary * 1.05 Answer: c


Explanation: INNER JOIN: Returns all rows when there is
WHERE salary < (SELECT avg (salary) at least one match in BOTH tables.
FROM instructor); 3.
c) advertisement
UPDATE instructor SELECT *
SET salary = CASE FROM student JOIN takes USING (ID);
WHEN salary <= 100000 THEN salary * 1.03 The above query is equivalent to
ELSE salary * 1.05 a)

END Sanfoundry Certification Contest of the Month is Live.


100+ Subjects. Participate Now!
d) None of the mentioned
View Answer SELECT *

Answer: a FROM student INNER JOIN takes USING (ID);


Explanation: The order of the two update statements is b)
important. If we changed the order of the two
statements, an instructor with a salary just under SELECT *
$100,000 would receive an over 8 percent raise. SQL
FROM student OUTER JOIN takes USING (ID);
provides a case construct that we can use to perform
both the updates with a single update statement, c)
avoiding the problem with the order of updates.
SELECT *
Database Questions and Answers – Join Expressions
FROM student LEFT OUTER JOIN takes USING (ID);
This set of Database Multiple Choice Questions &
d) None of the mentioned
Answers (MCQs) focuses on “Join Expressions”.
View Answer
1. The____condition allows a general predicate over the
Answer: a
relations being joined.
Explanation: Join can be replaced by inner join.
a) On
b) Using 4. What type of join is needed when you wish to include
c) Set rows that do not have matching values?
d) Where a) Equi-join
View Answer b) Natural join
c) Outer join
Answer: a
d) All of the mentioned
Explanation: On gives the condition for the join
View Answer
expression.
Answer: c
2. Which of the join operations do not preserve non
Explanation: An outer join does not require each record
matched tuples?
in the two joined tables to have a matching record..
a) Left outer join
Page 19 of 139
5. How many tables may be included with a join? d) Cross product
a) One View Answer
b) Two
Answer: a
c) Three
Explanation: None.
d) All of the mentioned
View Answer 10. In SQL the statement select * from R, S is equivalent
to
Answer: d
a) Select * from R natural join S
Explanation: Join can combine multiple tables.
b) Select * from R cross join S
6. Which are the join types in join condition: c) Select * from R union join S
a) Cross join d) Select * from R inner join S
b) Natural join View Answer
c) Join with USING clause
Answer: b
d) All of the mentioned
Explanation: None.
View Answer
• st
Answer: d
Explanation: There are totally four join types in SQL. o

7. How many join types in join condition: o


a) 2
b) 3 o
c) 4 • Job
d) 5
View Answer o

Answer: d o
Explanation: Types are inner join, left outer join, right • Internship
outer join, full join, cross join.
o
8. Which join refers to join records from the right table
that have no matching key in the left table are include in o
the result set:
• Training
a) Left outer join
b) Right outer join • Videos
c) Full outer join
o
d) Half outer join
View Answer o

Answer: b o
Explanation: RIGHT OUTER JOIN: Return all rows from
• Books
the right table and the matched rows from the left
table. • Contact
9. The operation which is not considered a basic Database Questions and Answers – Views
operation of relational algebra is
a) Join This set of Database Multiple Choice Questions &
b) Selection Answers (MCQs) focuses on “Views”.
c) Union 1. Which of the following creates a virtual relation for
storing the query?
Page 20 of 139
a) Function d) View is deleted after specified time
b) View View Answer
c) Procedure
Answer: b
d) None of the mentioned
Explanation: None.
View Answer
5. Updating the value of the view
Answer: b
a) Will affect the relation from which it is defined
Explanation: Any such relation that is not part of the
b) Will not change the view definition
logical model, but is made visible to a user as a virtual
c) Will not affect the relation from which it is defined
relation, is called a view.
d) Cannot determine
2. Which of the following is the syntax for views where v View Answer
is view name?
Answer: a
a) Create view v as “query name”;
Explanation: None.
b) Create “query expression” as view;
c) Create view v as “query expression”; 6. SQL view is said to be updatable (that is, inserts,
d) Create view “query expression”; updates or deletes can be applied on the view) if which
View Answer of the following conditions are satisfied by the query
defining the view?
Answer: c
a) The from clause has only one database relation
Explanation: <query expression> is any legal query
b) The query does not have a group by or having clause
expression. The view name is represented by v.
c) The select clause contains only attribute names of the
3. relation and does not have any expressions, aggregates,
or distinct specification
advertisement
d) All of the mentioned
SELECT course_id View Answer

FROM physics_fall_2009 Answer: d


Explanation: All of the conditions must be satisfied to
WHERE building= ’Watson’; update the view in sql.
Here the tuples are selected from the [Link] one 7. Which of the following is used at the end of the view
denotes the view. to reject the tuples which do not satisfy the condition in
a) Course_id where clause?
b) Watson a) With
c) Building b) Check
d) physics_fall_2009 c) With check
View Answer d) All of the mentioned
Answer: c View Answer
Explanation: View names may appear in a query any Answer: c
place where a relation name may appear. Explanation: Views can be defined with a with check
Sanfoundry Certification Contest of the Month is Live. option clause at the end of the view definition; then, if a
100+ Subjects. Participate Now! tuple inserted into the view does not satisfy the view’s
where clause condition, the insertion is rejected by the
4. Materialised views make sure that database system.
a) View definition is kept stable
b) View definition is kept up-to-date 8. Consider the two relations instructor and department
c) View definition is verified for error Instructor:

Page 21 of 139
SELECT ID, name, building
ID Name Dept_name
FROM department;

1001 Ted View Answer


Finance
Answer: a
1002 Bob Explanation: None.
Music

1003 Ron Physics


9. For the view Create view instructor_info as
Department:
SELECT ID, name, building
Dept_name Building
FROM instructor, department B

WHERE [Link] name=


Biology Watson name;
[Link] 4

If we insert tuple into the view as insert into instructor


Chemistry info valuesPainter
(’69987’, ’White’, ’Taylor’); 3
What will be the values of the other attributes in
Music instructorTaylor
and department relations? 5
a) Default value
Which of the following is used to create view for these b) Null
relations together? c) Error statement
a) d) 0
View Answer
CREATE VIEW instructor_info AS
Answer: b
SELECT ID, name, building Explanation: The values take null if there is no constraint
in the attribute else it is an Erroneous statement.
FROM instructor, department
10.
WHERE [Link] name= [Link] name;
CREATE VIEW faculty AS
b)
SELECT ID, name, dept name
CREATE VIEW instructor_info
FROM instructor;
SELECT ID, name, building
Find the error in this query.
FROM instructor, department;
a) Instructor
c) b) Select
c) View …as
CREATE VIEW instructor_info AS
d) None of the mentioned
SELECT ID, name, building View Answer

FROM instructor; Answer: d


Explanation: Syntax is – create view v as <query
d) expression>;.
CREATE VIEW instructor_info AS Database Questions and Answers – Transactions
Page 22 of 139
This set of Database Multiple Choice Questions & b) Clears all transactions
Answers (MCQs) focuses on “Transactions”. c) Redoes the transactions before commit
d) No action
1. A _________ consists of a sequence of query and/or
View Answer
update statements.
a) Transaction Answer: d
b) Commit Explanation: Once a transaction has executed commit
c) Rollback work, its effects can no longer be undone by rollback
d) Flashback work.
View Answer
Subscribe Now: DBMS Newsletter | Important Subjects
Answer: a Newsletters
Explanation: Transaction is a set of operation until
5. In case of any shut down during transaction before
commit.
commit which of the following statement is done
2. Which of the following makes the transaction automatically?
permanent in the database? a) View
a) View b) Commit
b) Commit c) Rollback
c) Rollback d) Flashback
d) Flashback View Answer
View Answer
Answer: c
Answer: b Explanation: Once a transaction has executed commit
Explanation: Commit work commits the current work, its effects can no longer be undone by rollback
transaction. work.

3. In order to undo the work of transaction after last 6. In order to maintain the consistency during
commit which one should be used? transactions, database provides
a) View a) Commit
b) Commit b) Atomic
c) Rollback c) Flashback
d) Flashback d) Retain
View Answer View Answer

Answer: c Answer: b
Explanation: Rollback work causes the current Explanation: By atomic, either all the effects of the
transaction to be rolled back; that is, it undoes all the transaction are reflected in the database, or none are
updates performed by the SQL statements in the (after rollback).
transaction.
7. Transaction processing is associated with everything
advertisement below except
a) Conforming an action or triggering a response
4. Consider the following action:
b) Producing detail summary or exception report
TRANSACTION..... c) Recording a business activity
d) Maintaining a data
Commit; View Answer
ROLLBACK; Answer: a
What does Rollback do? Explanation: None.
a) Undoes the transactions before commit
Page 23 of 139
8. A transaction completes its execution is said to be 2. Which of the following is not an integrity constraint?
a) Committed a) Not null
b) Aborted b) Positive
c) Rolled back c) Unique
d) Failed d) Check ‘predicate’
View Answer View Answer

Answer: a Answer: b
Explanation: A complete transaction always commits. Explanation: Positive is a value and not a constraint.

9. Which of the following is used to get back all the 3.


transactions back after rollback?
advertisement
a) Commit
b) Rollback CREATE TABLE Employee(Emp_id NUMERIC NOT NULL,
c) Flashback Name VARCHAR(20) , dept_name VARCHAR(20), Salary
d) Redo NUMERIC UNIQUE(Emp_id,Name));
View Answer
INSERT INTO Employee VALUES(1002, Ross, CSE, 10000)
Answer: c
Explanation: None. INSERT INTO Employee VALUES(1006,Ted,Finance, );

10. ______ will undo all statements up to commit? INSERT INTO Employee VALUES(1002,Rita,Sales,20000);
a) Transaction What will be the result of the query?
b) Flashback a) All statements executed
c) Rollback b) Error in create statement
d) Abort c) Error in insert into Employee
View Answer values(1006,Ted,Finance, );
Answer: c d) Error in insert into Employee
Explanation: Flashback will undo all the statements and values(1008,Ross,Sales,20000);
Abort will terminate the operation. View Answer

Database Questions and Answers – Integrity Answer: d


Constraints Explanation: The not null specification prohibits the
insertion of a null value for the attribute.
This set of Database Multiple Choice Questions & The unique specification says that no two tuples in the
Answers (MCQs) focuses on “Integrity Constraints”. relation can be equal on all the listed attributes.
1. To include integrity constraint in an existing relation 4.
use :
a) Create table Sanfoundry Certification Contest of the Month is Live.
b) Modify table 100+ Subjects. Participate Now!
c) Alter table CREATE TABLE Manager(ID NUMERIC,Name
d) Drop table VARCHAR(20),budget NUMERIC,Details VARCHAR(30));
View Answer
Inorder to ensure that the value of budget is non-
Answer: c negative which of the following should be used?
Explanation: SYNTAX – alter table table-name add a) Check(budget>0)
constraint, where constraint can be any constraint on b) Check(budget<0)
the relation. c) Alter(budget>0)

Page 24 of 139
d) Alter(budget<0) Answer: c
View Answer Explanation: An assertion is a predicate expressing a
condition we wish the database to always satisfy.
Answer: a
Explanation: A common use of the check clause is to 8. Which of the following is the right syntax for the
ensure that attribute values satisfy specified conditions, assertion?
in effect creating a powerful type system. a) Create assertion ‘assertion-name’ check ‘predicate’;
b) Create assertion check ‘predicate’ ‘assertion-name’;
5. Foreign key is the one in which the ________ of one
c) Create assertions ‘predicates’;
relation is referenced in another relation.
d) All of the mentioned
a) Foreign key
View Answer
b) Primary key
c) References Answer: a
d) Check constraint Explanation: None.
View Answer
9. Data integrity constraints are used to:
Answer: b a) Control who is allowed access to the data
Explanation: The foreign-key declaration specifies that b) Ensure that duplicate records are not entered into the
for each course tuple, the department name specified in table
the tuple must exist in the department relation. c) Improve the quality of data entered for a specific
property (i.e., table column)
6.
d) Prevent users from changing the values stored in the
CREATE TABLE course table
View Answer
(...
Answer: c
FOREIGN KEY (dept name) REFERENCES department Explanation: None.
. . . ); 10. Which of the following can be addressed by
Which of the following is used to delete the entries in enforcing a referential integrity constraint?
the referenced table when the tuple is deleted in course a) All phone numbers must include the area code
table? b) Certain fields are required (such as the email address,
a) Delete or phone number) before the record is accepted
b) Delete cascade c) Information on the customer must be known before
c) Set null anything can be sold to that customer
d) All of the mentioned d) When entering an order quantity, the user must input
View Answer a number and not some text (i.e., 12 rather than ‘a
dozen’)
Answer: b View Answer
Explanation: The delete “cascades” to the course
relation, deletes the tuple that refers to the department Answer: c
that was deleted. Explanation: The information can be referred to and
obtained.
7. Domain constraints, functional dependency and
referential integrity are special forms of _________
a) Foreign key
b) Primary key
c) Assertion
d) Referential constraint
Database Questions and Answers – SQL Data Types and
View Answer
Schemas
Page 25 of 139
This set of Database Multiple Choice Questions & c) Binary
Answers (MCQs) focuses on “SQL Data Types and d) Image
Schemas”. View Answer

1. Dates must be specified in the format Answer: b


a) mm/dd/yy Explanation: SQL therefore provides large-object data
b) yyyy/mm/dd types for character data (clob) and binary data (blob).
c) dd/mm/yy The letters “lob” in these data types stand for “Large
d) yy/dd/mm OBject”.
View Answer
Sanfoundry Certification Contest of the Month is Live.
Answer: b 100+ Subjects. Participate Now!
Explanation: yyyy/mm/dd is the default format in sql.
5. The user defined data type can be created using
2. A ________ on an attribute of a relation is a data a) Create datatype
structure that allows the database system to find those b) Create data
tuples in the relation that have a specified value for that c) Create definetype
attribute efficiently, without scanning through all the d) Create type
tuples of the relation. View Answer
a) Index
Answer: d
b) Reference
Explanation: The create type clause can be used to
c) Assertion
define new [Link] : create type Dollars as
d) Timestamp
numeric(12,2) final; .
View Answer
6. Values of one type can be converted to another
Answer: a
domain using which of the following?
Explanation: Index is the reference to the tuples in a
a) Cast
relation.
b) Drop type
3. c) Alter type
d) Convert
Create index studentID_index on student(ID);
View Answer
advertisement
Answer: a
Here which one denotes the relation for which index is Explanation: Example of cast :cast ([Link]
created? to numeric(12,2)). SQL provides drop type and alter type
a) StudentID_index clauses to drop or modify types that have been created
b) ID earlier.
c) StudentID
7.
d) Student
View Answer CREATE DOMAIN YearlySalary NUMERIC(8,2)

Answer: d CONSTRAINT salary VALUE test __________;


Explanation: The statement creates an index named
In order to ensure that an instructor’s salary domain
studentID index on the attribute ID of the relation
allows only values greater than a specified value use:
student.
a) Value>=30000.00
4. Which of the following is used to store movie and b) Not null;
image files? c) Check(value >= 29000.00);
a) Clob d) Check(value)
b) Blob View Answer
Page 26 of 139
Answer: c a) Super user
Explanation: Check(value ‘condition’) is the syntax. b) Administrator
c) Operator of operating system
8. Which of the following closely resembles Create
d) All of the mentioned
view?
View Answer
a) Create table . . .like
b) Create table . . . as Answer: d
c) With data Explanation: The authorizations provided by the
d) Create view as administrator to the user is a privilege.
View Answer
2. Which of the following is a basic form of grant
Answer: b statement?
Explanation: The ‘create table . . . as’ statement closely a)
resembles the create view statement and both are
GRANT 'privilege list'
defined by using queries. The main difference is that the
contents of the table are set when the table is created, ON 'relation name or view name'
whereas the contents of a view always reflect the
current query result. TO 'user/role list';

9. In contemporary databases, the top level of the b)


hierarchy consists of ______ each of which can contain advertisement
_____
a) Catalogs, schemas GRANT 'privilege list'
b) Schemas, catalogs ON 'user/role list'
c) Environment, schemas
d) Schemas, Environment TO 'relation name or view name';
View Answer
c)
Answer: a
Note: Join free Sanfoundry classes
Explanation: None.
at Telegram or Youtube
10. Which of the following statements creates a new
GRANT 'privilege list'
table temp instructor that has the same schema as an
instructor. TO 'user/role list'
a) create table temp_instructor;
d)
b) Create table temp_instructor like instructor;
c) Create Table as temp_instructor; GRANT 'privilege list'
d) Create table like temp_instructor;
View Answer ON 'relation name or view name'

Answer: b ON 'user/role list';


Explanation: None. View Answer
Database Questions and Answers – Authorizations Answer: a
This set of Database Multiple Choice Questions & Explanation: The privilege list allows the granting of
Answers (MCQs) focuses on “Authorizations”. several privileges in one command .

1. The database administrator who authorizes all the


new users, modifies the database and takes grants
privilege is

Page 27 of 139
3. Which of the following is used to provide privilege to 6. Which of the following is true regarding views?
only a particular attribute? a) The user who creates a view cannot be given update
a) Grant select on employee to Amit authorization on a view without having update
b) Grant update(budget) on department to Raj authorization on the relations used to define the view
c) Grant update(budget,salary,Rate) on department to b) The user who creates a view cannot be given update
Raj authorization on a view without having update
d) Grant delete to Amit authorization on the relations used to define the view
View Answer c) If a user creates a view on which no authorization can
be granted, the system will allow the view creation
Answer: b
request
Explanation: This grant statement gives user Raj update
d) A user who creates a view receives all privileges on
authorization on the budget attribute of the department
that view
relation.
View Answer
4. Which of the following statement is used to remove
Answer: c
the privilege from the user Amir?
Explanation: A user who creates a view does not
a) Remove update on department from Amir
necessarily receive all privileges on that view.
b) Revoke update on employee from Amir
c) Delete select on department from Raj 7. If we wish to grant a privilege and to allow the
d) Grant update on employee from Amir recipient to pass the privilege on to other users, we
View Answer append the __________ clause to the appropriate grant
command.
Answer: b
a) With grant
Explanation: revoke on from ;
b) Grant user
5. Which of the following is used to provide delete c) Grant pass privelege
authorization to instructor? d) With grant option
a) View Answer

CREATE ROLE instructor ; Answer: d


Explanation: None.
GRANT DELETE TO instructor;
8. In authorization graph, if DBA provides authorization
b) to u1 which inturn gives to u2 which of the following is
CREATE ROLE instructor; correct?
a) If DBA revokes authorization from u1 then u2
GRANT SELECT ON takes authorization is also revoked
TO instructor; b) If u1 revokes authorization from u2 then u2
authorization is revoked
c) c) If DBA & u1 revokes authorization from u1 then u2
authorization is also revoked
CREATE ROLE instructor;
d) If u2 revokes authorization then u1 authorization is
GRANT DELETE ON takes revoked
View Answer
TO instructor;
Answer: c
d) All of the mentioned
Explanation: A user has an authorization if and only if
View Answer
there is a path from the root of the authorization graph
Answer: c down to the node representing the user.
Explanation: The role is first created and the
authorization is given on relation takes to the role.
Page 28 of 139
9. Which of the following is used to avoid cascading of preprocessor submits the SQL statements to the
authorizations from the user? database system for precompilation and optimization;
a) Granted by current role then it replaces the SQL statements in the application
b) Revoke select on department from Amit, Satoshi program with appropriate code and function calls before
restrict; invoking the programming-language compiler.
c) Revoke grant option for select on department from
2. Which of the following header must be included in
Amit;
java program to establish database connectivity using
d) Revoke select on department from Amit, Satoshi
JDBC ?
cascade;
a) Import [Link].*;
View Answer
b) Import [Link].*;
Answer: b c) Import [Link].*;
Explanation: The revoke statement may specify restrict d) Import [Link].*;
in order to prevent cascading revocation. The keyword View Answer
cascade can be used instead of restrict to indicate that
Answer: a
revocation should cascade.
Explanation: The Java program must import [Link].*,
10. The granting and revoking of roles by the user may which contains the interface definitions for the
cause some confusions when that user role is revoked. functionality provided by JDBC.
To overcome the above situation
3. [Link](_______ , ______ ,
a) The privilege must be granted only by roles
______)
b) The privilege is granted by roles and users
What are the two parameters that are included?
c) The user role cannot be removed once given
a) URL or machine name where server runs, Password,
d) By restricting the user access to the roles
User ID
View Answer
b) URL or machine name where server runs, User ID,
Answer: a Password
Explanation: The current role associated with a session c) User ID, Password, URL or machine name where
can be set by executing set role name. The specified role server runs
must have been granted to the user, else the set role d) Password, URL or machine name where server runs,
statement fails. User ID
View Answer
Database Questions and Answers – Access SQL From a
Programming Language Answer: b
Explanation: The database must be opened first in order
This set of Database Multiple Choice Questions &
to perform any operations for which this get connection
Answers focuses on “Access SQL From a Programming
method is used.
Language”.
advertisement
1. Which of the following is used to access the database
server at the time of executing the program and get the 4. Which of the following invokes functions in sql?
data from the server accordingly? a) Prepared Statements
a) Embedded SQL b) Connection statement
b) Dynamic SQL c) Callable statements
c) SQL declarations d) All of the mentioned
d) SQL data analysis View Answer
View Answer
Answer: c
Answer: b Explanation: JDBC provides a Callable Statement
Explanation: Embedded SQL, the SQL statements are interface that allows invocation of SQL stored
identified at compile time using a preprocessor. The procedures and functions.
Page 29 of 139
5. Which of the following function is used to find the Answer: c
column count of the particular resultset? Explanation:
a) getMetaData()
EXEC SQL
b) Metadata()
c) getColumn() DECLARE c cursor FOR
d) get Count()
View Answer SELECT ID, name

Answer: a FROM student


Explanation: The interface ResultSet WHERE tot cred > :credit amount;
has a method, getMetaData(), that returns a
ResultSetMetaData object that contains metadata about .
the result set. ResultSetMetaData, in turn, has methods 9. The update statement can be executed in host
to find metadata information, such as the number of language using
columns in the result, the name of a specified column, a) EXEC SQL update c;
or the type of a specified column. b) EXEC SQL update c into :si, :sn;
Note: Join free Sanfoundry classes c)
at Telegram or Youtube EXEC SQL
6. Which of the following is a following statement is a UPDATE instructor
prepared statements?
a) Insert into department values(?,?,?) SET salary = salary + 100
b) Insert into department values(x,x,x)
WHERE CURRENT OF c;
c) SQLSetConnectOption(conn, SQL AUTOCOMMIT, 0)
d) SQLTransact(conn, SQL ROLLBACK) d) EXEC SQL update END-SQL
View Answer View Answer

Answer: a Answer: c
Explanation:? is used as a placeholder whose value can Explanation: The SQL can be terminated by ; to
be provided later. terminate the sentence.

7. Which of the following is used as the embedded SQL 10. Which of the following is used to access large
in COBOL? objects from a database ?
a) EXEC SQL <embedded SQL statement >; a) setBlob()
b) EXEC SQL <embedded SQL statement > END-EXEC b) getBlob()
c) EXEC SQL <embedded SQL statement > c) getClob()
d) EXEC SQL <embedded SQL statement > END EXEC; d) all of the mentioned
View Answer View Answer

Answer: b Answer: d
Explanation: EXEC SQL <embedded SQL statement >; is Explanation: None.
normally in C.

8. Which of the following is used to distinguish the


variables in SQL from the host language variables?
a) .
b) –
c) :
d) ,
View Answer
Page 30 of 139
Database Questions and Answers – The Entity- Answer: c
Relationship Model Explanation: A relationship is an association among
several entities.
This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “The Entity-Relationship 5. The attribute name could be structured as an
Model”. attribute consisting of first name, middle initial, and last
name. This type of attribute is called
1. An ________ is a set of entities of the same type that
a) Simple attribute
share the same properties, or attributes.
b) Composite attribute
a) Entity set
c) Multivalued attribute
b) Attribute set
d) Derived attribute
c) Relation set
View Answer
d) Entity model
View Answer Answer: b
Explanation: Composite attributes can be divided into
Answer: a
subparts (that is, other attributes).
Explanation: An entity is a “thing” or “object” in the real
world that is distinguishable from all other objects. Subscribe Now: DBMS Newsletter | Important Subjects
Newsletters
2. Entity is a _________
a) Object of relation 6. The attribute AGE is calculated from DATE_OF_BIRTH.
b) Present working model The attribute AGE is
c) Thing in real world a) Single valued
d) Model of relation b) Multi valued
View Answer c) Composite
d) Derived
Answer: c
View Answer
Explanation: For example, each person in a university is
an entity. Answer: d
Explanation: The value for this type of attribute can be
3. The descriptive property possessed by each entity set
derived from the values of other related attributes or
is _________
entities.
a) Entity
b) Attribute 7. Not applicable condition can be represented in
c) Relation relation entry as
d) Model a) NA
View Answer b) 0
c) NULL
Answer: b
d) Blank Space
Explanation: Possible attributes of the instructor entity
View Answer
set are ID, name, dept name, and salary.
Answer: c
advertisement
Explanation: NULL always represents that the value is
4. The function that an entity plays in a relationship is not present.
called that entity’s _____________
8. Which of the following can be a multivalued
a) Participation
attribute?
b) Position
a) Phone_number
c) Role
b) Name
d) Instance
c) Date_of_birth
View Answer

Page 31 of 139
d) All of the mentioned 2. An entity in A is associated with at most one entity in
View Answer B, and an entity in B is associated with at most one
entity in [Link] is called as
Answer: a
a) One-to-many
Explanation: Name and Date_of_birth cannot hold more
b) One-to-one
than 1 value.
c) Many-to-many
9. Which of the following is a single valued attribute d) Many-to-one
a) Register_number View Answer
b) Address
Answer: b
c) SUBJECT_TAKEN
Explanation: Here one entity in one set is related to one
d) Reference
one entity in other set.
View Answer
3. An entity in A is associated with at most one entity in
Answer: a
B. An entity in B, however, can be associated with any
Explanation: None.
number (zero or more) of entities in A.
10. In a relation between the entities the type and a) One-to-many
condition of the relation should be specified. That is b) One-to-one
called as______attribute. c) Many-to-many
a) Desciptive d) Many-to-one
b) Derived View Answer
c) Recursive
Answer: d
d) Relative
Explanation: Here more than one entity in one set is
View Answer
related to one one entity in other set.
Answer: a
advertisement
Explanation: Consider the entity sets student and
section, which participate in a relationship set takes. We 4. Data integrity constraints are used to:
may wish to store a descriptive attribute grade with the a) Control who is allowed access to the data
relationship to record the grade that a student got in the b) Ensure that duplicate records are not entered into the
class. table
c) Improve the quality of data entered for a specific
Database Questions and Answers – Constraints
property
This set of Database Multiple Choice Questions & d) Prevent users from changing the values stored in the
Answers (MCQs) focuses on “Constraints”. table
View Answer
1. _____________ express the number of entities to
which another entity can be associated via a Answer: c
relationship set. Explanation: The data entered will be in a particular cell
a) Mapping Cardinality (i.e., table column).
b) Relational Cardinality
5. Establishing limits on allowable property values, and
c) Participation Constraints
specifying a set of acceptable, predefined options that
d) None of the mentioned
can be assigned to a property are examples of:
View Answer
a) Attributes
Answer: a b) Data integrity constraints
Explanation: Mapping cardinality is also called as c) Method constraints
cardinality ratio. d) Referential integrity constraints
View Answer

Page 32 of 139
Answer: b d) Foreign Key
Explanation: Only particular value satisfying the View Answer
constraints are entered in the column.
Answer: d
Subscribe Now: DBMS Newsletter | Important Subjects Explanation: Foreign key is used when primary key of
Newsletters one relation is used in another relation.

6. Which of the following can be addressed by enforcing 10. ____________ is preferred method for enforcing
a referential integrity constraint? data integrity
a) All phone numbers must include the area code a) Constraints
b) Certain fields are required (such as the email address, b) Stored Procedure
or phone number) before the record is accepted c) Triggers
c) Information on the customer must be known before d) Cursors
anything can be sold to that customer View Answer
d) Then entering an order quantity, the user must input
Answer: a
a number and not some text (i.e., 12 rather than ‘a
Explanation: Constraints are specified to restrict entries
dozen’)
in the relation.
View Answer
Database Questions and Answers – Entity-Relationship
Answer: c
Diagrams
Explanation: None.
This set of Database Multiple Choice Questions &
7. ______ is a special type of integrity constraint that
Answers (MCQs) focuses on “Entity-Relationship
relates two relations & maintains consistency across the
Diagrams”.
relations.
a) Entity Integrity Constraints 1. Which of the following gives a logical structure of the
b) Referential Integrity Constraints database graphically?
c) Domain Integrity Constraints a) Entity-relationship diagram
d) Domain Constraints b) Entity diagram
View Answer c) Database diagram
d) Architectural representation
Answer: b
View Answer
Explanation: None.
Answer: a
8. Which one of the following uniquely identifies the
Explanation: E-R diagrams are simple and clear—
elements in the relation?
qualities that may well account in large part for the
a) Secondary Key
widespread use of the E-R model.
b) Primary key
c) Foreign key 2. The entity relationship set is represented in E-R
d) Composite key diagram as
View Answer a) Double diamonds
b) Undivided rectangles
Answer: b
c) Dashed lines
Explanation: Primary key checks for not null and
d) Diamond
uniqueness constraint.
View Answer
9. Drop Table cannot be used to drop a table referenced
Answer: d
by a _________ constraint.
Explanation: Dashed lines link attributes of a
a) Local Key
relationship set to the relationship set.
b) Primary Key
c) Composite Key
Page 33 of 139
3. The Rectangles divided into two parts represents Answer: c
a) Entity set Explanation: An entity set that has a primary key is
b) Relationship set termed a strong entity set.
c) Attributes of a relationship set
7. For a weak entity set to be meaningful, it must be
d) Primary key
associated with another entity set, called the
View Answer
a) Identifying set
Answer: a b) Owner set
Explanation: The first part of the rectangle, contains the c) Neighbour set
name of the entity set. The second part contains the d) Strong entity set
names of all the attributes of the entity set. View Answer

advertisement Answer: a
Explanation: Every weak entity must be associated with
4. Consider a directed line(->) from the relationship set
an identifying entity; that is, the weak entity set is said
advisor to both entity sets instructor and student. This
to be existence dependent on the identifying entity set.
indicates _________ cardinality
The identifying entity set is said to own the weak entity
a) One to many
set that it identifies. It is also called as owner entity set.
b) One to one
c) Many to many 8. Weak entity set is represented as
d) Many to one a) Underline
View Answer b) Double line
c) Double diamond
Answer: b
d) Double rectangle
Explanation: This indicates that an instructor may advise
View Answer
at most one student, and a student may have at most
one advisor. Answer: d
Explanation: Weak entity set is represented as a double
5. We indicate roles in E-R diagrams by labeling the lines
rectangle in entity relationship diagram.
that connect ___________ to __________
a) Diamond , diamond 9. If you were collecting and storing information about
b) Rectangle, diamond your music collection, an album would be considered
c) Rectangle, rectangle a(n) _____
d) Diamond, rectangle a) Relation
View Answer b) Entity
c) Instance
Answer: d
d) Attribute
Explanation: Diamond represents a relationship set and
View Answer
rectangle represents a entity set.
Answer: b
Sanfoundry Certification Contest of the Month is Live.
Explanation: An entity set is a logical container for
100+ Subjects. Participate Now!
instances of an entity type and instances of any type
6. An entity set that does not have sufficient attributes derived from that entity type.
to form a primary key is termed a __________
10. What term is used to refer to a specific record in
a) Strong entity set
your music database; for instance; information stored
b) Variant set
about a specific album?
c) Weak entity set
a) Relation
d) Variable set
b) Instance
View Answer
c) Table

Page 34 of 139
d) Column an instance. A database instance or an ‘instance’ is
View Answer made up of the background processes needed by the
database.
Answer: b
Explanation: The environment of database is said to be

Page 35 of 139
Database Questions and Answers – Reduction to Relational
Schemas
This set of Database Problems focuses on “Reduction to Relational Schemas”.

Consider the following relational schemas and answer the questions below

The section relation

Course_id Sec_id Semester Year Building

BIO-101 1 Spring 2010 Painter

CS-102 4 Summer 2009 Packyard

EE-201 3 Fall 2010 Watson

FIN-301 1 Spring 2011 Richard

The teaches relation

Id Course_id Sec_id Semester Year

1001 CS-101 1 Fall 2009

1002 EE-201 2 Spring 2010

1003 FIN-301 3 Fall 2009

1004 BIO-101 1 Summer 2011

1. Which one of the following can be treated as a primary key in teaches relation?
a) Id
b) Semester
c) Sec_id
d) Year
View Answer
Page 36 of 139
Answer: a
Explanation: Here Id is the only attribute that has to have a unique entry.

advertisement

2. The primary key in the section relation is


a) Course_id
b) Sec_id
c) Both Course_id and Sec_id
d) All the attributes
View Answer
Answer: a
Explanation: Here Course_id is the only attribute that has a unique entries. So, Course_id is the
primary key in the section relation table.

3.

Sanfoundry Certification Contest of the Month is Live. 100+ Subjects. Participate Now!

SELECT * FROM teaches WHERE Sec_id = 'CS-101';


Which of the following Id is selected for the following query?
a) 1003
b) 1001
c) None
d) Error message appears
View Answer
Answer: d
Explanation: The value CS-101 matches the Course_id but not Id.

4.

SELECT Id, Course_id, Building FROM SECTION s AND teaches t WHERE [Link]=2009;
Which of the following Id are displayed?
a) 1003
b) 1001
c) Both 1003 and 1001
d) Error message appears
View Answer
Answer: c
Explanation: Two rows are select in the above query.

5. The query which selects the Course_id ‘CS-101’ from the section relation is
a) Select Course_id from section where Building = ‘Richard’;
b) Select Course_id from section where Year = ‘2009’;
c) Select Course_id from teaches where Building = ‘Packyard’;

Page 37 of 139
d) Select Course_id from section where Sec_id = ‘3’;
View Answer
Answer: b
Explanation: The year ‘2009’ should be selected from the section relation.

6.

CREATE TABLE SECTION


(Course_id VARCHAR (8),
Sec_id VARCHAR (8),
Semester VARCHAR (6),
YEAR NUMERIC (4,0),
Building NUMERIC (15),
PRIMARY KEY (course id, sec id, semester, YEAR),
FOREIGN KEY (course id) REFERENCES course);
Which of the following has an error in the above create table for the relation section
a) Primary key (course id, sec id, semester, year)
b) Foreign key (course id) references course
c) Year numeric (4,0)
d) Building numeric (15)
View Answer
Answer: d
Explanation: It should be replaced by Year Building varchar (15).

7. The relation with primary key can be created using


a) Create table instructor (Id, Name)
b) Create table instructor (Id, Name, primary key(name))
c) Create table instructor (Id, Name, primary key (Id))
d) Create table instructor ( Id unique, Name )
View Answer
Answer: c
Explanation: The value Name cannot be a primary key.

8. How can the values in the relation teaches be deleted?


a) Drop table teaches;
b) Delete from teaches;
c) Purge table teaches;
d) Delete from teaches where Id =’Null’;
View Answer
Answer: b
Explanation: Delete table cleans the entry from the table.

9. In the above teaches relation ” Select * from teaches where Year = ‘2010’” displays how many
rows?
a) 2
Page 38 of 139
b) 4
c) 5
d) 1
View Answer
Answer: a
Explanation: There are two tuples with the year is 2009.

10. The relation changes can be got back using ________ command.
a) Flashback
b) Purge
c) Delete
d) Getback
View Answer
Answer: a
Explanation: Purge deletes the table and delete cleans the table entry.
Database Questions and Answers – Entity-Relationship 3. Given the basic ER and relational models, which of
Design Issues the following is INCORRECT?
a) An attribute of an entity can have more than one
This set of Database online test focuses on “Entity-
value
Relationship Design Issues”.
b) An attribute of an entity can be composite
1. Let us consider phone_number ,which can take single c) In a row of a relational table, an attribute can have
or several values . Treating phone_numberas an more than one value
_________ permits instructors to have several phone d) In a row of a relational table, an attribute can have
numbers (including zero) associated with them. exactly one value or a NULL value
a) Entity View Answer
b) Attribute
Answer: c
c) Relation
Explanation: It is possible to have several values for a
d) Value
single attribute provide it is a multi-valued attribute.
View Answer
advertisement
Answer: a
Explanation: Treating a phone as an 4. Which of the following indicates the maximum
attribute phone_number implies that instructors have number of entities that can be involved in a
precisely one phone number each. relationship?
a) Minimum cardinality
2. The total participation by entities is represented in E-
b) Maximum cardinality
R diagram as
c) ERD
a) Dashed line
d) Greater Entity Count
b) Double line
View Answer
c) Double rectangle
d) Circle Answer: b
View Answer Explanation: In SQL (Structured Query Language), the
term cardinality refers to the uniqueness of data values
Answer: b
contained in a particular column (attribute) of a
Explanation: It is used to represent the relation between
database table.
several attributes.

Page 39 of 139
5. In E-R diagram generalization is represented by c) Query
a) Ellipse d) Data dictionary
b) Dashed ellipse View Answer
c) Rectangle
Answer: b
d) Triangle
Explanation: View is a logical portion of a database
View Answer
which is needed by some users.
Answer: d
10. A primary key is combined with a foreign key creates
Explanation: Ellipse represents attributes, rectangle
a) Parent-Child relation ship between the tables that
represents entity.
connect them
Sanfoundry Certification Contest of the Month is Live. b) Many to many relationship between the tables that
100+ Subjects. Participate Now! connect them
c) Network model between the tables that connect
6. What is a relationship called when it is maintained
them
between two entities?
d) None of the mentioned
a) Unary
View Answer
b) Binary
c) Ternary Answer: a
d) Quaternary Explanation: Using the two relationships mother and
View Answer father provides us a record of a child’s mother, even if
we are not aware of the father’s identity; a null value
Answer: b
would be required if the ternary relationship parent is
Explanation: Binary word usually represents two
used. Using binary relationship sets is preferable in this
attributes.
case.
7. Which of the following is a low level operator?
Database Questions and Answers – Extended E-R
a) Insert
Features
b) Update
c) Delete This set of Database Multiple Choice Questions &
d) Directory Answers (MCQs) focuses on “Extended E-R Features”.
View Answer
1. The entity set person is classified as student and
Answer: d employee. This process is called _________
Explanation: Directory is a low level to word on in file a) Generalization
system. b) Specialization
c) Inheritance
8. Key to represent relationship between tables is called
d) Constraint generalization
a) Primary key
View Answer
b) Secondary Key
c) Foreign Key Answer: b
d) None of the mentioned Explanation: The process of designating subgroupings
View Answer within an entity set is called specialization.

Answer: c 2. Which relationship is used to represent a


Explanation: Primary key of one relation used as an specialization entity?
attribute in another relation is called foreign key. a) ISA
b) AIS
9. A window into a portion of a database is
c) ONIS
a) Schema
d) WHOIS
b) View
View Answer
Page 40 of 139
Answer: a Note: Join free Sanfoundry classes
Explanation: In terms of an E-R diagram, specialization is at Telegram or Youtube
depicted by a hollow arrow-head pointing from the
6. A _____________ constraint requires that an entity
specialized entity to the other entity.
belong to no more than one lower-level entity set.
3. The refinement from an initial entity set into a) Disjointness
successive levels of entity subgroupings represents a b) Uniqueness
________ design process in which distinctions are made c) Special
explicit. d) Relational
a) Hierarchy View Answer
b) Bottom-up
Answer: a
c) Top-down
Explanation: For example, student entity can satisfy only
d) Radical
one condition for the student type attribute; an entity
View Answer
can be either a graduate student or an undergraduate
Answer: c student, but cannot be both.
Explanation: The design process may also proceed in a
7. Consider the employee work-team example, and
bottom-up manner, in which multiple entity sets are
assume that certain employees participate in more than
synthesized into a higher-level entity set on the basis of
one work team. A given employee may therefore appear
common features.
in more than one of the team entity sets that are lower
advertisement level entity sets of employee. Thus, the generalization is
_____________
4. There are similarities between the instructor entity
a) Overlapping
set and the secretary entity set in the sense that they
b) Disjointness
have several attributes that are conceptually the same
c) Uniqueness
across the two entity sets: namely, the identifier, name,
d) Relational
and salary attributes. This process is called
View Answer
a) Commonality
b) Specialization Answer: a
c) Generalization Explanation: In overlapping generalizations, the same
d) Similarity entity may belong to more than one lower-level entity
View Answer set within a single generalization.

Answer: c 8. The completeness constraint may be one of the


Explanation: Generalization is used to emphasize the following: Total generalization or specialization, Partial
similarities among lower-level entity sets and to hide generalization or specialization. Which is the default?
the differences. a) Total
b) Partial
5. If an entity set is a lower-level entity set in more than
c) Should be specified
one ISA relationship, then the entity set has
d) Cannot be determined
a) Hierarchy
View Answer
b) Multilevel inheritance
c) Single inheritance Answer: b
d) Multiple inheritance Explanation: Partial generalization or specialization –
View Answer Some higher-level entities may not belong to any lower-
level entity set.
Answer: d
Explanation: The attributes of the higher-level entity 9. Functional dependencies are a generalization of
sets are said to be inherited by the lower-level entity a) Key dependencies
sets. b) Relation dependencies
Page 41 of 139
c) Database dependencies a) Child
d) None of the mentioned b) Owner
View Answer c) Dominant
d) All of the mentioned
Answer: a
View Answer
Explanation: The subclasses are combined to form the
superclass. Answer: a
Explanation: A parent may be called as a strong entity.
10. Which of the following is another name for a weak
entity?
Database Questions and Answers – Querying database part-1
DDL
This set of Database Multiple Choice Questions & Answers (MCQs) focuses on “Querying database
part-1 DDL”.

SQL data definition for part of the university database.

CREATE TABLE department


(dept_name VARCHAR (20),
building VARCHAR (15),
budget NUMBER,
PRIMARY KEY (dept_name));

CREATE TABLE course


(course_id VARCHAR (7),
title VARCHAR (50),
dept_name VARCHAR (20),
credits NUMERIC (2,0),
PRIMARY KEY (course_id),
FOREIGN KEY (dept_name) __________ department);

CREATE TABLE instructor


(ID VARCHAR (5),
name VARCHAR (20) NOT NULL,
dept_name VARCHAR (20),
salary NUMERIC (8,2),
FOREIGN KEY (dept_name) _______ department);

CREATE TABLE SECTION


(course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
building VARCHAR (15),
room_number VARCHAR (7),
time_slot id VARCHAR (4),
Page 42 of 139
PRIMARY KEY (course_id, sec_id, semester, YEAR),
FOREIGN KEY (_______) ______ course);

CREATE TABLE teaches


(ID VARCHAR (5),
course_id VARCHAR (8),
sec_id VARCHAR (8),
semester VARCHAR (6),
YEAR NUMERIC (4,0),
PRIMARY KEY (ID, course_id, sec_id, semester, YEAR),
FOREIGN KEY (course_id, sec_id, semester, YEAR) REFERENCES SECTION,
FOREIGN KEY (ID) _______ instructor);

Answer questions based on the above commands

advertisement
1. Which is the main relation which is used in the university database which is referenced by all other
relation of the university?
a) Teaches
b) Course
c) Department
d) Section
View Answer
Answer: c
Explanation: Department is the only relation which forms the main part of the university database.

2. The department relation has the an entry budget whose type has to be replaced by
a) Varchar (20)
b) Varchar2 (20)
c) Numeric (12,2)
d) Numeric
View Answer
Answer: c
Explanation: Department is the only relation which forms the main part of the university database.

Subscribe Now: DBMS Newsletter | Important Subjects Newsletters

3. In the course relation, the title field should throw an error in case of any missing title. The
command to be added in title is
a) Unique
b) Not null
c) 0
d) Null
View Answer
Answer: b
Explanation: By specifying not null the value cannot be left blank.
Page 43 of 139
4. In the above DDL command the foreign key entries are got by using the keyword
a) References
b) Key reference
c) Relating
d) None of the mentioned
View Answer
Answer: a
Explanation: References (table_name) give the prior table name for the entry.

5. Identify the error in the section relation


a) No error
b) Year numeric (4,0)
c) Building varchar (15)
d) Sec_id varchar (8)
View Answer
Answer: a
Explanation: The building and the sec_id have varchar values and year is of numeric type. So no such
errors are found in the relation.

6. The following entry is given in to the instructor relation .

(100202,Drake,Biology,30000)

Identify the output of the query given


a) Row(s) inserted
b) Error in ID of insert
c) Error in Name of insert
d) Error in Salary of the insert
View Answer
Answer: b
Explanation: The varchar(5) value cannot hold the entry 100202.

7. Which of the following can be used as a primary key entry of the instructor relation.
a) DEPT_NAME
b) NAME
c) ID
d) All of the mentioned
View Answer
Answer: c
Explanation: The value ID can only be primary key unlike dept_name which is used as a foreign key.

8. In the section relation which of the following is used as a foreign key?


a) Course_id
b) Course_id,sec_id
c) Room_number

Page 44 of 139
d) Course_id,sec_id,room_number
View Answer
Answer: a
Explanation: Course_id is the only field which is present in the course relation.

9. In order to include an attribute Name to the teaches relation which of the following command is
used?
a) Alter table teaches include Name;
b) Alter table teaches add Name;
c) Alter table teaches add Name varchar;
d) Alter table teaches add Name varchar(20);
View Answer
Answer: d
Explanation: The form of the alter table command is
alter table r add AD;
where r is the name of an existing relation, A is the name of the attribute to be added, and D is the
type of the added attribute.

10. To replace the relation section with some other relation the initial step to be carried out is
a) Delete section;
b) Drop section;
c) Delete from section;
d) Replace section new_table ;
View Answer
Answer: b
Explanation: Droping the table drops all the references to that table.

Database Questions and Answers – Querying database part-2


DML
This set of Database Questions & Answers focuses on “Querying database part-1 DML”
The instructor relation

ID Name Dept_name Salary

10101 Hayley [Link]. 65000

12121 Jackson Finance 90000

15151 Nathan Music 87000

22222 April Biology 73000

34345 Crick [Link]. 100000


The course relation

Page 45 of 139
Course_id Title Dept_name Credits

CS-101 Robotics [Link]. 5

BIO-244 Genetics Biology 4

PHY-333 Physical Principles Physics 3

MUS-562 Music Video Production Music 2

FIN-101 Investment Banking Finance 3


Answer the questions based on the above relations

1. Which of the following command is used to display the departments of the instructor relation?
a) Select * from instructor where Dept_name = Finance;
b) Select * from instructor ;
c) Select dept_name from instructor;
d) Select dept_name for instructor where Name=Jackson;
View Answer
Answer: c
Explanation: Only one field is necessary for the query and where clause is not needed for the
selection.
advertisement
2. How can we select the elements which have common Dept_name in both the relation ?
a) Select * from instructor i , course c where i.Dept_name=c.Dept_name;
b) Select Dept name from instructor ,Course ;
c) Select * from instructor i , course c ;
d) Select Dept_name from instructor where Dept_name = NULL;
View Answer
Answer: a
Explanation: Here only the common elements are displayed .

3. Select distinct Dept_name from instructor ;


How many row(s) are displayed ?
a) 4
b) 3
c) 5
d) Error
View Answer
Answer: a
Explanation: Distinct keyword eliminates the the common Dept_name .

Note: Join free Sanfoundry classes at Telegram or Youtube

Page 46 of 139
4. Suppose the Authority want to include a new instructor for the title Neuroscience what command
should be inserted ?
a) Insert into instructor values(12111,Emma,NeuroScience,200000);
b) Insert into course values(12111,Introduction,NeuroScience,2);
c)

Insert into instructor values(12111,Emma,Biology,200000);

Insert into course values(BIO-112,Introduction to Neuro Science,NeuroScience,2);

d) Insert into course values(12111,Emma,NeuroScience,200000);


View Answer
Answer: c
Explanation: The values have to be inserted into both the relations to be intact .

5. If a person all the people in Music department gets fired which of the following has to be
performed on the instructor relation ?
a) Delete Dept_name=Music in instructor;
b) Delete from instructor where Dept_name=Music;
c) Remove Dept_name= Music
d) All of the mentioned
View Answer
Answer: b
Explanation: Delete from table_name where condition .

6.

SELECT DISTINCT [Link]


FROM instructor AS T, instructor AS S
WHERE [Link] > [Link] AND [Link] name = ’[Link].’;

What will be displayed as the value of name for the above query?
a) Hayley
b) Jackson
c) Hayley and Crick
d) Crick
View Answer
Answer: d
Explanation: Only the greatest salary in [Link] dept is selected for the query.

7.

SELECT Name
FROM instructor
WHERE salary > SOME (SELECT salary FROM instructor WHERE dept_name = '[Link].');

Page 47 of 139
How many rows are selected ?
a) 3
b) 4
c) 2
d) 1
View Answer
Answer: d
Explanation: This displays the names of instructors with salary greater than that of some (at least
one) instructor in the Biology department .

8. How will you select the Names whose first letter is E ?


a)

SELECT Name
FROM instructor
WHERE Name LIKE ’A%;

b)

SELECT Name
FROM course
WHERE Name LIKE ’A%;

c)

SELECT Dept_name
FROM instructor
WHERE Name LIKE ’A%;

d)

SELECT Name
FROM instructor
WHERE Dept_name LIKE ’A%;

View Answer
Answer: a
Explanation: % is used to indicate that some characters may appear .

9. Which function is used to find the count of distinct departments?


a) Dist
b) Distinct
c) Count

Page 48 of 139
d) Count,Dist
View Answer
Answer: a
Explanation: Count (distinct ID) is the correct usage.

10. Which function is used to identify the title with Least scope?
a) Min(Credits)
b) Max(Credits)
c) Min(title)
d) Min(Salary)
View Answer
Answer: a
Explanation: Max is used to find the highest element and Min is used to find the lowest element.

Page 49 of 139
Database Questions and Answers – Atomic Domains It eliminates all redundancy that can be discovered
based on functional dependencies.
This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “Atomic Domains”. Subscribe Now: DBMS Newsletter | Important Subjects
Newsletters
1. A domain is ______ if elements of the domain are
considered to be indivisible units. 4. Which one is based on multi-valued dependency:
a) Atomic a) First
b) Subatomic b) Second
c) Substructure c) Third
d) Subset d) Fourth
View Answer View Answer

Answer: a Answer: d
Explanation: A set of names is an example of a Explanation: One of the more desirable normal forms
nonatomic value. that we can obtain is Boyce–Codd normal form (BCNF).
It eliminates all redundancy that can be discovered
2. Identify the composite attributes
based on functional dependencies.
a) Salary
b) Credits 5. If a relation is in BCNF, then it is also in
c) Section_id a) 1 NF
d) None of the mentioned b) 2 NF
View Answer c) 3 NF
d) All of the mentioned
Answer: d
View Answer
Explanation: Composite attributes, such as an attribute
address with component attributes street, city, state, Answer: d
and zip have nonatomic domains. Explanation: Third normal form (3NF) relaxes this
constraint slightly by allowing certain nontrivial
3. Consider the relation given below and ind the
functionaldependencieswhose left side is not a
maximum normal form applicable to them
superkey.
advertisement
6. If every non-key attribute is functionally dependent
i. R(A, B) WITH productions { A --> B } primary key, then the relation will be in
a) First normal form
ii. R(A, B) WITH productions { B --> A } b) Second normal form
iii. R(A, B) WITH productions {A —> B, B --> A } c) Third form
d) Fourth normal form
iv. R(A, B, C) WITH productions {A -->B, B --> A, AB --> C View Answer
}
Answer: b
a) i, ii and iii are in 3NF and iv is in BCNF Explanation: Third normal form (3NF) relaxes this
b) i and ii are in BCNF and iii and iv are in 3NF constraint slightly by allowing certain nontrivial
c) All are in 3NF functionaldependencieswhose left side is not a
d) All are in BCNF superkey.
View Answer
7. If an attribute of a composite key is dependent on an
Answer: d attribute of the other composite key, a normalization
Explanation: One of the more desirable normal forms called _____ is needed.
that we can obtain is Boyce–Codd normal form (BCNF). a) DKNF
b) BCNF
Page 50 of 139
c) Fourth b) Second
d) Third c) Third
View Answer d) Fourth
View Answer
Answer: b
Explanation: BCNF eliminates all redundancy that can be Answer: a
discovered based on functional dependencies. Explanation: The first normal form is used to eliminate
the duplicate information.
8. The term for information that describes what type of
data is available in a database is: 2. A table on the many side of a one to many or many to
a) Data dictionary many relationship must:
b) data repository a) Be in Second Normal Form (2NF)
c) Index data b) Be in Third Normal Form (3NF)
d) Metadata c) Have a single attribute key
View Answer d) Have a composite key
View Answer
Answer: d
Explanation: Meta data is generally data about a data. Answer: d
Explanation: The relation in second normal form is also
9. A data type that creates unique numbers for key
in first normal form and no partial dependencies on any
columns in Microsoft Access is:
column in primary key.
a) Autonumber
b) Boolean 3. Tables in second normal form (2NF):
c) Sequential key a) Eliminate all hidden dependencies
d) Sequential number b) Eliminate the possibility of a insertion anomalies
View Answer c) Have a composite key
d) Have all non key fields depend on the whole primary
Answer: a
key
Explanation: This can be taken as a primary key.
View Answer
10. A dependency exist between two columns when
Answer: a
a) Together they constitute a composite key for the
Explanation: The relation in second normal form is also
table
in first normal form and no partial dependencies on any
b) Knowing the value in one column determines the
column in primary key.
value stored in another column
c) The table is in 3NF advertisement
d) Together they constitute a foreign key
4. Which-one ofthe following statements about normal
View Answer
forms is FALSE?
Answer: a a) BCNF is stricter than 3 NF
Explanation: Given a set F of functional dependencies b) Lossless, dependency -preserving decomposition into
on a schema, we can prove that certain other functional 3 NF is always possible
dependencies also hold on the schema. c) Loss less, dependency – preserving decomposition
into BCNF is always possible
Database Questions & Answers – Normal Forms
d) Any relation with two attributes is BCNF
This set of Database Multiple Choice Questions & View Answer
Answers (MCQs) focuses on “Normal Forms”.
Answer: c
1. In the __________ normal form, a composite Explanation: We say that the decomposition is a lossless
attribute is converted to individual attributes. decomposition if there is no loss of information by
a) First
Page 51 of 139
replacing r (R) with two relation schemas r1(R1) Answer: c
andr2(R2). Explanation: A Table is in 4NF if and only if, for every one
of its non-trivial multivalued dependencies X
5. Functional Dependencies are the types of constraints
\twoheadrightarrow Y, X is a superkey—that is, X is
that are based on______
either a candidate key or a superset thereof.
a) Key
b) Key revisited 9. Which forms are based on the concept of functional
c) Superset key dependency:
d) None of the mentioned a) 1NF
View Answer b) 2NF
c) 3NF
Answer: a
d) 4NF
Explanation: Key is the basic element needed for the
View Answer
constraints.
Answer: c
Subscribe Now: DBMS Newsletter | Important Subjects
Explanation: The table is in 3NF if every non-prime
Newsletters
attribute of R is non-transitively dependent (i.e. directly
6. Which is a bottom-up approach to database design dependent) on every superkey of R.
that design by examining the relationship between
10.
attributes:
a) Functional dependency Empdt1(empcode, name, street, city, state, pincode).
b) Database modeling
For any pincode, there is only one city and state. Also,
c) Normalization
for given street, city and state, there is just one pincode.
d) Decomposition
In normalization terms, empdt1 is a relation in
View Answer
a) 1 NF only
Answer: c b) 2 NF and hence also in 1 NF
Explanation: Normalisation is the process of removing c) 3NF and hence also in 2NF and 1NF
redundancy and unwanted data. d) BCNF and hence also in 3NF, 2NF and 1NF
View Answer
7. Which forms simplifies and ensures that there are
minimal data aggregates and repetitive groups: Answer: b
a) 1NF Explanation: The relation in second normal form is also
b) 2NF in first normal form and no partial dependencies on any
c) 3NF column in primary key.
d) All of the mentioned
Database Questions and Answers – Functional-
View Answer
Dependency Theory
Answer: c
This set of Database Multiple Choice Questions &
Explanation: The first normal form is used to eliminate
Answers (MCQs) focuses on “Functional-Dependency
the duplicate information.
Theory”.
8. Which forms has a relation that possesses data about
1. We can use the following three rules to find logically
an individual entity:
implied functional dependencies. This collection of rules
a) 2NF
is called
b) 3NF
a) Axioms
c) 4NF
b) Armstrong’s axioms
d) 5NF
c) Armstrong
View Answer

Page 52 of 139
d) Closure d) Both Lossy and Lossy-join decomposition
View Answer View Answer

Answer: b Answer: d
Explanation: By applying these rules repeatedly, we can Explanation: Lossy-join decomposition is the
find all of F+, given F. decomposition used here .

2. Which of the following is not Armstrong’s Axiom? 5. There are two functional dependencies with the same
a) Reflexivity rule set of attributes on the left side of the arrow:
b) Transitivity rule A->BC
c) Pseudotransitivity rule A->B
d) Augmentation rule This can be combined as
View Answer a) A->BC
b) A->B
Answer: c
c) B->C
Explanation: It is possible to use Armstrong’s axioms to
d) None of the mentioned
prove that Pseudotransitivity rule is sound.
View Answer
3. The relation
Answer: a
employee(ID,name,street,Credit,street,city,salary) is
Explanation: This can be computed as the canonical
decomposed into
cover.
advertisement
6. Consider a relation R(A,B,C,D,E) with the following
employee1 (ID, name) functional dependencies:

employee2 (name, street, city, salary) ABC -> DE and

This type of decomposition is called D -> AB


a) Lossless decomposition
The number of superkeys of R is:
b) Lossless-join decomposition
a) 2
c) All of the mentioned
b) 7
d) None of the mentioned
c) 10
View Answer
d) 12
Answer: d View Answer
Explanation: Lossy-join decomposition is the
Answer: c
decomposition used here .
Explanation: A superkey is a combination of columns
Sanfoundry Certification Contest of the Month is Live. that uniquely identifies any row within a relational
100+ Subjects. Participate Now! database management system (RDBMS) table.

4. Inst_dept (ID, name, salary, dept name, building, 7. Suppose we wish to find the ID’s of the employees
budget) is decomposed into that are managed by people who are managed by the
employee with ID 123. Here are two possible queries:
instructor (ID, name, dept name, salary)
[Link] [Link]
department (dept name, building, budget)
FROM Emps ee, Emps ff
This comes under
a) Lossy-join decomposition WHERE [Link] = [Link] AND [Link] = 123;
b) Lossy decomposition
[Link] empID
c) Lossless-join decomposition
FROM Emps
Page 53 of 139
WHERE mgrID IN Answer: d
Explanation: The value of m must lie between the min
(SELECT empID FROM Emps WHERE mgrID = 123);
value of r and s and 0.
Which, if any, of the two queries above will correctly (in
10. Suppose relation R(A,B,C,D,E) has the following
SQL2) get the desired set of employee ID’s?
functional dependencies:
a) Both I and II
b) I only A -> B
c) II only
B -> C
d) Neither I nor I
View Answer BC -> A
Answer: a A -> D
Explanation: The query can be satisfied by any of the
two options. E -> A

8. Suppose relation R(A,B) currently has tuples {(1,2), D -> E


(1,3), (3,4)} and relation S(B,C) currently has {(2,5), (4,6), Which of the following is not a key?
(7,8)}. Then the number of tuples in the result of the a) A
SQL query: b) E
<i>SELECT * c) B, C
d) D
FROM R NATURAL OUTER JOIN S; </i>IS: View Answer
a) 2 Answer: c
b) 4 Explanation: Here the keys are not formed by B and C.
c) 6
d) None of the mentioned Database Questions and Answers – Algorithms for
View Answer Decomposition

Answer: a This set of Database Multiple Choice Questions &


Explanation: The SQL NATURAL JOIN is a type of EQUI Answers (MCQs) focuses on “Algorithms for
JOIN and is structured in such a way that, columns with Decomposition”.
same name of associate tables will appear once only. 1. A relation is in ____________ if an attribute of a
9. Suppose now that R(A,B) and S(A,B) are two relations composite key is dependent on an attribute of other
with r and s tuples, respectively (again, not necessarily composite key.
distinct). If m is the number of (not necessarily distinct) a) 2NF
tuples in the result of the SQL query: b) 3NF
c) BCNF
R intersect S; d) 1NF
View Answer
Then which of the following is the most restrictive,
correct condition on the value of m? Answer: b
a) m = min(r,s) Explanation: A relation is in 3 NF if an attribute of a
b) 0 <= m <= r + s composite key is dependent on an attribute of other
c) min(r,s) <= m <= max(r,s) composite key. (If an attribute of a composite key is
d) 0 <= m <= min(r,s) dependent on an attribute of other composite key then
View Answer the relation is not in BCNF, hence it has to be
decomposed.).

Page 54 of 139
2. What are the desirable properties of a decomposition Answer: a
a) Partition constraint Explanation: Here course id is not a superkey. Thus, class
b) Dependency preservation is not in BCNF.
c) Redundancy
Subscribe Now: DBMS Newsletter | Important Subjects
d) Security
Newsletters
View Answer
5. The algorithm that takes a set of dependencies and
Answer: b
adds one schema at a time, instead of decomposing the
Explanation: Lossless join and dependency preserving
initial schema repeatedly is
are the two goals of the decomposition.
a) BCNF algorithm
3. R (A,B,C,D) is a relation. Which of the following does b) 2NF algorithm
not have a lossless join dependency preserving BCNF c) 3NF synthesis algorithm
decomposition? d) 1NF algorithm
a) A->B, B->CD View Answer
b) A->B, B->C, C->D
Answer: c
c) AB->C, C->AD
Explanation: The result is not uniquely defined, since a
d) A->BCD
set of functional dependencies can have more than one
View Answer
canonical cover, and, further, in some cases, the result
Answer: d of the algorithm depends on the order in which it
Explanation: This relation gives a relation without any considers the dependencies in Fc.
loss in the values.
6. The functional dependency can be tested easily on
advertisement the materialized view, using the constraints
____________.
4.
a) Primary key
Class (course id, title, dept name, credits, sec id, b) Null
semester, YEAR, building, room NUMBER, capacity, c) Unique
TIME slot id) d) Both Null and Unique
View Answer
The SET OF functional dependencies that we require TO
hold ON class are: Answer: d
Explanation: Primary key contains both unique and not
course id->title, dept name, credits null constraints.
building, room number->capacity 7. Which normal form is considered adequate for
course id, sec id, semester, year->building, room normal relational database design?
NUMBER, TIME slot id a) 2NF
b) 5NF
A candidate KEY FOR this schema IS {course id, sec id, c) 4NF
semester, YEAR} d) 3NF
Consider the above conditions. Which of the following View Answer
relation holds? Answer: d
a) Course id-> title, dept name, credits Explanation: A relational database table is often
b) Title-> dept name, credits described as “normalized” if it is in the Third Normal
c) Dept name-> credits Form because most of the 3NF tables are free of
d) Cannot be determined insertion, update, and deletion anomalies.
View Answer

Page 55 of 139
8. Relation R with an associated set of functional b) in 3NF, but not in BCNF
dependencies, F, is decomposed into BCNF. The c) in 2NF, but not in 3NF
redundancy (arising out of functional dependencies) in d) not in 2NF
the resulting set of relations is View Answer
a) Zero
Answer: d
b) More than zero but less than that of an equivalent
Explanation: From the closure set of attributes we can
3NF decomposition
see that the key for the relation is AB. The FD B->G is a
c) Proportional to the size of F+
partial dependency, hence it is not in 2NF.
d) Indeterminate
View Answer Database Questions and Answers – Multivalued
Dependencies
Answer: b
Explanation: Redundancy in BCNF is low when This set of Database online quiz focuses on “Using
compared to 3NF. For more details on BCNF. Multivalued Dependencies”.
9. A table has fields F1, F2, F3, F4, and F5, with the 1. The normal form which satisfies multivalued
following functional dependencies: dependencies and which is in BCNF is
a) 4 NF
F1->F3
b) 3 NF
F2->F4 c) 2 NF
d) All of the mentioned
(F1,F2)->F5
View Answer
in terms of normalization, this table is in
Answer: a
a) 1NF
Explanation: Fourth normal form is more restrictive than
b) 2NF
BCNF.
c) 3NF
d) None of the mentioned 2. Which of the following is a tuple-generating
View Answer dependencies?
a) Functional dependency
Answer: a
b) Equality-generating dependencies
Explanation: Since the primary key is not given we have
c) Multivalued dependencies
to derive the primary key of the table. Using the closure
d) Non-functional dependency
set of attributes we get the primary key as (F1, F2). From
View Answer
functional dependencies, “F1->F3, F2->F4”, we can see
that there is partial functional dependency therefore it Answer: c
is not in 1NF. Hence the table is in 1NF. Explanation: Multivalued dependencies, do not rule out
the existence of certain tuples. Instead, they require
10. Let R(A,B,C,D,E,P,G) be a relational schema in which
that other tuples of a certain form be present in the
the following FDs are known to hold:
relation.
AB->CD
3. The main task carried out in the __________ is to
DE->P remove repeating attributes to separate tables.
a) First Normal Form
C->E b) Second Normal Form
P->C c) Third Normal Form
d) Fourth Normal Form
B->G View Answer
The relation schema R is
a) in BCNF
Page 56 of 139
Answer: a related entity set has its own schema and there is an
Explanation: Multivalued dependencies, do not rule out additional schema for the relationship set. For a
the existence of certain tuples. Instead, they require multivalued attribute, a separate schema is created
that other tuples of a certain form be present in the consisting of that attribute and the primary key of the
relation. entity set.

advertisement 7. Which of the following has each related entity set has
its own schema and there is an additional schema for
4. Which of the normal form is based on multivalued
the relationship set?
dependencies?
a) A many-to-many relationship set
a) First
b) A multivalued attribute of an entity set
b) Second
c) A one-to-many relationship set
c) Third
d) None of the mentioned
d) Fourth
View Answer
View Answer
Answer: a
Answer: d
Explanation: If a multivalued dependency holds and is
Explanation: Multivalued dependencies, do not rule out
not implied by the corresponding functional
the existence of certain tuples. Instead, they require
dependency, it usually arises from this source.
that other tuples of a certain form be present in the
relation. 8. In which of the following, a separate schema is
created consisting of that attribute and the primary key
5. Which forms has a relation that possesses data about
of the entity set.
an individual entity?
a) A many-to-many relationship set
a) 2NF
b) A multivalued attribute of an entity set
b) 3NF
c) A one-to-many relationship set
c) 4NF
d) None of the mentioned
d) 5NF
View Answer
View Answer
Answer: b
Answer: c
Explanation: If a multivalued dependency holds and is
Explanation: A Table is in 4NF if and only if, for every one
not implied by the corresponding functional
of its non-trivial multivalued dependencies X
dependency, it usually arises from this source.
\twoheadrightarrow Y, X is a superkey—that is, X is
either a candidate key or a superset thereof. 9. Fifth Normal form is concerned with
a) Functional dependency
Note: Join free Sanfoundry classes
b) Multivalued dependency
at Telegram or Youtube
c) Join dependency
6. If a multivalued dependency holds and is not implied d) Domain-key
by the corresponding functional dependency, it usually View Answer
arises from one of the following sources.
Answer: c
a) A many-to-many relationship set
Explanation: If a multivalued dependency holds and is
b) A multivalued attribute of an entity set
not implied by the corresponding functional
c) A one-to-many relationship set
dependency, it usually arises from this source.
d) Both A many-to-many relationship set and A
multivalued attribute of an entity set 10. In 2NF
View Answer a) No functional dependencies (FDs) exist
b) No multivalued dependencies (MVDs) exist
Answer: d
c) No partial FDs exist
Explanation: For a many-to-many relationship set each
Page 57 of 139
d) No partial MVDs exist d) All of the mentioned
View Answer View Answer

Answer: c Answer: a
Explanation: If a multivalued dependency holds and is Explanation: If a multivalued dependency holds and is
not implied by the corresponding functional not implied by the corresponding functional
dependency, it usually arises from this source. dependency, it usually arises from this source.

Database Questions and Answers – Database Design advertisement


Process
4. In which of the following, a separate schema is
This set of Database Multiple Choice Questions & created consisting of that attribute and the primary key
Answers (MCQs) focuses on “Database Design Process”. of the entity set.
a) A many-to-many relationship set
1. _____________ can help us detect poor E-R design.
b) A multivalued attribute of an entity set
a) Database Design Process
c) A one-to-many relationship set
b) E-R Design Process
d) All of the mentioned
c) Relational scheme
View Answer
d) Functional dependencies
View Answer Answer: b
Explanation: If a multivalued dependency holds and is
Answer: d
not implied by the corresponding functional
Explanation: For eg.,Suppose an instructor entity set had
dependency, it usually arises from this source.
attributes dept name and dept address, and there is a
functional dependency dept name -> dept address. 5. Suppose the user finds the usage of room
number and phone number in a relational schema there
2. If a multivalued dependency holds and is not implied
is [Link] is reduced by
by the corresponding functional dependency, it usually
a) Unique-role assumption
arises from one of the following sources.
b) Unique-key assignment
a) A many-to-many relationship set
c) Role intergral assignment
b) A multivalued attribute of an entity set
d) None of the mentioned
c) A one-to-many relationship set
View Answer
d) Both A many-to-many relationship set and A
multivalued attribute of an entity set Answer: a
View Answer Explanation: A desirable feature of a database design is
the unique-role assumption, which means that each
Answer: d
attribute name has a unique meaning in the database.
Explanation: For a many-to-many relationship set each
related entity set has its own schema and there is an Sanfoundry Certification Contest of the Month is Live.
additional schema for the relationship set. For a 100+ Subjects. Participate Now!
multivalued attribute, a separate schema is created
6. What is the best way to represent the attributes in a
consisting of that attribute and the primary key of the
large database?
entity set.
a) Relational-and
3. Which of the following has each related entity set has b) Concatenation
its own schema and there is an additional schema for c) Dot representation
the relationship set. d) All of the mentioned
a) A many-to-many relationship set View Answer
b) A multivalued attribute of an entity set
Answer: b
c) A one-to-many relationship set
Explanation: Example inst sec and student sec.

Page 58 of 139
7. Designers use which of the following to tune the 11. Representations such as the in the dept year
performance of systems to support time-critical relation, with one column for each value of an attribute,
operations? are called _______ they are widely used in spreadsheets
a) Denormalization and reports and in data analysis tools.
b) Redundant optimization a) Cross-tabs
c) Optimization b) Snapshot
d) Realization c) Both Cross-tabs and Snapshot
View Answer d) All of the mentioned
View Answer
Answer: a
Explanation: The process of taking a normalized schema Answer: a
and making it nonnormalized is called denormalization. Explanation: SQL includes features to convert data from
a normal relational representation to a crosstab.
8. In the schema (dept name, size) we have
relations total inst 2007, total inst 2008. Which Database Questions and Answers – Application
dependency have lead to this relation ? Programs and User Interfaces
a) Dept name, year->size
This set of Database Assessment Questions and Answers
b) Year->size
focuses on “Application Programs and User Interfaces”.
c) Dept name->size
d) Size->year 1. An approach to website design with the emphasis on
View Answer converting visitors to outcomes required by the owner is
referred to as:
Answer: a
a) Web usability
Explanation: The process of taking a normalized schema
b) Persuasion
and making it nonnormalized is called denormalization.
c) Web accessibility
9. Relation dept year(dept name, total inst 2007, total d) None of the mentioned
inst 2008, total inst 2009). Here the only functional View Answer
dependencies are from dept name to the other
Answer: b
attributes. This relation is in
Explanation: In computing, graphical user interface is a
a) Fourth NF
type of user interface that allows users to interact with
b) BCNF
electronic devices.
c) Third NF
d) Second NF 2. A method of modelling and describing user tasks for
View Answer an interactive application is referred to as:
a) Customer journey
Answer: b
b) Primary persona
Explanation: BCNF has only one normal form.
c) Use case
10. Thus a _______ of course data gives the values of all d) Web design persona
attributes, such as title and department, of all courses at View Answer
a particular point in time.
Answer: c
a) Instance
Explanation: The actions in GUI are usually performed
b) Snapshot
through direct manipulation of the graphical elements.
c) Both Instance and Snapshot
d) All of the mentioned 3. Information architecture influences:
View Answer a) Answer choice
b) Site structure
Answer: b
c) Labeling
Explanation: We use the term snapshot of data to mean
the value of the data at a particular point in time.
Page 59 of 139
d) Navigation design drawing, documenting an architecture or an engineering
View Answer design, using a contact print process.

Answer: b 7. Storyboards are intended to:


Explanation: The actions in GUI are usually performed a) Indicate the structure of a site during site design and
through direct manipulation of the graphical elements. as a user feature
b) Prototype of the screen layout showing navigation
advertisement
and main design elements
4. Also known as schematics, a way of illustrating the c) Integrate consistently available components on the
layout of an individual webpage is a: webpage (e.g. navigation, search boxes)
a) Wireframe d) Prototype typical customer journeys or click streams
b) Sitemap through a website
c) Card sorting View Answer
d) Blueprint
Answer: d
View Answer
Explanation: An application programming interface
Answer: a specifies how some software components should
Explanation: An application programming interface interact with each other.
specifies how some software components should
8. Which of the following occupies boot record of hard
interact with each other.
and floppy disks and activated during computer startup?
5. A graphical or text depiction of the relationship a) Worm
between different groups of content on a website is b) Boot sector virus
referred to as a: c) Macro virus
a) Wireframe d) Virus
b) Blueprint View Answer
c) Sitemap
Answer: b
d) Card sorting
Explanation: A blueprint is a reproduction of a technical
View Answer
drawing, documenting an architecture or an engineering
Answer: c design, using a contact print process.
Explanation: An application programming interface
9. A graphical or text depiction of the relationship
specifies how some software components should
between different groups of content on a website is a:
interact with each other.
a) Page template
Subscribe Now: DBMS Newsletter | Important Subjects b) Wireframe
Newsletters c) Site map
d) Cascading style sheet (CSS)
6. Blueprints are intended to: View Answer
a) Prototype of the screen layout showing navigation
and main design elements Answer: c
b) Show the grouping of pages and user journeys Explanation: In computing, graphical user interface is a
c) Indicate the structure of a site during site design and type of user interface that allows users to interact with
as a user feature electronic devices.
d) Prototype typical customer journeys or clickstreams
10. Which of the following is a description of
through a website
information organization schemes?
View Answer
a) Minimising the number of clicks needed to access
Answer: c relevant content
Explanation: A blueprint is a reproduction of a technical b) Providing an overall design to a site consistent with
the positioning of the products and services
Page 60 of 139
c) The menu options chosen to group and categorize Answer: b
information Explanation: For example, if the Google search page
d) Providing specific content and services appropriate to used a form with an input parameter
different audience members named q with the get method, and the user typed in the
View Answer string “silberschatz” and submitted the form, the
browser would request the following URL from the Web
Answer: c
server: [Link]
Explanation: In computing, graphical user interface is a
type of user interface that allows users to interact with advertisement
electronic devices.
4. A __________ is a program running on the server
Database Questions and Answers – Web Fundamentals machine, which accepts requests from a Web browser
and sends back results in the form of HTML documents.
This set of Database Multiple Choice Questions &
a) HTML
Answers (MCQs) focuses on “Web Fundamentals”.
b) HTTP
1. Which of the following is a valid uniform resource c) Web Server
locator? d) Web browser
a) [Link] View Answer
b) [Link]
Answer: c
c) [Link]
Explanation: The browser and Web server communicate
d) http:/[Link]/sigmod/
via HTTP. Web servers provide powerful features,
View Answer
beyond the simple transfer of documents.
Answer: a
5. The application program typically communicates with
Explanation: A uniform resource locator (URL) is a
a database server, through ___________ or other
globally unique name for each document that can be
protocols, in order to get or store data.
accessed on the Web.
a) JDBC
2. [Link] b) ODBC
In the above URL which one is the argument which is c) All of the mentioned
used for processing of the URL? d) None of the mentioned
a) google View Answer
b) [Link]
Answer: c
c) search
Explanation: The common gateway interface (CGI)
d) q=silberschatz
standard defines how the Web server communicates
View Answer
with application programs.
Answer: d
Subscribe Now: DBMS Newsletter | Important Subjects
Explanation: Argument is always placed after ? symbol.
Newsletters
3. HTTP defines two ways in which values entered by a
6. This extra information is usually maintained in the
user at the browser can be sent to the Web server. The
form of a _________ at the client.
_____ method encodes the values as part of the URL.
a) Cookie
a) Post
b) History
b) Get
c) Remainder
c) Read
d) None of the mentioned
d) Argument
View Answer
View Answer
Answer: a
Explanation: A cookie is simply a small piece of text
Page 61 of 139
containing identifying information and with an This set of Database Multiple Choice Questions &
associated name. Answers (MCQs) focuses on “Servlets and JSP”.

7. Which of the following is not true about HTML ? 1. The Java __________ specification defines an
a) <meta>…</meta> application programming interface for communication
b) <meta…./> between the Web server and the application program.
c) <metadata>…</metadata> a) Servlet
d) <metadata name=”” /> b) Server
View Answer c) Program
d) Randomize
Answer: b
View Answer
Explanation: Meta data is the data about data which is
included in the meta data tag. Answer: a
Explanation: Servlets are commonly used to generate
8. Html code contains:
dynamic responses to HTTP requests.
a) Tags
b) Attributes 2. The doGet() method in the example extracts values of
c) Elements the parameter’s type and number by using __________
d) All of the mentioned a) [Link]()
View Answer b) [Link]()
c) [Link]()
Answer: d
d) [Link]()
Explanation: <> are tags,size is a attribute.
View Answer
9. Html document must always be saved with:
Answer: a
a) .html
Explanation: These methods uses these values to run a
b) .htm
query against a database.
c) .doc
d) Both .html & .htm 3. How many JDBC driver types does Sun define?
View Answer a) One
b) Two
Answer: d
c) Three
Explanation: .doc is used only for the word document
d) Four
format.
View Answer
10. How many levels of headings are in html:
Answer: d
a) 2
Explanation: [Link]() is
b) 7
used to get the connection to the database.
c) 6
d) 4 advertisement
View Answer
4. Which JDBC driver Type(s) can be used in either
Answer: c applet or servlet code?
Explanation: The heading levels are h1,h2,h3,h4,h5,h6. a) Both Type 1 and Type 2
b) Both Type 1 and Type 3
c) Both Type 3 and Type 4
d) Type 4 only
View Answer

Answer: c
Database Questions and Answers – Servlets and JSP Explanation: In a Type 3 driver, a three-tier approach is

Page 62 of 139
used to accessing databases. The JDBC clients use d) All of the mentioned
standard network sockets to communicate with an View Answer
middleware application server. In a Type 4 driver, a pure
Answer: c
Java-based driver that communicates directly with
Explanation: JSP primarily uses Java for certain codes.
vendor’s database through socket connection.
9. What is bytecode?
5. What MySQL property is used to create a surrogate
a) Machine-specific code
key in MySQL?
b) Java code
a) UNIQUE
c) Machine-independent code
b) SEQUENCE
d) None of the mentioned
c) AUTO_INCREMENT
View Answer
d) None of the mentioned
View Answer Answer: c
Explanation: Java bytecode is the form of instructions
Answer: c
that the Java virtual machine executes. Each bytecode
Explanation: A surrogate key in a database is a unique
opcode is one byte in length, although some require
identifier for either an entity in the modeled world or an
parameters, resulting in some multi-byte instructions.
object in the database.
10. Where is metadata stored in MySQL?
Sanfoundry Certification Contest of the Month is Live.
a) In the MySQL database metadata
100+ Subjects. Participate Now!
b) In the MySQL database metasql
6. A JSP is transformed into a(n): c) In the MySQL database mysql
a) Java applet d) None of the mentioned
b) Java servlet View Answer
c) Either 1 or 2 above
Answer: c
d) Neither 1 nor 2 above
Explanation: Metadata contains data about other data
View Answer
which is given in the <meta>…</meta> tags.
Answer: b
Database Questions and Answers – Application
Explanation: Servlets are commonly used to generate
Architectures
dynamic responses to HTTP requests.
This set of Database Multiple Choice Questions &
7. Which JDBC driver Type(s) is(are) the JDBC-ODBC
Answers (MCQs) focuses on “Application Architectures”.
bridge?
a) Type 1 1. Which of the following is true for Seeheim model?
b) Type 2 a) Presentation is abstracted from dialogue and
c) Type 3 Application
d) Type 4 b) Presentation and Dialogue is abstracted from
View Answer Application
c) Presentation and Application is abstracted from
Answer: a
Dialogue
Explanation: In a Type 1 driver, a JDBC bridge is used to
d) None of the mentioned
access ODBC drivers installed on each client machine.
View Answer
8. What programming language(s) or scripting
Answer: a
language(s) does Java Server Pages (JSP) support?
Explanation: Presentation is abstracted from dialogue
a) VBScript only
and application.
b) Jscript only
c) Java only 2. Which of the unit operation is used in Model view
controller?
Page 63 of 139
a) Is a Decomposition interfaces of mobile phones, which have much smaller
b) Part Whole Decomposition screens.
c) All of the mentioned
Subscribe Now: DBMS Newsletter | Important Subjects
d) None of the mentioned
Newsletters
View Answer
6. The ______________ layer, which provides the
Answer: b
interface between the business-logic layer and the
Explanation: Part whole decomposition is applied to
underlying database.
MVC.
a) Business logic
3. Memory address refers to the successive memory b) Presentation
words and the machine is called as _______________ c) User interaction
a) word addressable d) Data access
b) byte addressable View Answer
c) bit addressable
Answer: d
d) Terra byte addressable
Explanation: Many applications use an object-oriented
View Answer
language to code the business-logic layer, and use an
Answer: a object-oriented model of data, while the underlying
Explanation: Part whole decomposition is applied to database is a relational database.
MVC.
7. The _____________ system is widely used for
advertisement mapping from Java objects to relations.
a) Hibernate
4. Which layer deals which deals with user interaction is
b) Object oriented
called _____________ layer.
c) Objective
a) Business logic
d) None of the mentioned
b) Presentation
View Answer
c) User interaction
d) Data access Answer: a
View Answer Explanation: In Hibernate, the mapping from each Java
class to one or more relations is specified in a mapping
Answer: b
file.
Explanation: The single application may have several
different versions of this layer, corresponding to distinct 8. Which among the following are the functions that any
kinds of interfaces such as Web browsers, and user system with a user interface must provide?
interfaces of mobile phones, which have much smaller a) Presentation
screens. b) Dialogue
c) All of the mentioned
5. The _____________ layer, which provides a high-level
d) None of the mentioned
view of data and actions on data.
View Answer
a) Business logic
b) Presentation Answer: a
c) User interaction Explanation: Presentation and Application are the
d) Data access functions that any system with a user interface must
View Answer provide.

Answer: a 9. Which of the following is the main task accomplished


Explanation: The single application may have several by the user?
different versions of this layer, corresponding to distinct a) Compose a document
kinds of interfaces such as Web browsers, and user b) Create a spread sheet
Page 64 of 139
c) Send mail 3. Which of the following object types below cannot be
d) All of the mentioned replicated?
View Answer a) Data
b) Trigger
Answer: d
c) View
Explanation: All of the mentioned are the main task
d) Sequence
accomplished by the user.
View Answer
10. What are the portability concerns founded in
Answer: d
Seeheim model?
Explanation: Sequence is a series of items which is like a
a) Replacing the presentation toolkit
unique index.
b) Replacing the application toolkit
c) Replacing the dialogue toolkit advertisement
d) Replacing the presentation & application toolkit
4. How to force a log switch?
View Answer
a) By using ALTER SYSTEM LOG
Answer: d b) By using ALTER SYSTEM SWITCH LOGFILE
Explanation: The portability concerns founded in c) By using ALTER SYSTEM SWITCH LOGS
Seeheim model are- Replacing the presentation toolkit d) By using ALTER SYS LOGFILES
and Replacing the application toolkit. View Answer

Database Questions and Answers – Rapid Application Answer: b


Development Explanation: ALTER SYSTEM ARCHIVE LOG CURRENT is
the best practice for production backup scripts with
This set of Database Multiple Choice Questions &
RMAN. .
Answers (MCQs) focuses on “Rapid Application
Development”. 5. In the following query, which expression is evaluated
first?
1. Which schema object instructs Oracle to connect to a
remotely access an object of a database? Note: Join free Sanfoundry classes
a) Sequence at Telegram or Youtube
b) Remote link
SELECT id_number, (quantity - 100 / 0.15 - 35 * 20)
c) Database link
FROM inventory
d) Data link
View Answer a) 100 / 0.15
b) quantity – 100
Answer: d
c) 35*20
Explanation: A database link (DBlink) is a definition of
d) 0.15-35
how to establish a connection from one Oracle database
View Answer
to another.
Answer: a
2. DML changes are
Explanation: According to the precedence of expression
a) Insert
as in BODMAS the expression evaluated.
b) Update
c) Create 6. The ORDER BY clause can only be used in
d) Both Insert and Update a) SELECT queries
View Answer b) INSERT queries
c) GROUP BY queries
Answer: d
d) HAVING queries
Explanation: Create is a DDL operation.
View Answer

Page 65 of 139
Answer: a group by job having sum(sal) > 2500;
Explanation: SELECT column_name,column_name c) select job, sum(sal) from emp where sum(sal) > 2500
FROM table_name and comm is null group by job;
ORDER BY column_name,column_name ASC|DESC;. d) select job, sum(sal) from emp group by job having
sum(sal) > 2500 and comm is not null;
7. Which of the following rule below are categories of
View Answer
an index?
a) Column and Functional Answer: b
b) Multiple Column and functional Explanation: For aggregate functions group by clause is
c) Column, Multiple Column and functional necessary.
d) None of the mentioned
View Answer
Database Questions and Answers – Application
Answer: a
Performance
Explanation: The CREATE INDEX statement is used to
create indexes in tables. This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “Application Performance”.
8. What is the purpose of SMON background process?
a) Performs crash recovery when a failed instance starts 1. The indirect change of the values of a variable in one
up again module by another module is called
b) Performs recovery when a user process fails a) Internal change
c) Writes redo log entries to disk b) Inter-module change
d) None of the mentioned c) Side effect
View Answer d) Side-module update
View Answer
Answer: a
Explanation: SMON (System MONitor) is an Oracle Answer: c
background process created when you start a database Explanation: The module of the search tree and the flow
instance. is directed by its values.
9. Which of the following queries are legal? 2. Which of the following data structure is not linear
a) SELECT deptno, count(deptno) FROM emp GROUP BY data structure?
ename; a) Arrays
b) SELECT deptno, count(deptno), job FROM emp b) Linked lists
GROUP BY deptno; c) Arrays & Linked lists
c) SELECT deptno, avg(sal) FROM emp; d) None of the mentioned
d) SELECT deptno, avg(sal) FROM emp GROUP BY View Answer
deptno;
View Answer Answer: d
Explanation: Both array and linked lists are in data
Answer: d structure concepts.
Explanation: For aggregate functions group by clause is
necessary. 3. Which of the following data structure is linear data
structure?
10. Which of the following queries displays the sum of a) Trees
all employee salaries for those employees not making b) Graphs
commission, for each job, including only those sums c) Arrays
greater than 2500? d) None of the mentioned
a) select job, sum(sal) from emp where sum(sal) > 2500 View Answer
and comm is null;
b) select job, sum(sal) from emp where comm is null
Page 66 of 139
Answer: c Answer: a
Explanation: Tree and graphs are not linear. Explanation: The operator tree has a tree like format
where the evaluation starts from root of the tree.
advertisement
8. Linked lists are best suited
4. Which of the following criterion is NOT written using
a) For relatively permanent collections of data
the proper syntax?
b) For the size of the structure and the data in the
a) “Haris”
structure are constantly changing
b) <500
c) All of the mentioned
c) NO VALUE
d) None of the mentioned
d) Between #1/1/2000# and #12/31/2000#
View Answer
View Answer
Answer: b
Answer: c
Explanation: A linked list is a data structure consisting of
Explanation: NO VALUE cannot be specified.
a group of nodes which together represent a sequence.
5. The operation of processing each element in the list is
9. Each array declaration need not give, implicitly or
known as
explicitly, the information about
a) Sorting
a) The name of array
b) Merging
b) The data type of array
c) Inserting
c) The first data from the set to be stored
d) Traversal
d) The index set of the array
View Answer
View Answer
Answer: d
Answer: c
Explanation: There are several types of traversals.
Explanation: The operator tree has a tree like format
Sanfoundry Certification Contest of the Month is Live. where the evaluation starts from root of the tree.
100+ Subjects. Participate Now!
10. The elements of an array are stored successively in
6. Finding the location of the element with a given value memory cells because
is: a) By this way computer can keep track only the address
a) Traversal of the first element and the addresses of other elements
b) Search can be calculated
c) Sort b) The architecture of computer memory does not allow
d) None of the mentioned arrays to store other than serially
View Answer c) All of the mentioned
d) None of the mentioned
Answer: b View Answer
Explanation: Search is performed by traversing through
the tree. Answer: a
Explanation: Memory is always allotted in order.
7. Arrays are best data structures
a) For relatively permanent collections of data Database Questions and Answers – Application
b) For the size of the structure and the data in the Security
structure are constantly changing
This set of Database Multiple Choice Questions &
c) All of the mentioned
Answers (MCQs) focuses on “Application Security”.
d) None of the mentioned
View Answer 1. In _________________ attacks, the attacker manages
to get an application to execute an SQL query created by
the attacker.

Page 67 of 139
a) SQL injection Answer: a
b) SQL Explanation: The two factors should not share a
c) Direct common vulnerability.
d) Application
5. Even with two-factor authentication, users may still
View Answer
be vulnerable to_____________attacks.
Answer: a a) Radiant
Explanation: Application security has to deal with b) Cross attack
several security threats and issues beyond those c) scripting
handled by SQL authorization. d) Man-in-the-middle
View Answer
2. A Web site that allows users to enter text, such as a
comment or a name, and then stores it and later display Answer: d
it to other users, is potentially vulnerable to a kind of Explanation: In such attacks, a user attempting to
attack called a ___________________ attack. connect to the application is diverted to a fake Web site,
a) Two-factor authentication which accepts the password from the user, and uses it
b) Cross-site request forgery immediately to authenticate to the original application.
c) Cross-site scripting
Sanfoundry Certification Contest of the Month is Live.
d) Cross-site scoring scripting
100+ Subjects. Participate Now!
View Answer
6. A single ______________ further allows the user to
Answer: c
be authenticated once, and multiple applications can
Explanation: In such an attack, a malicious user enters
then verify the user’s identity through an authentication
code written in a client-side scripting language such as
service without requiring reauthentication.
JavaScript or Flash instead of entering a valid name or
a) OpenID
comment.
b) Sign-on system
3. _________ is an attack which forces an end user to c) Security Assertion Markup Language (SAML)
execute unwanted actions on a web application in which d) Virtual Private Database (VPD)
he/she is currently authenticated. View Answer
a) Two-factor authentication
Answer: b
b) Cross-site request forgery
Explanation: Once the user logged in at one site, he
c) Cross-site scripting
does not have to enter his user name and password at
d) Cross-site scoring scripting
other sites that use the same single sign-on service.
View Answer
7. The ___________________ is a standard for
Answer: b
exchanging authentication and authorization
Explanation: Cross-site request forgery, also known as a
information between different security domains, to
one-click attack or session riding and abbreviated as
provide cross-organization single sign-on.
CSRF or XSRF.
a) OpenID
advertisement b) Sign-on system
c) Security Assertion Markup Language (SAML)
4. Many applications use _________________ where
d) Virtual Private Database (VPD)
two independent factors are used to identify a user.
View Answer
a) Two-factor authentication
b) Cross-site request forgery Answer: c
c) Cross-site scripting Explanation: The user’s password and other
d) Cross-site scoring scripting authentication factors are never revealed to the
View Answer application, and the user need not register explicitly
with the application.
Page 68 of 139
8. The __________ standard is an alternative for single 1. ___________ is widely used today for protecting data
sign-on across organizations, and has seen increasing in transit in a variety of applications such as data
acceptance in recent years. transfer on the Internet, and on cellular phone
a) OpenID networks.
b) Single-site system a) Encryption
c) Security Assertion Markup Language (SAML) b) Data mining
d) Virtual Private Database (VPD) c) Internet Security
View Answer d) Architectural security
View Answer
Answer: a
Explanation: The user’s password and other Answer: a
authentication factors are never revealed to the Explanation: Encryption is also used to carry out other
application, and the user need not register explicitly tasks, such as authentication.
with the application.
2. In a database where the encryption is applied the
9. _______________ allows a system administrator to data is cannot be handled by the unauthorised user
associate a function with a relation; the function returns without
a predicate that must be added to any query that uses a) Encryption key
the relation. b) Decryption key
a) OpenID c) Primary key
b) Single-site system d) Authorised key
c) Security Assertion Markup Language (SAML) View Answer
d) Virtual Private Database (VPD)
Answer: b
View Answer
Explanation: Even if the message is intercepted by an
Answer: d enemy, the enemy, not knowing the key, will not be able
Explanation: Some database systems provide to decrypt and understand the message.
mechanisms for fine-grained authorization.
3. Which of the following is not a property of good
10. VPD provides authorization at the level of specific encryption technique?
tuples, or rows, of a relation, and is therefore said to be a) Relatively simple for authorized users to encrypt and
a _____________ mechanism. decrypt data
a) Row-level authorization b) Decryption key is extremely difficult for an intruder to
b) Column-level authentication determine
c) Row-type authentication c) Encryption depends on a parameter of the algorithm
d) Authorization security called the encryption key
View Answer d) None of the mentioned
View Answer
Answer: a
Explanation: Oracle Virtual Private Database (VPD) Answer: d
allows a system administrator to associate a function Explanation: Here a, b and c are the properties have to
with a relation. be present in a good design of an encryption technique.

Database Questions and Answers – Encryption and Its advertisement


Applications
4. In which of the following encryption key is used to
This set of Database Multiple Choice Questions & encrypt and decrypt the data?
Answers (MCQs) focuses on “Encryption and Its a) Public key
Applications”. b) Private key
c) Symmetric key

Page 69 of 139
d) Asymmetric key authenticity of the user by decrypting the string with
View Answer the same secret password and checking the result with
the original challenge string.
Answer: c
Explanation: In public-key (also known as asymmetric- 8. Assymmetric Encryption: Why can a message
key) encryption techniques, there are two different keys, encrypted with the Public Key only be decrypted with
the public key and the private key, used to encrypt and the receiver’s appropriate Private Key?
decrypt the data. a) Not true, the message can also be decrypted with the
Public Key
5. Encryption of small values, such as identifiers or
b) A so called “one way function with back door” is
names, is made complicated by the possibility of
applied for the encryption
__________
c) The Public Key contains a special function which is
a) Dictionary attacks
used to encrypt the message and which can only be
b) Database attacks
reversed by the appropriate Private Key
c) Minor attacks
d) The encrypted message contains the function for
d) Random attacks
decryption which identifies the Private Key
View Answer
View Answer
Answer: a
Answer: b
Explanation: This happens when particularly if the
Explanation: An one-way function is a function which a
encryption key is publicly available.
computer can calculate quickly, but whose reversal
Sanfoundry Certification Contest of the Month is Live. would last months or years. An one-way function with
100+ Subjects. Participate Now! back door can be reversed with the help of a couple of
additional information (the back door), but scarcely
6. Which one of the following uses a 128bit round key to without this information. The information for the back
encrypt the data using XOR and use it in reverse to door is contained in the private Key.
decrypt it?
a) Round key algorithm 9. Which is the largest disadvantage of symmetric
b) Public key algorithm Encryption?
c) Advanced Encryption Standard a) More complex and therefore more time-consuming
d) Asymmetric key algorithm calculations
View Answer b) Problem of the secure transmission of the Secret Key
c) Less secure encryption function
Answer: c d) Isn’t used any more
Explanation: The standard is based on the Rijndael View Answer
algorithm.
Answer: b
7. Which of the following requires no password travel Explanation: As there is only one key in the symmetrical
across the internet? encryption, this must be known by both sender and
a) Readable system recipient and this key is sufficient to decrypt the secret
b) Manipulation system message. Therefore it must be exchanged between
c) Challenge–response system sender and receiver in such a manner that an
d) Response system unauthorized person can in no case take possession of
View Answer it.
Answer: c 10. Which is the principle of the encryption using a key?
Explanation: The database system sends a challenge a) The key indicates which function is used for
string to the user. The user encrypts the challenge string encryption. Thereby it is more difficult to decrypt an
using a secret password as encryption key and then intercepted message as the function is unknown
returns the result. The database system can verify the b) The key contains the secret function for encryption
Page 70 of 139
including parameters. Only a password can activate the 3. Which of the following stores several gigabytes of
key data but usually lost when power failure?
c) All functions are public, only the key is secret. It a) Flash memory
contains the parameters used for the encryption resp. b) Disk
decryption c) Main memory
d) The key prevents the user of having to reinstall the d) Secondary memory
software at each change in technology or in the View Answer
functions for encryption
Answer: c
View Answer
Explanation: The contents of main memory are usually
Answer: b lost if a power failure or system crash occurs.
Explanation: The encoding of a message is calculated by
advertisement
an algorithm. If always the same algorithm would be
used, it would be easy to crack intercepted messages. 4. The flash memory storage used are
However, it isn’t possible to invent a new algorithm a) NOR Flash
whenever the old one was cracked, therefore the b) OR Flash
possibility to parameterize algorithms is needed and this c) AND Flash
is the assignment of the key. d) All of the mentioned
View Answer
Database Questions and Answers – Physical Storage
Media Answer: a
Explanation: NAND flash has a much higher storage
This set of Database Multiple Choice Questions &
capacity for a given cost, and is widely used for data
Answers (MCQs) focuses on “Physical Storage Media”.
storage in devices such as cameras, music players, and
1. Which of the following is a physical storage media? cell phones.
a) Tape Storage
5. __________ is increasingly being used in server
b) Optical Storage
systems to improve performance by caching frequently
c) Flash memory
used data, since it provides faster access than disk, with
d) All of the mentioned
larger storage capacity than main memory.
View Answer
a) Flash memory
Answer: d b) Disk
Explanation: The storage media are classified by the c) Main memory
speed with which data can be accessed, by the cost per d) Secondary memory
unit of data to buy the medium, and by the medium’s View Answer
reliability.
Answer: a
2. The _________ is the fastest and most costly form of Explanation: Flash memory is of two types – NAND and
storage, which is relatively small; its use is managed by NOR.
the computer system hardware.
Note: Join free Sanfoundry classes
a) Cache
at Telegram or Youtube
b) Disk
c) Main memory 6. Which is the cheapest memory device in terms of
d) Flash memory costs/ bit?
View Answer a) Semiconductor memory
b) Magnetic disks
Answer: a
c) Compact disks
Explanation: Cache storage is easy to access because it is
d) Magnetic tapes
closer to the processor.
View Answer
Page 71 of 139
Answer: c Answer: c
Explanation: Compact disk is used for easy storage at Explanation: Tape storage is used primarily for backup
lower cost. and archival data.

7. The primary medium for the long-term online storage Database Questions and Answers – Magnetic Disk and
of data is the __________ where the entire database is Flash Storage
stored on magnetic disk.
This set of Database Multiple Choice Questions &
a) Semiconductor memory
Answers (MCQs) focuses on “Magnetic Disk and Flash
b) Magnetic disks
Storage”.
c) Compact disks
d) Magnetic tapes 1. In magnetic disk ________ stores information on a
View Answer sector magnetically as reversals of the direction of
magnetization of the magnetic material.
Answer: b
a) Read–write head
Explanation: The system must move the data from disk
b) Read-assemble head
to main memory so that they can be accessed.
c) Head–disk assemblies
8. Optical disk _______ systems contain a few drives and d) Disk arm
numerous disks that can be loaded into one of the View Answer
drives automatically (by a robot arm) on demand.
Answer: d
a) Tape Storage
Explanation: Each side of a platter of a disk has a read–
b) Jukebox
write head that moves across the platter to access
c) Flash memory
different tracks.
d) All of the mentioned
View Answer 2. A __________ is the smallest unit of information that
can be read from or written to the disk.
Answer: b
a) Track
Explanation: The most popular form of optical disks are
b) Spindle
CD and DVD.
c) Sector
9. There are “record-once” versions of the compact disk d) Platter
and digital video disk, which can be written only once; View Answer
such disks are also called __________ disks.
Answer: c
a) Write-once, read-many (WORM)
Explanation: The disk surface is logically divided into
b) CD-R
tracks, which are subdivided into sectors.
c) DVD-W
d) CD-ROM 3. The disk platters mounted on a spindle and the heads
View Answer mounted on a disk arm are together known as
___________
Answer: a
a) Read-disk assemblies
Explanation: There are also “multiple-write” versions of
b) Head–disk assemblies
compact disk (called CD-RW) and digital video disk
c) Head-write assemblies
(DVD-RW, DVD+RW, and DVD-RAM), which can be
d) Read-read assemblies
written multiple times.
View Answer
10. Tape storage is referred to as __________ storage.
Answer: b
a) Direct-access
Explanation: Each side of a platter of a disk has a read–
b) Random-access
write head that moves across the platter to access
c) Sequential-access
different tracks.
d) All of the mentioned
View Answer
Page 72 of 139
advertisement d) Rotational latency time
View Answer
4. The disk controller uses ________ at each sector to
ensure that the data is not corrupted on data retrieval. Answer: b
a) Checksum Explanation: Average seek times currently range
b) Unit drive between 4 and 10 milliseconds, depending on the disk
c) Read disk model.
d) Readsum
8. Once the head has reached the desired track, the
View Answer
time spent waiting for the sector to be accessed to
Answer: a appear under the head is called the _______________
Explanation: A disk controller interfaces between the a) Access time
computer system and the actual hardware of the disk b) Average seek time
drive. c) Seek time
d) Rotational latency time
5. _________ is the time from when a read or write
View Answer
request is issued to when data transfer begins.
a) Access time Answer: d
b) Average seek time Explanation: Rotational speeds of disks today range
c) Seek time from 5400 rotations per minute (90 rotations per
d) Rotational latency time second) up to 15,000 rotations per minute (250
View Answer rotations per second), or, equivalently, 4 milliseconds to
11.1 milliseconds per rotation.
Answer: a
Explanation: To access (that is, to read or write) data on 9. In Flash memory, the erase operation can be
a given sector of a disk, the arm first must move so that performed on a number of pages, called an _______ at
it is positioned over the correct track, and then must once, and takes about 1 to 2 milliseconds.
wait for the sector to appear under it as the disk rotates. a) Delete block
b) Erase block
Note: Join free Sanfoundry classes
c) Flash block
at Telegram or Youtube
d) Read block
6. The time for repositioning the arm is called the View Answer
________ and it increases with the distance that the
Answer: b
arm must move.
Explanation: The size of an erase block (often referred to
a) Access time
as just “block” in flash literature) is usually significantly
b) Average seek time
larger than the block size of the storage system.
c) Seek time
d) Rotational latency time 10. Hybrid disk drives are hard-disk systems that
View Answer combine magnetic storage with a smaller amount of
flash memory, which is used as a cache for frequently
Answer: c
accessed data.
Explanation: Typical seek times range from 2 to 30
a) Hybrid drivers
milliseconds, depending on how far the track is from the
b) Disk drivers
initial arm position.
c) Hybrid disk drivers
7. _________ is around one-half of the maximum seek d) All of the mentioned
time. View Answer
a) Access time
Answer: b
b) Average seek time
Explanation: Frequently accessed data that are rarely
c) Seek time
updated are ideal for caching in flash memory.
Page 73 of 139
Database Questions and Answers – RAID multiple disks. It treats the array of disks as a single
large disk, and it gives blocks logical numbers.
This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “RAID”. 5. The RAID level which mirroring is done along with
stripping is
1. Which level of RAID refers to disk mirroring with block
a) RAID 1+0
striping?
b) RAID 0
a) RAID level 1
c) RAID 2
b) RAID level 2
d) Both RAID 1+0 and RAID 0
c) RAID level 0
View Answer
d) RAID level 3
View Answer Answer: d
Explanation: Mirroring without striping can also be used
Answer: a
with arrays of disks, to give the appearance of a single
Explanation: RAID level 1 refers to disk mirroring with
large, reliable disk.
block striping.
Sanfoundry Certification Contest of the Month is Live.
2. Optical disk technology uses
100+ Subjects. Participate Now!
a) Helical scanning
b) DAT 6. Where performance and reliability are both
c) A laser beam important, RAID level ____ is used.
d) RAID a) 0
View Answer b) 1
c) 2
Answer: d
d) 0+1
Explanation: Redundant Array of Inexpensive Disks.
View Answer
3. With multiple disks, we can improve the transfer rate
Answer: d
as well by ___________ data across multiple disks.
Explanation: Mirroring without striping can also be used
a) Striping
with arrays of disks, to give the appearance of a single
b) Dividing
large, reliable disk.
c) Mirroring
d) Dividing 7. ______________ partitions data and parity among all
View Answer N+1 disks, instead of storing data in N-disks and parity in
one disk.
Answer: a
a) Block interleaved parity
Explanation: Data striping consists of splitting the bits of
b) Block interleaved distributed parity
each byte across multiple disks; such striping is called
c) Bit parity
bitlevel striping.
d) Bit interleaved parity
advertisement View Answer

4. Which one of the following is a Stripping technique? Answer: b


a) Byte level stripping Explanation: In level 5, all disks can participate in
b) Raid level stripping satisfying read requests, unlike RAID level 4, where the
c) Disk level stripping parity disk cannot participate, so level 5 increases the
d) Block level stripping total number of requests that can be met in a given
View Answer amount of time.

Answer: d 8. Hardware RAID implementations permit _________


Explanation: Block-level striping stripes blocks across that is, faulty disks can be removed and replaced by new
ones without turning power off.
Page 74 of 139
a) Scrapping d) secondary storage
b) Swapping View Answer
c) Hot swapping
Answer: c
d) None of the mentioned
Explanation: Tertiary storage involves a robotic
View Answer
mechanism which will mount (insert) and dismount
Answer: c removable mass storage media into a storage device
Explanation: Hot according to the system’s demands; this data is often
swapping reduces the mean time to repair since copied to secondary storage before use.
replacement of a disk does not have to wait until a time
2. Operating system is responsible for
when the system can be shut down.
a) disk initialization
9. ___________ is popular for applications such as b) booting from disk
storage of log files in a database system since it offers c) bad-bock recovery
the best write performance. d) all of the mentioned
a) RAID level 1 View Answer
b) RAID level 2
Answer: d
c) RAID level 0
Explanation: Tertiary storage involves a robotic
d) RAID level 3
mechanism which will mount (insert) and dismount
View Answer
removable mass storage media into a storage device
Answer: a according to the system’s demands; this data is often
Explanation: RAID level 1 refers to disk mirroring with copied to secondary storage before use.
block striping.
3. A typical tape drive is ________ a typical disk drive.
10. ______________ which increases the number of I/O a) more expensive than
operations needed to write a single logical block, pays a b) cheaper than
significant time penalty in terms of write performance. c) of the same cost as
a) RAID level 1 d) none of the mentioned
b) RAID level 2 View Answer
c) RAID level 5
Answer: a
d) RAID level 3
Explanation: Tertiary storage involves a robotic
View Answer
mechanism which will mount (insert) and dismount
Answer: a removable mass storage media into a storage device
Explanation: In level 5, all disks can participate in according to the system’s demands; this data is often
satisfying read requests, unlike RAID level 4, where the copied to secondary storage before use.
parity disk cannot participate, so level 5 increases the
advertisement
total number of requests that can be met in a given
amount of time. 4. During recovery from a failure
a) each pair of physical block is examined
Database Questions and Answers – Tertiary Storage
b) specified pair of physical block is examined
This set of Database Multiple Choice Questions & c) first pair of physical block is examined
Answers (MCQs) focuses on “Tertiary Storage”. d) none of the mentioned
View Answer
1. Tertiary storage is built with :
a) a lot of money Answer: a
b) unremovable media Explanation: Tertiary storage involves a robotic
c) removable media mechanism which will mount (insert) and dismount
removable mass storage media into a storage device
Page 75 of 139
according to the system’s demands; this data is often d) Network
copied to secondary storage before use. View Answer

5. A magneto-optic disk is : Answer: d


a) primary storage Explanation: Network model has data stored in a
b) secondary storage hierarchical network flow.
c) tertiary storage
9. The surface area of a tape is ________ the surface
d) none of the mentioned
area of a disk.
View Answer
a) much lesser than
Answer: c b) much larger than
Explanation: Tertiary storage involves a robotic c) equal to
mechanism which will mount (insert) and dismount d) none of the mentioned
removable mass storage media into a storage device View Answer
according to the system’s demands; this data is often
Answer: b
copied to secondary storage before use.
Explanation: Network model has data stored in a
Sanfoundry Certification Contest of the Month is Live. hierarchical network flow.
100+ Subjects. Participate Now!
10. Which one of the following is not a secondary
6. Which of the following are the process of selecting storage?
the data storage and data access characteristics of the a) magnetic disks
database? b) magnetic tapes
a) Logical database design c) ram
b) Physical database design d) none of the mentioned
c) Testing and performance tuning View Answer
d) Evaluation and selecting
Answer: c
View Answer
Explanation: Tertiary storage involves a robotic
Answer: b mechanism which will mount (insert) and dismount
Explanation: Physical database design is the process of removable mass storage media into a storage device
selecting the data storage and data access according to the system’s demands; this data is often
characteristics of the database. copied to secondary storage before use.

7. The replacement of a bad block generally is not Database Questions and Answers – File Organisations
totally automatic because
This set of Database Multiple Choice Questions &
a) data in bad block cannot be replaced
Answers (MCQs) focuses on “File Organisations”.
b) data in bad block is usually lost
c) bad block does not contain any data 1. Which level of RAID refers to disk mirroring with block
d) none of the mentioned striping?
View Answer a) RAID level 1
b) RAID level 2
Answer: b
c) RAID level 0
Explanation: Physical database design is the process of
d) RAID level 3
selecting the data storage and data access
View Answer
characteristics of the database.
Answer: a
8. Which of the following is the oldest database model?
Explanation: RAID (redundant array of independent
a) Relational
disks) is a way of storing the same data in different
b) Hierarchical
places (thus, redundantly) on multiple hard disks.
c) Physical
Page 76 of 139
2. A unit of storage that can store one or more records Answer: c
in a hash file organization is denoted as Explanation: A data file is a computer file which stores
a) Buckets data to use by a computer application or system.
b) Disk pages
Note: Join free Sanfoundry classes
c) Blocks
at Telegram or Youtube
d) Nodes
View Answer 6. The management information system (MIS) structure
with one main computer system is called a
Answer: a
a) Hierarchical MIS structure
Explanation: A unit of storage that can store one or
b) Distributed MIS structure
more records in a hash file organization is denoted as
c) Centralized MIS structure
buckets.
d) Decentralized MIS structure
3. The file organization which allows us to read records View Answer
that would satisfy the join condition by using one block
Answer: c
read is
Explanation: Structure of MIS may be understood by
a) Heap file organization
looking at the physical components of the information
b) Sequential file organization
system in an organization.
c) Clustering file organization
d) Hash file organization 7. A top-to-bottom relationship among the items in a
View Answer database is established by a
a) Hierarchical schema
Answer: c
b) Network schema
Explanation: All systems in the cluster share a common
c) Relational schema
file structure via NFS, but not all disks are mounted on
d) All of the mentioned
all other systems.
View Answer
advertisement
Answer: a
4. What are the correct features of a distributed Explanation: A hierarchical database model is a data
database? model in which the data is organized into a tree-like
a) Is always connected to the internet structure. The structure allows representing information
b) Always requires more than three machines using parent/child relationships.
c) Users see the data in one global schema.
8. Choose the RDBMS which supports full fledged client
d) Have to specify the physical location of the data when
server application development
an update is done
a) dBase V
View Answer
b) Oracle 7.1
Answer: c c) FoxPro 2.1
Explanation: Users see the data in one global schema. d) Ingress
View Answer
5. Each tablespace in an Oracle database consists of one
or more files called Answer: b
a) Files Explanation: RDBMS is Relational Database
b) name space Management System.
c) datafiles
9. One approach to standardization storing of data?
d) PFILE
a) MIS
View Answer
b) Structured programming
c) CODASYL specification

Page 77 of 139
d) None of the mentioned 3. Large collection of files are called ____________
View Answer a) Fields
b) Records
Answer: c
c) Database
Explanation: CODASYL is an acronym for “Conference on
d) Sectors
Data Systems Languages”.
View Answer
10. The highest level in the hierarchy of data
Answer: c
organization is called
Explanation: The operator tree has a tree like format
a) Data bank
where the evaluation starts from root of the tree .
b) Data base
c) Data file advertisement
d) Data record
4. Which of the following hardware component is the
View Answer
most important to the operation of a database
Answer: b management system?
Explanation: Database is a collection of all tables which a) High resolution video display
contains the data in form of fields. b) Printer
c) High speed, large capacity disk
Database Questions and Answers – Organization of
d) Mouse
Records in Files
View Answer
This set of Database Questions and Answers for
Answer: c
Aptitude test focuses on “Organization of Records in
Explanation: All the data are stored in form of memory
Files”.
in the disk.
1. If a piece of data is stored in two places in the
5. Which of the following is not true of the traditional
database, then
approach to information processing
a) Storage space is wasted
a) There is common sharing of data among the various
b) Changing the data in one spot will cause data
applications
inconsistency
b) It is file oriented
c) In can be more easily accessed
c) Programs are dependent on the file
d) Storage space is wasted & Changing the data in one
d) It is inflexible
spot will cause data inconsistency
View Answer
View Answer
Answer: a
Answer: d
Explanation: All the data are stored in form of memory
Explanation: The database is always consistent and so
in the disk.
there is no duplication.
Subscribe Now: DBMS Newsletter | Important Subjects
2. An audit trail ___________
Newsletters
a) Is used to make backup copies
b) Is the recorded history of operations performed on a 6. Which of these is not a feature of Hierarchical model?
file a) Organizes the data in tree-like structure
c) Can be used to restore lost information b) Parent node can have any number of child nodes
d) None of the mentioned c) Root node does not have any parent
View Answer d) Child node can have any number of parent nodes
View Answer
Answer: b
Explanation: This is more useful for all recovery actions.

Page 78 of 139
Answer: d atabase Questions and Answers – Data-Dictionary
Explanation: The data are traversed using several Storage
algorithms.
This set of Database Multiple Choice Questions &
7. Which of these data models is an extension of the Answers (MCQs) focuses on “Data-Dictionary Storage”.
relational data model?
1. A relational database system needs to maintain data
a) Object-oriented data model
about the relations, such as the schema of the relations.
b) Object-relational data model
This is called
c) Semi structured data model
a) Metadata
d) None of the mentioned
b) Catalog
View Answer
c) Log
Answer: b d) Dictionary
Explanation: All the data are stored in form of memory View Answer
in the disk.
Answer: a
8. The information about data in a database is called Explanation: Each side of a platter of a disk has a read–
_______ write head that moves across the platter to access
a) Metadata different tracks.
b) Hyper data
2. Relational schemas and other metadata about
c) Tera data
relations are stored in a structure called the
d) None of the mentioned
____________
View Answer
a) Metadata
Answer: a b) Catalog
Explanation: Metadata is information about a data. c) Log
d) Data Dictionary
9. A data dictionary is a special file that contains?
View Answer
a) The names of all fields in all files
b) The data types of all fields in all files Answer: d
c) The widths of all fields in all files Explanation: Data dictionary is also called as system
d) All of the mentioned catalog.
View Answer
3. ___________ is the collection of memory structures
Answer: d and Oracle background processes that operates against
Explanation: The data dictionary is structured in tables an Oracle database.
and views, just like other database data. a) Database
b) Instance
10. The DBMS acts as an interface between what two
c) Tablespace
components of an enterprise-class database system?
d) Segment
a) Database application and the database
View Answer
b) Data and the database
c) The user and the database application Answer: b
d) Database application and SQL Explanation: Instance is a snapshot of database at any
View Answer point of time.

Answer: a advertisement
Explanation: Database application is the interface with
4. A ________ is a logical grouping of database objects,
the user to access the database.
usually to facilitate security, performance, or the
availability of database objects such as tables and

Page 79 of 139
indexes. 8. An Oracle __________ is a set of tables and views
a) Tablespace that are used as a read-only reference about the
b) Segments database.
c) Extents a) Database dictionary
d) Blocks b) Dictionary table
View Answer c) Data dictionary
d) Dictionary
Answer: a
View Answer
Explanation: A tablespace is a storage location where
the actual data underlying database objects can be kept. Answer: c
Explanation: Data dictionary is also called as system
5. A tablespace is further broken down into ________
catalog.
a) Tablespace
b) Segments 9. A data dictionary is created when a __________
c) Extents created.
d) Blocks a) Instance
View Answer b) Segment
c) Database
Answer: b
d) Dictionary
Explanation: Segment names are used in create table
View Answer
and create index commands to place tables or indexes
on specific database devices. Answer: c
Explanation: Data dictionary is also called as system
Sanfoundry Certification Contest of the Month is Live.
catalog.
100+ Subjects. Participate Now!
10. An Oracle object type has two parts the _________
6. __________ is a contiguous group of blocks allocated
and__________
for use as part of a table, index, and so forth.
a) Instance and body
a) Tablespace
b) Segment and blocks
b) Segment
c) Specification and body
c) Extent
d) Body and segment
d) Block
View Answer
View Answer
Answer: c
Answer: c
Explanation: Segment names are used in create table
Explanation: An extent is a set of contiguous blocks
and create index commands to place tables or indexes
allocated in a database.
on specific database devices. An extent is a set of
7. ________ is the smallest unit of allocation in an contiguous blocks allocated in a database.
Oracle database.
Database Questions and Answers – Database Buffer
a) Database
b) Instance This set of Database Multiple Choice Questions &
c) Tablespace Answers (MCQs) focuses on “Database Buffer”.
d) Database Block
1. The _______ is that part of main memory available
View Answer
for storage of copies of disk blocks.
Answer: d a) Buffer
Explanation: Data block is a form of database space b) Catalog
allocation. c) Storage
d) Secondary storage
View Answer
Page 80 of 139
Answer: a b) Forced
Explanation: There is always a copy kept on disk of every c) Buffer
block, but the copy on disk may be a version of the d) All of the mentioned
block older than the version in the buffer. View Answer

2. A major goal of the database system is to minimize Answer: a


the number of block transfers between the disk and Explanation: Although many operating systems do not
memory. This is achieved by support pinned blocks, such a feature is essential for a
a) Buffer database system that is resilient to crashes.
b) Catalog
Sanfoundry Certification Contest of the Month is Live.
c) Storage
100+ Subjects. Participate Now!
d) Secondary storage
View Answer 6. There are situations in which it is necessary to write
back the block to disk, even though the buffer space
Answer: a
that it occupies is not needed. This write is called the
Explanation: There is always a copy kept on disk of every
a) Pinned block strategy
block, but the copy on disk may be a version of the
b) Forced output block
block older than the version in the buffer.
c) Buffer replacement strategy
3. The subsystem responsible for the allocation of buffer d) All of the mentioned
space is called the ___________ View Answer
a) Buffer
Answer: b
b) Buffer manager
Explanation: The main-memory contents and thus
c) Storage
buffer contents are lost in a crash, whereas data on disk
d) Secondary storage
usually survive a crash.
View Answer
7. The frequently used buffer replacement strategy is
Answer: b
a) Most recently used
Explanation: Programs in a database system make
b) Least recently used
requests (that is, calls) on the buffer manager when they
c) Longest block
need a block from disk.
d) All of the mentioned
advertisement View Answer

4. In the buffer where there is no space for another Answer: b


block, the block can be inserted using Explanation: If a block must be replaced, the least
a) Pinned block strategy recently referenced block is replaced.
b) Forced output block
8. In case the buffer manager do not write the blocks
c) Buffer replacement strategy
properly then the buffer manager uses
d) All of the mentioned
a) Replacement strategy
View Answer
b) Forced strategy
Answer: c c) Crash recovery system
Explanation: Most operating systems use a least recently d) Both Replacement and Forced strategy
used (LRU) scheme, in which the block that was View Answer
referenced least recently is written back to disk and is
Answer: c
removed from the buffer.
Explanation: The crash-recovery subsystem imposes
5. A block that is not allowed to be written back to disk stringent constraints on block replacement.
is said to be ______________
a) Pinned
Page 81 of 139
9. The technique where the blocks which have been
used are replaced is called
a) Replacement strategy
b) Forced strategy
c) Crash recovery system
d) Most recently used
View Answer

Answer: d
Explanation: The optimal strategy for block replacement
is the most recently used (MRU) strategy.

10. ___________________ frees the space occupied by


a block as soon as the final tuple of that block has been
processed.
a) Replacement strategy
b) Forced strategy
c) Toss immediate strategy
d) Most recently used
View Answer

Answer: c
Explanation: The optimal strategy for block replacement
is the most recently used (MRU) strategy.

Sanfoundry Global Education & Learning Series –


Database Management System.

Page 82 of 139
Database Questions and Answers – Ordered Indices data record with that search-key value and the rest of
the records will be in the sequential pointers.
This set of Database Multiple Choice Questions &
a) Dense
Answers (MCQs) focuses on “Ordered Indices”.
b) Sparse
1. In ordered indices the file containing the records is c) Straight
sequentially ordered, a ___________ is an index whose d) Continuous
search key also defines the sequential order of the file. View Answer
a) Clustered index
Answer: a
b) Structured index
Explanation: In a dense nonclustering index, the index
c) Unstructured index
must store a list of pointers to all records with the same
d) Nonclustered index
search-key value.
View Answer
5. In a __________ index, an index entry appears for
Answer: a
only some of the search-key values.
Explanation: Clustering index are also called primary
a) Dense
indices; the term primary index may appear to denote
b) Sparse
an index on a primary key, but such indices can in fact
c) Straight
be built on any search key.
d) Continuous
2. Indices whose search key specifies an order different View Answer
from the sequential order of the file are called
Answer: a
___________ indices.
Explanation: Sparse indices can be used only if the
a) Nonclustered
relation is stored in sorted order of the search key, that
b) Secondary
is if the index is a clustering index.
c) All of the mentioned
d) None of the mentioned Note: Join free Sanfoundry classes
View Answer at Telegram or Youtube

Answer: c 6. Incase the indices values are larger, index is created


Explanation: Nonclustering index is also called for these values of the index. This is called
secondary indices. a) Pointed index
b) Sequential index
3. An ____________ consists of a search-key value and
c) Multilevel index
pointers to one or more records with that value as their
d) Multiple index
search-key value.
View Answer
a) Index entry
b) Index hash Answer: c
c) Index cluster Explanation: Indices with two or more levels are called
d) Index map multilevel indices.
View Answer
7. A search key containing more than one attribute is
Answer: a referred to as a _________ search key.
Explanation: The pointer to a record consists of the a) Simple
identifier of a disk block and an offset within the disk b) Composite
block to identify the record within the block. c) Compound
d) Secondary
advertisement
View Answer
4. In a _______ clustering index, the index record
Answer: b
contains the search-key value and a pointer to the first
Explanation: The structure of the index is the same as
Page 83 of 139
that of any other index, the only difference being that number of collisions involving a particular key x is :
the search key is not a single attribute, but rather is a list a) Less than 1
of attributes. b) Less than n
c) Less than m
8. In B+ tree the node which points to another node is
d) Less than n/2
called
View Answer
a) Leaf node
b) External node Answer: a
c) Final node Explanation: Hashing is also a method of sorting key
d) Internal node values in a database table in an efficient manner.
View Answer
2. A technique for direct search is
Answer: d a) Binary Search
Explanation: Nonleaf nodes are also referred to as b) Linear Search
internal nodes. c) Tree Search
d) Hashing
9. Insertion of a large number of entries at a time into
View Answer
an index is referred to as __________ of the index.
a) Loading Answer: d
b) Bulk insertion Explanation: Hashing is one way to enable security
c) Bulk loading during the process of message transmission when the
d) Increase insertion message is intended for a particular recipient only.
View Answer
3. The searching technique that takes O (1) time to find
Answer: c a data is
Explanation: Bulk loading is used to improve efficiency a) Linear Search
and scalability. b) Binary Search
c) Hashing
10. While inserting the record into the index, if the
d) Tree Search
search-key value does not appear in the index.
View Answer
a) The system adds a pointer to the new record in the
index entry Answer: c
b) The system places the record being inserted after the Explanation: A formula generates the hash, which helps
other records with the same search-key values to protect the security of the transmission from
c) The system inserts an index entry with the search-key unauthorized users.
value in the index at the appropriate position
advertisement
d) None of the mentioned
View Answer 4. The goal of hashing is to produce a search that takes
a) O(1) time
Answer: c
b) O(n2 )time
Explanation: If the index entry stores pointers to all
c) O(log n ) time
records with the same search key value, the system adds
d) O(n log n ) time
a pointer to the new record in the index entry.
View Answer
Database Questions and Answers – Hashing techniques
Answer: a
This set of Database Multiple Choice Questions & Explanation: Time complexity is given by the big oh
Answers (MCQs) focuses on “Hashing techniques”. notation.

1. If h is any hashing function and is used to hash n keys 5. Consider a hash table of size seven, with starting
in to a table of size m, where n<=m, the expected index zero, and a hash function (3x + 4)mod7. Assuming

Page 84 of 139
the hash table is initially empty, which of the following is c) Two entries with different keys have the same exact
the contents of the table when the sequence 1, 3, 8, 10 hash value
is inserted into the table using closed hashing? Note d) Two entries with the exact same key have different
that ‘_’ denotes an empty location in the table. hash values
a) 8, _, _, _, _, _, 10 View Answer
b) 1, 8, 10, _, _, _, 3
Answer: a
c) 1, _, _, _, _, _,3
Explanation: This level is the root of the tree.
d) 1, 10, 8, _, _, _, 3
View Answer 9. Which of the following scenarios leads to linear
running time for a random search hit in a linear-probing
Answer: b
hash table?
Explanation: A formula generates the hash, which helps
a) All keys hash to same index
to protect the security of the transmission from
b) All keys hash to different indices
unauthorized users.
c) All keys hash to an even-numbered index
Sanfoundry Certification Contest of the Month is Live. d) All keys hash to different even-numbered indices
100+ Subjects. Participate Now! View Answer

6. A hash table can store a maximum of 10 records, Answer: a


currently there are records in location 1, 3,4,7,8,9,10. Explanation: If all keys hash to the same location then
The probability of a new record going into location 2, the i-th inserted key would need i lookups to be found.
with hash functions resolving collisions by linear probing The probability of looking up i-th key is 1/n (since it’s
is random). If you know some probability it’s trivial to
a) 0.1 show that such lookups have linear time.
b) 0.6
10. Breadth First Search is used in
c) 0.2
a) Binary trees
d) 0.5
b) Stacks
View Answer
c) Graphs
Answer: b d) All of the mentioned
Explanation: Hashing is used to index and retrieve items View Answer
in a database because it is easier to find the item using
Answer: c
the shortened hashed key than using the original value.
Explanation: Hashing is used to index and retrieve items
7. Key value pairs is usually seen in in a database because it is easier to find the item using
a) Hash tables the shortened hashed key than using the original value.
b) Heaps
Database Questions and Answers – Ordered Indexing
c) Both Hash tables and Heaps
and Hashing
d) Skip list
View Answer This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “Ordered Indexing and
Answer: a
Hashing”.
Explanation: Hashing is used to index and retrieve items
in a database because it is easier to find the item using 1. A(n) _________ can be used to preserve the integrity
the shortened hashed key than using the original value. of a document or a message.
a) Message digest
8. What is the best definition of a collision in a hash
b) Message summary
table?
c) Encrypted message
a) Two entries are identical except for their keys
d) None of the mentioned
b) Two entries with different data have the exact same
View Answer
key
Page 85 of 139
Answer: c Answer: b
Explanation: Encryption algorithms are used to keep the Explanation: Data dictionary is the place where the
contents safe. meaning of the data are organized.

2. A hash function must meet ________ criteria. Subscribe Now: DBMS Newsletter | Important Subjects
a) Two Newsletters
b) Three
6. In the client / server model, the database:
c) Four
a) Is downloaded to the client upon request
d) None of the mentioned
b) Is shared by both the client and server
View Answer
c) Resides on the client side
Answer: b d) Resides on the server side
Explanation: Only if the criteria is fulfilled the values are View Answer
hashed.
Answer: d
3. What is the main limitation of Hierarchical Explanation: The server has all the database information
Databases? and the client access it.
a) Limited capacity (unable to hold much data)
7. The traditional storage of data that is organized by
b) Limited flexibility in accessing data
customer, stored in separate folders in filing cabinets is
c) Overhead associated with maintaining indexes
an example of what type of ‘database’ system?
d) The performance of the database is poor
a) Hierarchical
View Answer
b) Network
Answer: b c) Object oriented
Explanation: In this, the data items are placed in a tree d) Relational
like hierarchical structure. View Answer

advertisement Answer: a
Explanation: Hierarchy is based on Parent-Child
4. The property (or set of properties) that uniquely
Relationship. Parent-Child Relationship Type is basically
defines each row in a table is called the:
1:N relationship.
a) Identifier
b) Index 8. The database design that consists of multiple tables
c) Primary key that are linked together through matching data stored in
d) Symmetric key each table is called
View Answer a) Hierarchical database
b) Network database
Answer: c
c) Object oriented database
Explanation: Primary is used to uniquely identify the
d) Relational database
tuples.
View Answer
5. The separation of the data definition from the
Answer: d
program is known as:
Explanation: A relational database is a collection of data
a) Data dictionary
items organized as a set of formally described tables
b) Data independence
from which data can be accessed or reassembled.
c) Data integrity
d) Referential integrity 9. The association role defines:
View Answer a) How tables are related in the database
b) The relationship between the class diagram and the
tables in the database
c) The tables that each attribute is contained
Page 86 of 139
d) Which attribute is the table’s primary key 3.
View Answer
advertisement
Answer: a
SELECT *
Explanation: The tables are always related in the
database to form consistency. FROM r
10. The purpose of an N-Ary association is: WHERE gender = ’f’ AND income level = ’L2’;
a) To capture a parent-child relationship
b) To deal with one to many relationships In this selection, we fetch the bitmaps for gender value f
c) To deal with relationships that involve more than two and the bitmap for income level value L2, and perform
tables an ________ of the two bitmaps.
d) To represent an inheritance relationship a) Union
View Answer b) Addition
c) Combination
Answer: c d) Intersection
Explanation: The is binary n-array association meaning View Answer
more than two classes are involved in the relationship.
Answer: d
Sanfoundry Global Education & Learning Series – Explanation: We compute a new bitmap where bit i has
Database Management System. value 1 if the ith bit of the two bitmaps are both 1, and
has a value 0 otherwise.
Database Questions & Answers – Bitmap Indices
Subscribe Now: DBMS Newsletter | Important Subjects
This set of Database Multiple Choice Questions &
Newsletters
Answers (MCQs) focuses on “Bitmap Indices”.
4. To identify the deleted records we use the
1. Bitmap indices are a specialized type of index
______________
designed for easy querying on ___________
a) Existence bitmap
a) Bit values
b) Current bitmap
b) Binary digits
c) Final bitmap
c) Multiple keys
d) Deleted bitmap
d) Single keys
View Answer
View Answer
Answer: a
Answer: a
Explanation: The bitmaps which are deleted are
Explanation: Bitmap indices are a type of index that is
denoted by 0.
optimized for efficient querying on columns containing
boolean or bit values. Each value in the column has a 5. Bitmaps can be used as a compressed storage
corresponding bitmap, with each bit representing a row. mechanism at the leaf nodes of ________ for those
This enables fast querying and filtering of large datasets. values that occur very frequently.
a) B-trees
2. A _______ on the attribute A of relation r consists of
b) B+-trees
one bitmap for each value that A can take.
c) Bit trees
a) Bitmap index
d) Both B-trees and B+-trees
b) Bitmap
View Answer
c) Index
d) Array Answer: b
View Answer Explanation: Bitmaps are combined and stored in a B+
tree.
Answer: a
Explanation: A bitmap is simply an array of bits.
Page 87 of 139
6. Bitmaps can be combined with regular B+-tree indices an index on a primary key, but such indices can in fact
for relations where a few attribute values are extremely be built on any search key.
common, and other values also occur, but much less
10. Indices whose search key specifies an order different
frequently.
from the sequential order of the file are called
a) Bitmap, B-tree
___________ indices.
b) Bitmap, B+tree
a) Nonclustered
c) B-tree, Bitmap
b) Secondary
d) B+tree, Bitmap
c) All of the mentioned
View Answer
d) None of the mentioned
Answer: b View Answer
Explanation: Bitmaps are combined and stored in a B+
Answer: c
tree.
Explanation: Nonclustering index are also called
7. In a B+-tree index ______ for each value, we would secondary indices.
normally maintain a list of all records with that value for
Database Questions and Answers – Index Definition in
the indexed attribute.
SQL
a) Leaf
b) Node This set of Database Multiple Choice Questions &
c) Root Answers (MCQs) focuses on “Index Definition in SQL”.
d) Link
View Answer 1. What is the purpose of the index in sql server?
a) To enhance the query performance
Answer: a b) To provide an index to a record
Explanation: Bitmaps are combined and stored in a B+ c) To perform fast searches
tree. d) All of the mentioned
View Answer
8. A tablespace is further broken down into ________
a) Tablespace Answer: d
b) Segments Explanation: A database index is a data structure that
c) Extents improves the speed of data retrieval operations on a
d) Blocks database table at the cost of additional writes.
View Answer
2. How many types of indexes are there in sql server?
Answer: b a) 1
Explanation: Segment names are used in create table b) 2
and create index commands to place tables or indexes c) 3
on specific database devices. d) 4
View Answer
9. In ordered indices the file containing the records is
sequentially ordered, a ___________ is an index whose Answer: b
search key also defines the sequential order of the file. Explanation: They are clustered index and non clustered
a) Clustered index index.
b) Structured index
c) Unstructured index 3. How non clustered index point to the data?
d) Nonclustered index a) It never points to anything
View Answer b) It points to a data row
c) It is used for pointing data rows containing key values
Answer: a d) None of the mentioned
Explanation: Clustering index are also called primary View Answer
indices; the term primary index may appear to denote
Page 88 of 139
Answer: c 7. What are composite indexes?
Explanation: Nonclustered indexes have a structure a) Are those which are composed by database for its
separate from the data rows. A nonclustered index internal use
contains the nonclustered index key values and each key b) A composite index is a combination of index on 2 or
value entry has a pointer to the data row that contains more columns
the key value. c) Composite index can never be created
d) None of the mentioned
advertisement
View Answer
4. Which one is true about clustered index?
Answer: b
a) Clustered index is not associated with table
Explanation: A composite index is an index on two or
b) Clustered index is built by default on unique key
more columns of a table.
columns
c) Clustered index is not built on unique key columns 8. If an index is _________________ the metadata and
d) None of the mentioned statistics continue to exists
View Answer a) Disabling
b) Dropping
Answer: b
c) Altering
Explanation: Nonclustered indexes have a structure
d) Both Disabling and Dropping
separate from the data rows. A nonclustered index
View Answer
contains the nonclustered index key values and each key
value entry has a pointer to the data row that contains Answer: a
the key value. Explanation: A database index is a data structure that
improves the speed of data retrieval operations on a
5. What is true about indexes?
database table at the cost of additional writes.
a) Indexes enhance the performance even if the table is
updated frequently 9. In _______________ index instead of storing all the
b) It makes harder for sql server engines to work to columns for a record together, each column is stored
work on index which have large keys separately with all other rows in an index.
c) It doesn’t make harder for sql server engines to work a) Clustered
to work on index which have large keys b) Column store
d) None of the mentioned c) Non clustered
View Answer d) Row store
View Answer
Answer: b
Explanation: Indexes tend to improve the performance. Answer: b
Explanation: A database index is a data structure that
Note: Join free Sanfoundry classes
improves the speed of data retrieval operations on a
at Telegram or Youtube
database table at the cost of additional writes.
6. Does index take space in the disk?
10. A _________________ index is the one which
a) It stores memory as and when required
satisfies all the columns requested in the query without
b) Yes, Indexes are stored on disk
performing further lookup into the clustered index.
c) Indexes are never stored on disk
a) Clustered
d) Indexes take no space
b) Non Clustered
View Answer
c) Covering
Answer: b d) B-Tree
Explanation: Indexes take memory slots which are View Answer
located on the disk.
Answer: c
Explanation: A covered query is a query where all the
Page 89 of 139
columns in the query’s result set are pulled from non- d) Alternate key
clustered indexes. View Answer

Database Questions and Answers – Query Processing Answer: b


Explanation: A Candidate Key can be any column or a
This set of Database Multiple Choice Questions &
combination of columns that can qualify as unique key
Answers (MCQs) focuses on “Query Processing”.
in database.
1. A collection of data designed to be used by different
5. Which of the following are the process of selecting
people is called a/an
the data storage and data access characteristics of the
a) Organization
database?
b) Database
a) Logical database design
c) Relationship
b) Physical database design
d) Schema
c) Testing and performance tuning
View Answer
d) Evaluation and selecting
Answer: b View Answer
Explanation: Database is a collection of related tables.
Answer: b
2. Which of the following is the oldest database model? Explanation: The physical design of the database
a) Relational optimizes performance while ensuring data integrity by
b) Deductive avoiding unnecessary data redundancies.
c) Physical
Note: Join free Sanfoundry classes
d) Network
at Telegram or Youtube
View Answer
6. Which of the following terms does refer to the
Answer: d
correctness and completeness of the data in a
Explanation: The network model is a database model
database?
conceived as a flexible way of representing objects and
a) Data security
their relationships.
b) Data constraint
3. Which of the following schemas does define a view or c) Data independence
views of the database for particular users? d) Data integrity
a) Internal schema View Answer
b) Conceptual schema
Answer: d
c) Physical schema
Explanation: ACID property is satisfied by transaction in
d) External schema
database.
View Answer
7. The relationship between DEPARTMENT and
Answer: d
EMPLOYEE is a
Explanation: An externally-defined schema can provide
a) One-to-one relationship
access to tables that are managed on any PostgreSQL,
b) One-to-many relationship
Microsoft SQL Server, SAS, Oracle, or MySQL database.
c) Many-to-many relationship
advertisement d) Many-to-one relationship
View Answer
4. Which of the following is an attribute that can
uniquely identify a row in a table? Answer: b
a) Secondary key Explanation: One entity department is related to several
b) Candidate key employees.
c) Foreign key

Page 90 of 139
8. A table can be logically connected to another table by Answer: c
defining a Explanation: File scans are search algorithms that locate
a) Super key and retrieve records that fulfill a selection condition.
b) Candidate key
2. In a ____________ the system scans each file block
c) Primary key
and tests all records to see whether they satisfy the
d) Unique key
selection condition.
View Answer
a) Index Search
Answer: c b) Linear search
Explanation: A superkey is a combination of attributes c) File scan
that can be uniquely used to identify a database record. d) Access paths
View Answer
9. If the state of the database no longer reflects a real
state of the world that the database is supposed to Answer: b
capture, then such a state is called Explanation: An initial seek is required to access the first
a) Consistent state block of the file.
b) Parallel state
3. Index structures are referred to as __________ since
c) Durable state
they provide a path through which data can be located
d) Inconsistent state
and accessed.
View Answer
a) Index Search
Answer: d b) Linear search
Explanation: SQL data consistency is that whenever a c) File scan
transaction is performed, it sees a consistent database. d) Access paths
View Answer
10. Ensuring isolation property is the responsibility of
the Answer: d
a) Recovery-management component of the DBMS Explanation: A primary index is an index that allows the
b) Concurrency-control component of the DBMS records of a file to be read in an order that corresponds
c) Transaction-management component of the DBMS to the physical order in the file.
d) Buffer management component in DBMS
advertisement
View Answer
4. Search algorithms that use an index are referred to as
Answer: b
a) Index Search
Explanation: Concurrency control ensures that correct
b) Linear search
results for concurrent operations are generated while
c) File scan
getting those results as quickly as possible.
d) Access paths
Database Questions and Answers – Selection View Answer
Operation
Answer: a
This set of Database Multiple Choice Questions & Explanation: Selection predicates are used to guide in
Answers (MCQs) focuses on “Selection Operation”. the choice of the index to use in processing the query.

1. In query processing, the ___________ is the lowest- 5. Which algorithm uses equality comparison on a key
level operator to access data. attribute with a primary index to retrieve a single record
a) Index Search that satisfies the corresponding equality condition.
b) Linear search a) A2
c) File scan b) A4
d) Access paths c) A5
View Answer
Page 91 of 139
d) A6 c) A9
View Answer d) A6
View Answer
Answer: a
Explanation: A2 – primary index, equality on key. Answer: a
Explanation: A10 – Disjunctive selection by union of
Sanfoundry Certification Contest of the Month is Live.
identifiers.
100+ Subjects. Participate Now!
10. Conjunctive selection using one index. This is
6. The strategy can retrieve a single record if the
a) A10
equality condition is on a key; multiple records may be
b) A7
retrieved if the indexing field is not a key is
c) A9
a) A2
d) A6
b) A4
View Answer
c) A5
d) A6 Answer: b
View Answer Explanation: To reduce the cost of A7 we choose a i and
one of algorithms A1 through A6 for which the
Answer: b
combination results in the least cost for i (r ). The cost of
Explanation: A4 – Secondary index, equality.
algorithm A7 is given by the cost of the chosen
7. The algorithm that uses a secondary ordered index to algorithm.
guide retrieval for comparison conditions involving
Database Questions and Answers – Sorting
<,≤,≥, or > is
a) A2 This set of Database Multiple Choice Questions &
b) A4 Answers (MCQs) focuses on “Sorting”.
c) A5
1. Two main measures for the efficiency of an algorithm
d) A6
are
View Answer
a) Processor and memory
Answer: d b) Complexity and capacity
Explanation: A6 – Secondary index, comparison. c) Time and space
d) Data and space
8. The ___ algorithm scans each index for pointers to
View Answer
tuples that satisfy an individual condition.
a) A2 Answer: c
b) A4 Explanation: Depending on the time and space
c) A9 complexity only the algorithm for sorting will be chosen.
d) A6
2. The time factor when determining the efficiency of an
View Answer
algorithm is measured by
Answer: c a) Counting microseconds
Explanation: A9 – Conjunctive selection by an b) Counting the number of key operations
intersection of identifiers. c) Counting the number of statements
d) Counting the kilobytes of algorithm
9. If access paths are available on all the conditions of a
View Answer
disjunctive selection, each index is scanned for pointers
to tuples that satisfy the individual condition. This is Answer: b
satisfied by Explanation: The operations taking place with the time
a) A10 and space is counted.
b) A7

Page 92 of 139
3. The space factor when determining the efficiency of there at all
an algorithm is measured by View Answer
a) Counting the maximum memory needed by the
Answer: a
algorithm
Explanation: Algorithmic complexity is concerned about
b) Counting the minimum memory needed by the
how fast or slow particular algorithm performs.
algorithm
c) Counting the average memory needed by the 7. The complexity of the average case of an algorithm is
algorithm a) Much more complicated to analyze than that of worst
d) Counting the maximum disk space needed by the case
algorithm b) Much more simpler to analyze than that of worst case
View Answer c) Sometimes more complicated and some other times
simpler than that of worst case
Answer: a
d) None of the mentioned
Explanation: Time complexity maintains the maximum
View Answer
time needed.
Answer: a
advertisement
Explanation: Algorithmic complexity is concerned about
4. Which of the following case does not exist in how fast or slow particular algorithm performs.
complexity theory
8. The complexity of a linear search algorithm is
a) Best case
a) O(n)
b) Worst case
b) O(log n)
c) Average case
c) O(n2)
d) Null case
d) O(n log n)
View Answer
View Answer
Answer: d
Answer: a
Explanation: Null case cannot be counted as the factor
Explanation: It refers to n values complexity in the
for complexity.
algorithm which can be reduced by choosing the other
5. The Worst case occur in linear search algorithm when algorithms.
a) Item is somewhere in the middle of the array
9. The complexity of Binary search algorithm is
b) Item is not in the array at all
a) O(n)
c) Item is the last element in the array
b) O(log )
d) Item is the last element in the array or is not there at
c) O(n2)
all
d) O(n log n)
View Answer
View Answer
Answer: d
Answer: b
Explanation: Algorithmic complexity is concerned about
Explanation: This shows that it has a standard
how fast or slow particular algorithm performs.
complexity in addressing.
Sanfoundry Certification Contest of the Month is Live.
10. The complexity of Bubble sort algorithm is
100+ Subjects. Participate Now!
a) O(n)
6. The Average case occur in linear search algorithm b) O(log n)
a) When Item is somewhere in the middle of the array c) O(n2)
b) When Item is not in the array at all d) O(n log n)
c) When Item is the last element in the array View Answer
d) When Item is the last element in the array or is not

Page 93 of 139
Answer: c Database. The i stands for “Internet” to indicate that 9i
Explanation: Bubble sort, is a simple sorting algorithm is “Internet ready”.
that works by repeatedly stepping through the list to be
advertisement
sorted, comparing each pair of adjacent items and
swapping them if they are in the wrong order. 4. How many join types in join condition:
a) 2
Database Questions and Answers – Join Operations
b) 3
This set of Database Multiple Choice Questions & c) 4
Answers (MCQs) focuses on “Join Operations”. d) 5
View Answer
1. A_____ is a query that retrieves rows from more than
one table or view: Answer: d
a) Start Explanation: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL
b) End JOIN, EQUIJOIN.
c) Join
5. Which are the join types in join condition:
d) All of the mentioned
a) Cross join
View Answer
b) Natural join
Answer: c c) Join with USING clause
Explanation: An SQL join clause combines records from d) All of the mentioned
two or more tables in a database. It creates a set that View Answer
can be saved as a table or used as it is. A JOIN is a means
Answer: d
for combining fields from two tables by using values
Explanation: INNER JOIN, LEFT JOIN, RIGHT JOIN, FULL
common to each.
JOIN, EQUIJOIN are the types of joins.
2. A condition is referred to as __________
Subscribe Now: DBMS Newsletter | Important Subjects
a) Join in SQL
Newsletters
b) Join condition
c) Join in SQL & Condition 6. Which product is returned in a join query have no join
d) None of the mentioned condition:
View Answer a) Equijoins
b) Cartesian
Answer: b
c) Both Equijoins and Cartesian
Explanation: An SQL join clause combines records from
d) None of the mentioned
two or more tables in a database. It creates a set that
View Answer
can be saved as a table or used as it is. A JOIN is a means
for combining fields from two tables by using values Answer: b
common to each. Explanation: A Cartesian coordinate system is a
coordinate system that specifies each point uniquely in
3. Which oracle is the join condition is specified using
a plane by a pair of numerical coordinates.
the WHERE clause:
a) Oracle 9i 7. Which is a join condition contains an equality
b) Oracle 8i operator:
c) Pre-oracle 9i a) Equijoins
d) Pre-oracle 8i b) Cartesian
View Answer c) Both Equijoins and Cartesian
d) None of the mentioned
Answer: c
View Answer
Explanation: Oracle 9i is a version of the Oracle

Page 94 of 139
Answer: a This set of Database Multiple Choice Questions &
Explanation: An equi-join is a specific type of Answers (MCQs) focuses on “Evaluation of Expressions”.
comparator-based join, that uses only equality
1. Pictorial representation of an expression is called
comparisons in the join-predicate.
a) Expression tree
8. Which join refers to join records from the write table b) Operator tree
that have no matching key in the left table are include in c) Expression flow
the result set: d) Expression chart
a) Left outer join View Answer
b) Right outer join
Answer: b
c) Full outer join
Explanation: The operator tree has a tree like format
d) Half outer join
where the evaluation starts from root of the tree.
View Answer
2. The results of each intermediate operation are
Answer: b
created and then are used for evaluation of the next-
Explanation: A right outer join will return all the rows
level operations. This is called
that an inner join returns plus one row for each of the
a) Materialized evaluation
other rows in the second table that did not have a
b) Expression evaluation
match in the first table. It is the same as a left outer join
c) Tree evaluation
with the tables specified in the opposite order.
d) Tree materialization
9. Which operation are allowed in a join view: View Answer
a) UPDATE
Answer: a
b) INSERT
Explanation: The cost of a materialized evaluation is not
c) DELETE
simply the sum of the costs of the operations involved.
d) All of the mentioned
View Answer 3. ______________ allows the algorithm to execute
more quickly by performing CPU activity in parallel with
Answer: d
I/O activity.
Explanation: The DELETE statement is used to delete
a) Buffering
rows in a table. The UPDATE statement is used to update
b) Double buffering
existing records in a table. The INSERT INTO statement is
c) Multiple buffering
used to insert new records in a table.
d) Double reading
10. Which view that contains more than one table in the View Answer
top-level FROM clause of the SELECT statement:
Answer: a
a) Join view
Explanation: Double buffering using two buffers, with
b) Datable join view
one continuing execution of the algorithm while the
c) Updatable join view
other is being written out.
d) All of the mentioned
View Answer advertisement
Answer: c 4. Pipelines can be executed in
Explanation: The DELETE statement is used to delete a) 4
rows in a table. The UPDATE statement is used to update b) 3
existing records in a table. The INSERT INTO statement is c) 2
used to insert new records in a table. d) 5
View Answer
Database Questions and Answers – Evaluation of
Expressions

Page 95 of 139
Answer: c requests receive successive result tuples.
Explanation: Demand driven and producer driven a) State
pipelines are the two ways. b) Transition
c) Rate
5. In a _________ the system makes repeated requests
d) Block
for tuples from the operation at the top of the pipeline.
View Answer
a) Demand-driven pipeline
b) Producer-driven pipeline Answer: a
c) Demand pipeline Explanation: The function close() tells an iterator that no
d) All of the mentioned more tuples are required.
View Answer
9. Tuples are generated ___________ in producer-driven
Answer: a pipelining, they are generated ________ on demand, in
Explanation: Each time that an operation receives a demand-driven pipelining.
request for tuples, it computes the next tuple (or tuples) a) Lazily, Eagerly
to be returned, and then returns that tuple. b) Eagerly, Lazily
c) Slowly, Eagerly
Subscribe Now: DBMS Newsletter | Important Subjects
d) Eagerly, Slowly
Newsletters
View Answer
6. In a _____________ operations do not wait for
Answer: b
requests to produce tuples, but instead generate the
Explanation: Producer-driven pipelining is very useful in
tuples eagerly.
parallel processing systems.
a) Demand-driven pipeline
b) Producer-driven pipeline 10. When two inputs that we desire to pipeline into the
c) Demand pipeline join are not already sorted it is the _____________
d) All of the mentioned technique.
View Answer a) Hash join
b) Buffer join
Answer: b
c) double-pipelined hash join
Explanation: Each operation in a producer-driven
d) double-pipelined join
pipeline is modeled as a separate process or thread
View Answer
within the system that takes a stream of tuples from its
pipelined inputs and generates a stream of tuples for its Answer: d
output. Explanation: When hash indices are used on tuples, the
resultant algorithm is called the double-pipelined hash-
7. Each operation in a demand-driven pipeline can be
join technique.
implemented as an ____ that provides the following
functions: open(), next(), and close(). Database Questions and Answers – Transformation of
a) Demand Relational Expressions
b) Pipeline
This set of Database Questions and Answers for
c) Iterator
Entrance exams focuses on “Transformation of
d) All of the mentioned
Relational Expressions”.
View Answer
1. Consider the following relational schemes for a library
Answer: c
database:
Explanation: After a call to open(), each call to next()
returns the next output tuple of the operation. Book (Title, Author, Catalog_no, Publisher, YEAR, Price)
8. The iterator maintains the __________ of its Collection (Title, Author, Catalog_no)
execution in between calls so that successive next()
Page 96 of 139
WITH the following functional dependencies: schema
b) BINARY BASE32 returns the binary data in base32-
I. Title Author -> Catalog_no
encoded format
II. Catalog_no -> Title Author Publisher YEAR c) Each row in the query result is transformed into an
XML element
III. Publisher Title YEAR -> Price d) None of the mentioned
Assume {Author, Title} is the key for both schemes. View Answer
Which of the following statements is true? Answer: b
a) Both Book and Collection are in BCNF Explanation: XML was designed to transport and store
b) Both Book and Collection are in 3NF only data.
c) Book is in 2NF and Collection is in 3NF
d) Both Book and Collection are in 2NF only 4. ___________ refers to the ability of the system to
View Answer recover committed transaction updates if either the
system or the storage media fails.
Answer: c a) Isolation
Explanation: The relation Collection is in BCNF: Its given b) Atomicity
that {Author, Title} is the key and there is only one c) Consistency
functional dependency (FD) applicable to the relation d) Durability
Collection {i.e. Title Author –> Catalog_no}. View Answer
advertisement Answer: d
2. Let R(A,B,C,D,E,P,G) be a relational schema in which Explanation: In database systems, durability is the ACID
the following FDs are known to hold: property which guarantees that transactions that have
committed will survive permanently.
AB->CD
5. Which utilities can we use to export data from sql
DE->P server to a text file?
C->E a) DTS export wizard
b) BCP
P->C c) ISQL
d) DTS export wizard and BCP
B->G
View Answer
The relation schema R is
Answer: d
a) in BCNF
Explanation: The bcp utility bulk copies data between an
b) in 3NF, but not in BCNF
instance of Microsoft SQL Server and a data file in a
c) in 2NF, but not in 3NF
user-specified format.
d) not in 2NF
View Answer 6. You have a column that will only contain values from
0 to 256. What is the most economical data type to use
Answer: d
for the column?
Explanation: From the closure set of attributes we can
a) TINYINT
see that the key for the relation is AB. The FD B->G is a
b) SMALLINT
partial dependency, hence it is not in 2NF.
c) INT
Sanfoundry Certification Contest of the Month is Live. d) DECIMAL(1)
100+ Subjects. Participate Now! View Answer
3. Which of the following is/are false for RAW mode of Answer: b
FOR XML? Explanation: The bcp utility bulk copies data between an
a) XMLSCHEMA option does not returns an in-line XSD
Page 97 of 139
instance of Microsoft SQL Server and a data file in a Database Questions and Answers – Estimating
user-specified format. Statistics of Expression Results

7. Problems occurs if we don’t implement a proper This set of Database Questions and Answers for Campus
locking strategy interviews focuses on “Estimating Statistics of
a) Dirty reads Expression Results”.
b) Phantom reads
1. Which feature converts row data to a column for
c) Lost updates
better analytical view?
d) Unrepeatable reads
a) Views
View Answer
b) Join
Answer: b c) Pivot
Explanation: Phantom reads occur when an insert or d) Trigger
delete action is performed against a row that belongs to View Answer
a range of rows being read by a transaction.
Answer: c
8. Which of the following fixed database roles can add Explanation: Pivot table is very powerful and very easy
or remove user IDs? to use.
a) db_accessadmin
2. Which of the following statements is/are not true for
b) db_securityadmin
SQL profiler?
c) db_setupadmin
a) Enables you to monitor events
d) db_sysadmin
b) Check if rows are being inserted properly
View Answer
c) Check the performance of a stored procedure
Answer: a d) None of the mentioned
Explanation: The db_accessadmin role manages View Answer
security, but handles access to the database, as the
Answer: c
name implies.
Explanation: Stored procedures are like functions which
9. By default sql server has ___________ isolation level do not return values.
a) READ COMMITTED
3. Which global variables can be used to determine if a
b) READ UNCOMMITTED
transaction is still open?
c) SERIALIZABLE
a) @@NESTLEVEL
d) REPEATABLE READ
b) @@FETCH_STATUS
View Answer
c) @@TRANCOUNT
Answer: a d) @@CONNECTIONS
Explanation: READ UNCOMMITTED is the most View Answer
optimistic concurrency isolation option available in SQL
Answer: c
Server.
Explanation: PRINT @@TRANCOUNT — The BEGIN
10. Which of the following pair of regular expression are TRAN statement will increment the — transaction count
not equivalent? by 1.
a) 1(01)* and (10)*1
advertisement
b) x(xx)* and (xx)*x
c) (ab)* and a*b* 4. Which statement is used to define a cursor?
d) x+ and x*x+ a) OPEN
View Answer b) FETCH
c) DECLARE CURSOR
Answer: c
Explanation: (ab)*=(a*b*)*.
Page 98 of 139
d) @@FETCH_STATUS b) False
View Answer c) Depends on the result
d) Always safe
Answer: c
View Answer
Explanation: A database cursor is a control structure
that enables traversal over the records in a database. Answer: a
Explanation: Injection attack is not possible in SP.
5. What is the default “SORT” order for a SQL?
a) Ascending 9. Which of the following connection type supports
b) Descending application role permissions and password encryption?
c) As specified by the user a) OLE DB
d) None of the mentioned b) DBLib
View Answer c) ODBC
d) OLE DB and ODBC
Answer: a
View Answer
Explanation: Default is ascending order.
Answer: d
Sanfoundry Certification Contest of the Month is Live.
Explanation: Open Database Connectivity (ODBC) is
100+ Subjects. Participate Now!
Microsoft’s strategic interface for accessing data in a
6. Capabilities of RAISERROR heterogeneous environment of relational.
a) It can be logged in the error log
10. Cursor that reflects the changes made to the
b) It can print a message to the application
database table even after the result set is returned
c) It can assign an error number, state and severity
a) Static
d) All of the mentioned
b) Dynamic
View Answer
c) FORWARD_ONLY
Answer: d d) Keyset
Explanation: A relational database table is often View Answer
described as “normalized” if it is in the Third Normal
Answer: b
Form because most of the 3NF tables are free of
Explanation: A database cursor is a control structure
insertion, update, and deletion anomalies.
that enables traversal over the records in a database.
7. How inserting data through stored procedure do
Database Questions and Answers – Materialized Views
reduces network traffic and increase database
performance? This set of Database Multiple Choice Questions &
a) Stored procedure can accept parameter Answers (MCQs) focuses on “Materialized Views”.
b) Permission check is not required
1. Which normal form is considered adequate for
c) The execution plan is stored in the cache after it was
normal relational database design?
executed the first time
a) 2NF
d) None of the mentioned
b) 5NF
View Answer
c) 4NF
Answer: c d) 3NF
Explanation: A relational database table is often View Answer
described as “normalized” if it is in the Third Normal
Answer: d
Form because most of the 3NF tables are free of
Explanation: A relational database table is often
insertion, update, and deletion anomalies.
described as “normalized” if it is in the Third Normal
8. Stored procedures are safe from SQL injection attacks Form because most of the 3NF tables are free of
a) True insertion, update, and deletion anomalies.

Page 99 of 139
2. Consider a schema R(A, B, C, D) and functional Note: Join free Sanfoundry classes
dependencies A -> B and C -> D. Then the at Telegram or Youtube
decomposition of R into R1 (A, B) and R2(C, D) is
F1->F3
a) dependency preserving and lossless join
b) lossless join but not dependency preserving F2->F4
c) dependency preserving but not lossless join
d) not dependency preserving and not lossless join (F1,F2)->F5
View Answer in terms of normalization, this table is in
Answer: d a) 1NF
Explanation: While decomposing a relational table we b) 2NF
must verify the following properties: c) 3NF
i) Dependency Preserving Property d) None of the mentioned
ii) Lossless-Join Property. View Answer

3. Relation R with an associated set of functional Answer: a


dependencies, F, is decomposed into BCNF. The Explanation: Since the primary key is not given we have
redundancy (arising out of functional dependencies) in to derive the primary key of the table. Using the closure
the resulting set of relations is set of attributes we get the primary key as (F1,F2). From
a) Zero functional dependencies, “F1->F3, F2->F4”, we can see
b) More than zero but less than that of an equivalent that there is partial functional dependency therefore it
3NF decomposition is not in 1NF. Hence the table is in 1NF.
c) Proportional to the size of F+ 6. Which of the following is TRUE?
d) Indeterminate a) Every relation in 2NF is also in BCNF
View Answer b) A relation R is in 3NF if every non-prime attribute of R
Answer: b is fully functionally dependent on every key of R
Explanation: Redundancy in BCNF is low when c) Every relation in BCNF is also in 3NF
compared to 3NF. d) No relation can be in both BCNF and 3NF
View Answer
advertisement
Answer: c
4. Which one of the following statements about normal Explanation: A relational database table is often
forms is FALSE? described as “normalized” if it is in the Third Normal
a) BCNF is stricter than 3NF Form because most of the 3NF tables are free of
b) Lossless, dependency-preserving decomposition into insertion, update, and deletion anomalies.
3NF is always possible
c) Lossless, dependency-preserving decomposition into 7. Consider the following functional dependencies in a
BCNF is always possible database.
d) Any relation with two attributes is in BCNF Date_of_Birth->Age Age->Eligibility
View Answer
Name->Roll_number Roll_number->Name
Answer: c
Explanation: Achieving Lossless and dependency- Course_number->Course_name Course_number-
preserving decomposition property into BCNF is >Instructor
difficult. (Roll_number, Course_number)->Grade
5. A table has fields F1, F2, F3, F4, and F5, with the The relation (Roll_number, Name, Date_of_birth, Age) is
following functional dependencies: a) In second normal form but not in third normal form
b) In third normal form but not in BCNF

Page 100 of 139


c) In BCNF d) BCNF and hence also in 3NF, 2NF and 1NF
d) None of the mentioned View Answer
View Answer
Answer: b
Answer: d Explanation: Empcode is unique, therefore it is the
Explanation: For the given relation only some of the primary key. Since the primary key consists of a single
above FDs are applicable. The applicable FDs are given attribute there will be no partial dependency, hence the
below: relation is in 2NF.
Date_of_Birth->Age From the question we get the FDs as below:
Name->Roll_number pincode -> city, state
Roll_number->Name street,city,state -> pincode
Finding the closure set of attributes we get the From the FDs we can see that there are transitive
candidate keys:(Roll_number,Date_of_Birth), and dependencies, hence the table is not in 3NF.
(Name,Date_of_Birth) .
10. Which one of the following statements is FALSE?
On selecting any one of the candidate key we can see
a) Any relation with two attributes is in BCNF
that the FD Date_of_Birth->Age is a partial dependency.
b) A relation in which every key has only one attribute is
Hence the relation is in 1NF.
in 2NF
8. The relation schema Student_Performance (name, c) A prime attribute can be transitively dependent on a
courseNo, rollNo, grade) has the following FDs: key in a 3 NF relation
d) A prime attribute can be transitively dependent on a
name,courseNo->grade
key in a BCNF relation
rollNo,courseNo->grade View Answer

name->rollNo Answer: d
Explanation: A table is in 3NF if and only if, for each of
rollNo->name its functional dependencies X -> A, at least one of the
The highest normal form of this relation scheme is following conditions holds:
a) 2NF * X contains A (that is, X -> A is trivial functional
b) 3NF dependency), or
c) BCNF * X is a superkey, or
d) 4NF * A should be prime attribute.
View Answer Database Questions and Answers – Advanced Query
Answer: b Optimization
Explanation: A super key is a combination of prime This set of Database Multiple Choice Questions &
attributes and one or more non-prime key attribute(s). It Answers (MCQs) focuses on “Advanced Query
also uniquely identifies a record in a table. Primary key Optimization”.
can be defined as super key with minimal attributes.
1. _______________ is a procedural extension of Oracle
9. The relation EMPDT1 is defined with attributes – SQL that offers language constructs similar to those in
empcode(unique), name, street, city, state, and pincode. imperative programming languages.
For any pincode, there is only one city and state. Also, a) SQL
for any given street, city and state, there is just one b) PL/SQL
pincode. In normalization terms EMPDT1 is a relation in c) Advanced SQL
a) 1NF only d) PQL
b) 2NF and hence also in 1NF View Answer
c) 3NF and hence also in 2NF and 1NF
Answer: b
Explanation: PL/SQL is an imperative 3GL that was
Page 101 of 139
designed specifically for the seamless processing of SQL d) Identifiers
commands. View Answer

2. ___________ combines the data manipulating power Answer: d


of SQL with the data processing power of Procedural Explanation: The database object name is referred to as
languages. its identifier.
a) PL/SQL
Sanfoundry Certification Contest of the Month is Live.
b) SQL
100+ Subjects. Participate Now!
c) Advanced SQL
d) PQL 6. A ___________________ is an explicit numeric,
View Answer character, string or Boolean value not represented by an
identifier.
Answer: a
a) Comments
Explanation: PL/SQL is an imperative 3GL that was
b) Literals
designed specifically for the seamless processing of SQL
c) Delimiters
commands.
d) Identifiers
3. _______________ has made PL/SQL code run faster View Answer
without requiring any additional work on the part of the
Answer: b
programmer.
Explanation: The terms literal and constant value are
a) SQL Server
synonymous and refer to a fixed data value.
b) My SQL
c) Oracle 7. If no header is specified, the block is said to be an
d) SQL Lite _______________ PL/SQL block.
View Answer a) Strong
b) Weak
Answer: c
c) Empty
Explanation: An Oracle database is a collection of data
d) Anonymous
treated as a unit. The purpose of a database is to store
View Answer
and retrieve related information.
Answer: d
advertisement
Explanation: The terms literal and constant value are
4. A line of PL/SQL text contains groups of characters synonymous and refer to a fixed data value.
known as
8. _________________ is a sequence of zero or more
a) Lexical Units
characters enclosed by single quotes.
b) Literals
a) Integers literal
c) Textual Units
b) String literal
d) Identifiers
c) String units
View Answer
d) String label
Answer: a View Answer
Explanation: Lexical items can be generally understood
Answer: b
to convey a single meaning, much as a lexeme, but are
Explanation: The terms literal and constant value are
not limited to single words.
synonymous and refer to a fixed data value.
5. We use ______________ name PL/SQL program
9. In _______________ the management of the
objects and units.
password for the account can be handled outside of
a) Lexical Units
oracle such as operating system.
b) Literals
a) Database Authentication
c) Delimiters
Page 102 of 139
b) Operating System Authentication Answer: a
c) Internal Authentication Explanation: The transaction consists of all operations
d) External Authentication executed between the begin transaction and end
View Answer transaction.

Answer: b 3. Identify the characteristics of transactions


Explanation: Database management involves the a) Atomicity
monitoring, administration, and maintenance of the b) Durability
databases and database groups in your enterprise. c) Isolation
d) All of the mentioned
10. In ________________ of Oracle, the database
View Answer
administrator creates a user account in the database for
each user who needs access. Answer: d
a) Database Authentication Explanation: Because of the above three properties,
b) Operating System Authentication transactions are an ideal way of structuring interaction
c) Internal Authentication with a database.
d) External Authentication
advertisement
View Answer
4. Which of the following has “all-or-none” property?
Answer: a
a) Atomicity
Explanation: Database management involves the
b) Durability
monitoring, administration, and maintenance of the
c) Isolation
databases and database groups in your enterprise.
d) All of the mentioned
Database Questions and Answers – Transaction View Answer
Concept
Answer: a
This set of Database Multiple Choice Questions & Explanation: Either all operations of the transaction are
Answers (MCQs) focuses on “Transaction Concept”. reflected properly in the database, or none are.

1. Consider money is transferred from (1)account-A to 5. The database system must take special actions to
account-B and (2) account-B to account-A. Which of the ensure that transactions operate properly without
following form a transaction? interference from concurrently executing database
a) Only 1 statements. This property is referred to as
b) Only 2 a) Atomicity
c) Both 1 and 2 individually b) Durability
d) Either 1 or 2 c) Isolation
View Answer d) All of the mentioned
View Answer
Answer: c
Explanation: The term transaction refers to a collection Answer: c
of operations that form a single logical unit of work. Explanation: Even though multiple transactions may
execute concurrently, the system guarantees that, for
2. A transaction is delimited by statements (or function
every pair of transactions Ti and Tj, it appears to Ti that
calls) of the form __________
either Tj finished execution before Ti started or Tj
a) Begin transaction and end transaction
started execution after Ti finished.
b) Start transaction and stop transaction
c) Get transaction and post transaction Subscribe Now: DBMS Newsletter | Important Subjects
d) Read transaction and write transaction Newsletters
View Answer

Page 103 of 139


6. The property of a transaction that persists all the 10. ____ means that the data used during the execution
crashes is of a transaction cannot be used by a second transaction
a) Atomicity until the first one is completed.
b) Durability a) Consistency
c) Isolation b) Atomicity
d) All of the mentioned c) Durability
View Answer d) Isolation
View Answer
Answer: b
Explanation: After a transaction completes successfully, Answer: d
the changes it has made to the database persist, even if Explanation: Even though multiple transactions may
there are system failures. execute concurrently, the system guarantees that, for
every pair of transactions Ti and Tj, it appears to Ti that
7. __________ states that only valid data will be written
either Tj finished execution before Ti started or Tj
to the database.
started execution after Ti finished.
a) Consistency
b) Atomicity Database Questions & Answers – A Simple Transaction
c) Durability Model
d) Isolation
This set of Database Multiple Choice Questions &
View Answer
Answers (MCQs) focuses on “A Simple Transaction
Answer: a Model”.
Explanation: If for some reason, a transaction is
1. In SQL, which command is used to issue multiple
executed that violates the database’s consistency rules,
CREATE TABLE, CREATE VIEW and GRANT statements in
the entire transaction will be rolled back and the
a single transaction?
database will be restored to a state consistent with
a) CREATE PACKAGE
those rules.
b) CREATE SCHEMA
8. Transaction processing is associated with everything c) CREATE CLUSTER
below except d) All of the mentioned
a) Producing detail summary or exception reports View Answer
b) Recording a business activity
Answer: b
c) Confirming an action or triggering a response
Explanation: A database schema of a database system is
d) Maintaining a data
its structure described in a formal language supported
View Answer
by the database management system and refers to the
Answer: c organization of data as a blueprint of how a database is
Explanation: Collections of operations that form a single constructed.
logical unit of work are called transactions.
2. In SQL, the CREATE TABLESPACE is used
9. The Oracle RDBMS uses the ____ statement to a) To create a place in the database for storage of
declare a new transaction start and its properties. scheme objects, rollback segments, and naming the
a) BEGIN data files to comprise the tablespace
b) SET TRANSACTION b) To create a database trigger
c) BEGIN TRANSACTION c) To add/rename data files, to change storage
d) COMMIT d) All of the mentioned
View Answer View Answer

Answer: b Answer: a
Explanation: Commit is used to store all the Explanation: Triggers are used to initialize the actions for
transactions. an activity.
Page 104 of 139
3. Which character function can be used to return a d) Data Retrieval Language
specified portion of a character string? View Answer
a) INSTR
Answer: a
b) SUBSTRING
Explanation: DDL are used to define schema and table
c) SUBSTR
characters.
d) POS
View Answer 7. The SQL statement SELECT SUBSTR(‘123456789’,
INSTR(‘abcabcabc’,’b’), 4) FROM EMP; prints
Answer: c
a) 6789
Explanation: SUBSTR are used to match the particular
b) 2345
characters in a string.
c) 1234
advertisement d) 456789
View Answer
4. Which of the following is TRUE for the System
Variable $date$? Answer: b
a) Can be assigned to a global variable Explanation: SUBSTR are used to match the particular
b) Can be assigned to any field only during design time characters in a string.
c) Can be assigned to any variable or field during run
8. Which of the following SQL command can be used to
time
modify existing data in a database table?
d) Can be assigned to a local variable
a) MODIFY
View Answer
b) UPDATE
Answer: b c) CHANGE
Explanation: A database schema of a database system is d) NEW
its structure described in a formal language supported View Answer
by the database management system and refers to the
Answer: b
organization of data as a blueprint of how a database is
Explanation: Syntax : UPDATE table_name
constructed.
SET column1=value1,column2=value2,…
5. What are the different events in Triggers? WHERE some_column=some_value; .
a) Define, Create
9. When SQL statements are embedded inside 3GL, we
b) Drop, Comment
call such a program as
c) Insert, Update, Delete
a) Nested query
d) Select, Commit
b) Nested programming
View Answer
c) Distinct query
Answer: c d) Embedded SQL
Explanation: A database trigger is a procedural code that View Answer
is automatically executed in response to certain events
Answer: d
on a particular table or view in a database.
Explanation: SQL-99 is the most recent version of
Subscribe Now: DBMS Newsletter | Important Subjects standard SQL prescribed by the ANSI.
Newsletters
10. _______________ provides option for entering SQL
6. Which is the subset of SQL commands used to queries as execution time, rather than at the
manipulate Oracle Database Structures, including development stage.
tables? a) PL/SQL
a) Data Definition Language b) SQL*Plus
b) Data Manipulation Language c) SQL
c) Data Described Language
Page 105 of 139
d) Dynamic SQL advertisement
View Answer
4. The unit of storage that can store one are more
Answer: d records in a hash file organization are
Explanation: Dynamic SQL enables you to write a) Buckets
programs that reference SQL statements whose full text b) Disk pages
is not known until runtime. c) Blocks
d) Nodes
Database Questions and Answers – Storage Structure
View Answer
This set of Database Multiple Choice Questions &
Answer: a
Answers (MCQs) focuses on “Storage Structure”.
Explanation: Buckets are used to store one or more
1. The storage structure which do not survive system records in a hash file organization.
crashes are ______
5. A ______ file system is software that enables multiple
a) Volatile storage
computers to share file storage while maintaining
b) Non-volatile storage
consistent space allocation and file content.
c) Stable storage
a) Storage
d) Dynamic storage
b) Tertiary
View Answer
c) Secondary
Answer: a d) Cluster
Explanation: Volatile storage, is a computer memory View Answer
that requires power to maintain the stored information,
Answer: d
in other words it needs power to reach the computer
Explanation: With a cluster file system, the failure of a
memory.
computer in the cluster does not make the file system
2. Storage devices like tertiary storage, magnetic disk unavailable.
comes under
Subscribe Now: DBMS Newsletter | Important Subjects
a) Volatile storage
Newsletters
b) Non-volatile storage
c) Stable storage 6. A file produced by a spreadsheet
d) Dynamic storage a) is generally stored on disk in an ASCII text format
View Answer b) can be used as is by the DBMS
c) all of the mentioned
Answer: b
d) none of the mentioned
Explanation: Information residing in nonvolatile storage
View Answer
survives system crashes.
Answer: a
3. For a transaction to be durable, its changes need to
Explanation: ASCII text format uses the standard text file
be written to ________ storage.
for the changing the value.
a) Volatile storage
b) Non-volatile storage 7. SDL means _____________
c) Stable storage a) Storage Discrete Language
d) Dynamic storage b) Storage Definition Language
View Answer c) Storage Definition Localisation
d) Storage Discrete Localisation
Answer: c
View Answer
Explanation: Similarly, for a transaction to be atomic, log
records need to be written to stable storage before any
changes are made to the database on disk.

Page 106 of 139


Answer: b b) Terminated
Explanation: It specifies internal schema and also c) Closed
mapping between two schemas. d) All of the mentioned
View Answer
8. Which of the following are the process of selecting
the data storage and data access characteristics of the Answer: a
database? Explanation: If we are to ensure the atomicity property,
a) Logical database design an aborted transaction must have no effect on the state
b) Physical database design of the database.
c) Testing and performance tuning
2. If an transaction is performed in a database and
d) Evaluation and selecting
committed, the changes are taken to the previous state
View Answer
of transaction by
Answer: b a) Flashback
Explanation: Physical database design is the process of b) Rollback
selecting the data storage and data access c) Both Flashback and Rollback
characteristics of the database. d) Cannot be done
View Answer
9. Which of the following is the oldest database model?
a) Relational Answer: d
b) Hierarchical Explanation: Once committed the changes cannot be
c) Physical rolled back.
d) Network
3. Each modification done in database transaction are
View Answer
first recorded into the
Answer: d a) Harddrive
Explanation: Network model has data stored in a b) Log
hierarchical network flow. c) Disk
d) Datamart
10. The process of saving information onto secondary
View Answer
storage devices is referred to as
a) Backing up Answer: b
b) Restoring Explanation: After commit is issued the data are stored
c) Writing in a database and stored in drive.
d) Reading
advertisement
View Answer
4. When the transaction finishes the final statement the
Answer: c
transaction enters into
Explanation: The information is written into the
a) Active state
secondary storage device.
b) Committed state
Database Questions and Answers – Transaction c) Partially committed state
Atomicity and Durability d) Abort state
View Answer
This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “Transaction Atomicity and Answer: c
Durability”. Explanation: The commit statement has to be issued to
enter into committed state.
1. A transaction may not always complete its execution
successfully. Such a transaction is termed 5. The name of the transaction file shall be provided by
a) Aborted the operator and the file that contains the edited

Page 107 of 139


transactions ready for execution shall be called Answer: c
a) Batch. Exe Explanation: Isolation means that data used during the
b) Trans. Exe execution of a transaction can’t be used by a second
c) Opt. Exe transaction until the first one is completed.
d) [Link]
9. DBMS periodically suspends all processing and
View Answer
synchronizes its files and journals through the use of
Answer: c a) Checkpoint facility
Explanation: Transactions has to be managed by the b) Backup facility
executable files. c) Recovery manager
d) Database change log
Note: Join free Sanfoundry classes
View Answer
at Telegram or Youtube
Answer: a
6. Which of the following is an atomic sequence of
Explanation: DBMS periodically suspends all processing
database actions?
and synchronizes its files and journals though the use of
a) Transaction
Check point facility.
b) Concurrency
c) Relations 10. Which of the following is not a state in transaction?
d) All of the mentioned a) Active
View Answer b) Terminated
c) Aborted
Answer: a
d) Partially committed
Explanation: Transaction is a collection of operations
View Answer
that provides single logical function in database.
Answer: b
7. If the state of the database no longer reflects a real
Explanation: The transaction states are abort, active,
state of the world that the database is supposed to
committed, partially committed, Failed.
capture, then such a state is called
a) Consistent state Database Questions and Answers – Querying database
b) Parallel state part 3
c) Atomic state
This set of Database Interview Questions and Answers
d) Inconsistent state
for freshers focuses on ” Querying database part – 3″.
View Answer
1. _______________ joins are SQL server default
Answer: d
a) Outer
Explanation: If the state of the database no longer
b) Inner
reflects a real state of the world that the database is
c) Equi
supposed to capture, then such a state is called in a
d) None of the Mentioned
consistent state.
View Answer
8. _______ means that data used during the execution
Answer: b
of a transaction cannot be used by a second transaction
Explanation: Inner query joins only the rows that are
until the first one is completed.
matching.
a) Serializability
b) Atomicity 2. The ________________ is essentially used to search
c) Isolation for patterns in target string.
d) Time stamping a) Like Predicate
View Answer b) Null Predicate
c) In Predicate

Page 108 of 139


d) Out Predicate c) Receive queries
View Answer d) Result formatting and presentation
View Answer
Answer: a
Explanation: Like matches the pattern with the query. Answer: b
Explanation: Query optimization is used to improve
3. Which of the following is/are the Database server
quality.
functions?
i) Data management 7. ____________ is a special type of stored procedure
ii) Transaction management that is automatically invoked whenever the data in the
iii) Compile queries table is modified.
iv) Query optimization a) Procedure
a) i, ii, and iv only b) Trigger
b) i, ii and iii only c) Curser
c) ii, iii and iv only d) None of the Mentioned
d) All i, ii, iii, and iv View Answer
View Answer
Answer: b
Answer: a Explanation: Triggers are used to initiate an action to
Explanation: All these are functions of the database. take place.

advertisement 8. ______________ requires that data should be made


available to only authorized users.
4. To delete a database ___________ command is used
a) Data integrity
a) Delete database database_name
b) Privacy
b) Delete database_name
c) Security
c) drop database database_name
d) None of the Mentioned
d) drop database_name
View Answer
View Answer
Answer: c
Answer: c
Explanation: Some algorithms may be used for the
Explanation: This will delete the database with its
security.
structure.
9. Some of the utilities of DBMS are _____________
5. ____________ is a combination of two of more
i) Loading ii) Backup iii) File organization iv) Process
attributes used as a primary key
Organization
a) Composite Key
a) i, ii, and iv only
b) Alternate Key
b) i, ii and iii only
c) Candidate Key
c) ii, iii and iv only
d) Foreign Key
d) All i, ii, iii, and iv
View Answer
View Answer
Answer: a
Answer: b
Explanation: Primary keys together form the composite
Explanation: Processing is not the a utility in dbms.
key.
10. ____________ allows individual row operation to be
Subscribe Now: DBMS Newsletter | Important Subjects
performed on a given result set or on the generated by a
Newsletters
selected by a selected statement.
6. Which of the following is not the function of client? a) Procedure
a) Compile queries b) Trigger
b) Query optimization c) Curser
Page 109 of 139
d) None of the Mentioned
View Answer

Answer: c
Explanation: Triggers are used to initiate an action to
take place.

Page 110 of 139


Database Questions and Answers – Querying Database d) None of the mentioned
–4 View Answer

This set of Database Questions and Answers for Answer: b


Experienced people focuses on ” Querying database Explanation: Insertion anomaly is due to confusion in
part – 4″. data deletion or insertion.

1. Which s essential a business problem not a data 5. How many types of insertion anomalies:
problem: a) 1
a) Data b) 2
b) Database c) 3
c) Database design d) 4
d) All of the mentioned View Answer
View Answer
Answer: b
Answer: c Explanation: Insertion anomaly is due to confusion in
Explanation: SQL-99 is the most recent version of data deletion or insertion.
standard SQL prescribed by the ANSI.
Sanfoundry Certification Contest of the Month is Live.
2. Which is primarily the result of a thorough 100+ Subjects. Participate Now!
understanding of information about an enterprise:
6. Who developed the normalization process:
a) Data
a) E.F. codd
b) Database
b) F.F. codd
c) Database design
c) E.E. codd
d) Data modeling
d) None of the mentioned
View Answer
View Answer
Answer: d
Answer: a
Explanation: Data modelling designs the data in a
Explanation: Normalization helps in improving the
secured manner.
quality of the data.
3. McFadden has defined normalization in his which
7. [Link] developed the normalization process in the
book___________
which early:
a) Database modern management
a) 1969
b) Management database of modern
b) 1970
c) Modern database management
c) 1971
d) Database management
d) 1972
View Answer
View Answer
Answer: c
Answer: b
Explanation: SQL-99 is the most recent version of
Explanation: Normalization helps in improving the
standard SQL prescribed by the ANSI.
quality of the data.
advertisement
8. Which is a bottom-up approach to database design
4. The database design prevents some data from being that design by examining the relationship between
represented due to _______ attributes:
a) Deletion anomalies a) Functional dependency
b) Insertion anomalies b) Database modeling
c) Update anomaly c) Normalization

Page 111 of 139


d) Decomposition 2. Which is a duplicate copy of a file program that is
View Answer stored on a different storage media than the original
location:
Answer: c
a) Concurrency
Explanation: Normalization helps in improving the
b) Deadlock
quality of the data.
c) Backup
9. Which is the process of breaking a relation into d) Recovery
multiple relations: View Answer
a) Functional dependency
Answer: c
b) Database modeling
Explanation: Backup is required to take all the data.
c) Normalization
d) Decomposition 3. Which is the duplication of computer operations and
View Answer routine backups to combat any unforeseen problems:
a) Concurrency
Answer: d
b) Deadlock
Explanation: SQL-99 is the most recent version of
c) Backup
standard SQL prescribed by the ANSI.
d) Recovery
10. Which formal method that locates and analyses View Answer
relation schemas on the basis of their primary,
Answer: d
candidate keys, and the FD’s that are present among the
Explanation: Recovery means to take the backup data
attributes of these schemas:
while there is a crash.
a) Functional dependency
b) Database modeling advertisement
c) Normalization
4. Optimization that is basically related to the rewriter
d) Decomposition
module is termed as__________
View Answer
a) Semantic query optimization
Answer: c b) Global query optimization
Explanation: Normalization helps in improving the c) All of the Mentioned
quality of the data. d) None of the Mentioned
View Answer
Database Questions and Answers – Querying database
part 5 Answer: a
Explanation: SQL-99 is the most recent version of
This set of Database Interview Questions and Answers
standard SQL prescribed by the ANSI.
for Experienced people focuses on ” Querying database
part – 5″. 5. Optimization basically related to the Rewrite module
is termed as_______
1. Which is refers to a stalemate situation due to which
a) Semantic query optimization
no further progress is possible as computer await
b) Global query optimization
response of each other:
c) All of the Mentioned
a) Concurrency
d) None of the Mentioned
b) Deadlock
View Answer
c) Backup
d) Recovery Answer: a
View Answer Explanation: SQL-99 is the most recent version of
standard SQL prescribed by the ANSI.
Answer: b
Explanation: Deadlock will stop further processing.

Page 112 of 139


Subscribe Now: DBMS Newsletter | Important Subjects b) DBMS
Newsletters c) RDBMS
d) All of the mentioned
6. Database security helps organizations to protect data
View Answer
from _____
a) Internal users Answer: a
b) External users Explanation: Indexing reduces the difficulty in searching
c) Non-external users the data.
d) Non internal users
View Answer

Answer: b
Explanation: External users are the people who do not
involve in the processing of the database.
Database Questions and Answers – Implementation of
7. Copying files to secondary or specific devices is Isolation Levels
known as ______
a) Retrieve This set of Database Multiple Choice Questions &
b) Backup Answers (MCQs) focuses on “Implementation of
c) Recovery Isolation Levels”.
d) Deadlock 1. In concurrency control policy the lock is obtained on
View Answer a) Entire database
Answer: b b) A particular transaction alone
Explanation: Backup is required to take all the data. c) All the new elements
d) All of the mentioned
8. How many types of recovery control techniques: View Answer
a) 2
b) 3 Answer: a
c) 4 Explanation: It is to avoid deadlock.
d) 5 2. A concurrency-control policy such as this one leads to
View Answer ______ performance since it forces transactions to wait
Answer: a for preceding transactions to finish before they can
Explanation: Recovery means to take the backup data start.
while there is a crash. a) Good
b) Average
9. Which are types of recovery control techniques: c) Poor
a) Deferred update d) Unstable
b) Immediate update View Answer
c) All of the Mentioned
d) None of the Mentioned Answer: c
View Answer Explanation: It provides a poor degree of concurrency.

Answer: c 3. __________ are used to ensure that transactions


Explanation: Recovery means to take the backup data access each data item in order of the transactions’ ____
while there is a crash. if their accesses conflict.
a) Zone
10. Which server can join the indexes when only b) Relay
multiple indexes combined can cover the query: c) Line
a) SQL

Page 113 of 139


d) Timestamps a) To find the groups forming the subtotal in a row
View Answer b) To create group-wise grand totals for the groups
specified within a GROUP BY clause
Answer: d
c) To create a grouping for expressions or columns
Explanation: When this is not possible, offending
specified within a GROUP BY clause in one direction,
transactions are aborted and restarted with a new
from right to left for calculating the subtotals
timestamp.
d) To create a grouping for expressions or columns
advertisement specified within a GROUP BY clause in all possible
directions, which is cross-tabular report for calculating
4. EMPDET is an external table containing the columns the subtotals
EMPNO and ENAME. Which command would work in View Answer
relation to the EMPDET table?
a) Answer: c
Explanation: View is the temporary space created for
UPDATE empdet the database.
SET ename = 'Amit' 6.
WHERE empno = 1234;
Name N
b)

Note: Join free Sanfoundry classes Cust_id N


at Telegram or Youtube

DELETE FROM empdet


Cust_Name
WHERE ename LIKE 'J%';
Evaluate the following SQL statements executed in the
c)
given order:
CREATE VIEW empvu
ALTER TABLE cust
AS
ADD CONSTRAINT cust_id_pk PRIMARY KEY(cust_id)
SELECT * FROM empdept; DEFERRABLE INITIALLY DEFERRED; INSERT

d) INTO cust VALUES (1,'RAJ'); --row 1

CREATE INDEX INSERT INTO cust VALUES (1,'SAM'); --row 2

empdet_idx COMMIT;

ON empdet(empno); SET CONSTRAINT cust_id_pk IMMEDIATE;

View Answer INSERT INTO cust VALUES (1,'LATA'); --row 3

Answer: c INSERT INTO cust VALUES (2,'KING'); --row 4


Explanation: View is the temporary space created for
COMMIT;
the database.
Which rows would be made permanent in the CUST
table?
a) row 4 only
5. In which scenario would you use the ROLLUP operator b) rows 2 and 4
for expression or columns within a GROUP BY clause? c) rows 3 and 4

Page 114 of 139


d) rows 1 and 4 FLASHBACK TABLE dept TO BEFORE DROP;
View Answer
Which statement is true regarding the above
Answer: c FLASHBACK operation?
Explanation: View is the temporary space created for a) It recovers only the first DEPT table
the database. b) It recovers only the second DEPT table
c) It does not recover any of the tables because
7. Which statement is true regarding external tables?
FLASHBACK is not possible in this case
a) The default REJECT LIMIT for external tables is
d) It recovers both the tables but the names would be
UNLIMITED
changed to the ones assigned in the RECYCLEBIN
b) The data and metadata for an external table are
View Answer
stored outside the database
c) ORACLE_LOADER and ORACLE_DATAPUMP have Answer: b
exactly the same functionality when used with an Explanation: This will replicate the table as in the select
external table statement.
d) The CREATE TABLE AS SELECT statement can be used
10.
to unload data into regular table in the database from
an external table CREATE TABLE digits
View Answer
(id NUMBER(2),
Answer: d
Explanation: This will replicate the table as in the select description VARCHAR2(15));
statement. INSERT INTO digits VALUES (1,'ONE');
8. A non-correlated subquery can be defined as ______ UPDATE digits SET description ='TWO' WHERE id=1;
a) A set of sequential queries, all of which must always
return a single value INSERT INTO digits VALUES (2,'TWO');
b) A set of sequential queries, all of which must return COMMIT;
values from the same table
c) A SELECT statement that can be embedded in a clause DELETE FROM digits;
of another SELECT statement only
SELECT description FROM digits
d) A set of one or more sequential queries in which
generally the result of the inner query is used as the VERSIONS BETWEEN TIMESTAMP MINVALUE AND
search value in the outer query MAXVALUE;
View Answer
What would be the outcome of the above query?
Answer: d a) It would not display any values
Explanation: This will replicate the table as in the select b) It would display the value TWO once
statement. c) It would display the value TWO twice
d) It would display the values ONE, TWO, and TWO
9. Evaluate the following SQL statements in the given
View Answer
order:
Answer: c
DROP TABLE dept;
Explanation: This will replicate the table as in the select
CREATE TABLE dept statement.

(deptno NUMBER(3) PRIMARY KEY, Database Questions and Answers – Transactions as SQL
Statements
deptname VARCHAR2(10));
This set of Basic Database Questions and Answers
DROP TABLE dept; focuses on “Transactions as SQL Statements”.
Page 115 of 139
1. Which of the following is a property of transactions? 5. Problems occurs if we don’t implement a proper
a) Atomicity locking strategy
b) Concurrency a) Dirty reads
c) Isolation b) Phantom reads
d) All of the mentioned c) Lost updates
View Answer d) Unrepeatable reads
View Answer
Answer: d
Explanation: Atomicity, Concurrency, Isolation, and Answer: d
Durability are essential properties of transactions in Explanation: In a concurrent execution of these
database systems. They ensure that transactions are transactions, it is intuitively clear that they conflict, but
executed consistently, efficiently, and reliably, this is a conflict not captured by our simple model. This
maintaining data integrity and consistency. situation is referred to as the phantom phenomenon,
because a conflict may exist on “phantom” data.
2. SNAPSHOT is used for (DBA)
a) Synonym Sanfoundry Certification Contest of the Month is Live.
b) Tablespace 100+ Subjects. Participate Now!
c) System server
6. Which of the following fixed database roles can add
d) Dynamic data replication
or remove user IDs?
View Answer
a) db_accessadmin
Answer: d b) db_securityadmin
Explanation: Snapshot gets the instance of the database c) db_setupadmin
at that time. d) db_sysadmin
View Answer
3. Isolation of the transactions is ensured by
a) Transaction management Answer: a
b) Application programmer Explanation: The database can be accessed by assigning
c) Concurrency control the roles.
d) Recovery management
7. By default sql server has ___________ isolation level
View Answer
a) READ COMMITTED
Answer: c b) READ UNCOMMITTED
Explanation: ACID properties are the properties of c) SERIALIZABLE
transactions. d) REPEATABLE READ
View Answer
advertisement
Answer: a
4. Constraint checking can be disabled in existing
Explanation: Read committed is used to commit the
_______________ and _____________ constraints so
default read operation.
that any data you modify or add to the table is not
checked against the constraint. 8. Which of the following statements is/are not true for
a) CHECK, FOREIGN KEY SQL profiler?
b) DELETE, FOREIGN KEY a) Enables you to monitor events
c) CHECK, PRIMARY KEY b) Check if rows are being inserted properly
d) PRIMARY KEY, FOREIGN KEY c) Check the performance of a stored procedure
View Answer d) ALL of the mentioned
View Answer
Answer: a
Explanation: Check and foreign constraints are used to
constraint the table data.
Page 116 of 139
Answer: c 2. A lock that allows concurrent transactions to access
Explanation: Read committed is used to commit the different rows of the same table is known as a
default read operation. a) Database-level lock
b) Table-level lock
9. Which of the following is the original purpose of SQL?
c) Page-level lock
a) To specify the syntax and semantics of SQL data
d) Row-level lock
definition language
View Answer
b) To specify the syntax and semantics of SQL
manipulation language Answer: d
c) To define the data structures Explanation: Locks are used to maintain database
d) All of the mentioned consistency.
View Answer
3. Which of the following are introduced to reduce the
Answer: d overheads caused by the log-based recovery?
Explanation: Read committed is used to commit the a) Checkpoints
default read operation. b) Indices
c) Deadlocks
10. SQL can be used to:
d) Locks
a) Create database structures only
View Answer
b) Query database data only
c) Modify database data only Answer: a
d) All of the mentioned Explanation: Checkpoints are introduced to reduce
View Answer overheads caused by the log-based recovery.

Answer: d advertisement
Explanation: In a concurrent execution of these
4. Which of the following protocols ensures conflict
transactions, it is intuitively clear that they conflict, but
serializability and safety from deadlocks?
this is a conflict not captured by our simple model. This
a) Two-phase locking protocol
situation is referred to as the phantom phenomenon,
b) Time-stamp ordering protocol
because a conflict may exist on “phantom” data.
c) Graph based protocol
Database Questions and Answers – Lock-Based d) None of the mentioned
Protocols View Answer

This set of Database Multiple Choice Questions & Answer: b


Answers (MCQs) focuses on “Lock-Based Protocols”. Explanation: Time-stamp ordering protocol ensures
conflict serializability and safety from deadlocks.
1. In order to maintain transactional integrity and
database consistency, what technology does a DBMS 5. Which of the following is the block that is not
deploy? permitted to be written back to the disk?
a) Triggers a) Dead code
b) Pointers b) Read only
c) Locks c) Pinned
d) Cursors d) Zapped
View Answer View Answer

Answer: c Answer: c
Explanation: Locks are used to maintain database Explanation: A block that is not permitted to be written
consistency. back to the disk is called pinned.

Page 117 of 139


Note: Join free Sanfoundry classes c) Row-level
at Telegram or Youtube d) Field-level
View Answer
6. If transaction Ti gets an explicit lock on the file Fc in
exclusive mode, then it has an __________ on all the Answer: d
records belonging to that file. Explanation: Lock is limited to the attributes of the
a) Explicit lock in exclusive mode relation.
b) Implicit lock in shared mode
10. Which of the following is a procedure for acquiring
c) Explicit lock in shared mode
the necessary locks for a transaction where all necessary
d) Implicit lock in exclusive mode
locks are acquired before any are released?
View Answer
a) Record controller
Answer: d b) Exclusive lock
Explanation: If transaction Ti gets an explicit lock on the c) Authorization rule
file Fc in exclusive mode, then it has an implicit lock in d) Two phase lock
exclusive mode on all the records belonging to that file. View Answer

7. Which refers to a property of computer to run several Answer: d


operation simultaneously and possible as computers Explanation: Two-phase lock is a procedure for acquiring
await response of each other the necessary locks for a transaction where all necessary
a) Concurrency locks are acquired before any are released.
b) Deadlock
Database Questions and Answers – Deadlocks
c) Backup
d) Recovery This set of Database Multiple Choice Questions &
View Answer Answers (MCQs) focuses on “Deadlocks”.
Answer: a 1. A system is in a ______ state if there exists a set of
Explanation: Concurrency is a property of systems in transactions such that every transaction in the set is
which several computations are executing waiting for another transaction in the set.
simultaneously, and potentially interacting with each a) Idle
other. b) Waiting
c) Deadlock
8. All lock information is managed by a __________
d) Ready
which is responsible for assigning and policing the locks
View Answer
used by the transactions.
a) Scheduler Answer: c
b) DBMS Explanation: When one data item is waiting for another
c) Lock manager data item in a transaction then system is in deadlock.
d) Locking agent
View Answer 2. The deadlock state can be changed back to stable
state by using _____________ statement.
Answer: c a) Commit
Explanation: A distributed lock manager (DLM) provides b) Rollback
distributed software applications with a means to c) Savepoint
synchronize their accesses to shared resources. d) Deadlock
View Answer
9. The ____ lock allows concurrent transactions to
access the same row as long as they require the use of Answer: b
different fields within that row. Explanation: Rollback is used to rollback to the point
a) Table-level before lock is obtained.
b) Page-level
Page 118 of 139
3. What are the ways of dealing with deadlock? c) Timeout
a) Deadlock prevention d) Wait
b) Deadlock recovery View Answer
c) Deadlock detection
Answer: a
d) All of the mentioned
Explanation: The timeout scheme is particularly easy to
View Answer
implement, and works well if transactions are short and
Answer: d if longwaits are likely to be due to deadlocks.
Explanation: Deadlock prevention is also called as
7. The deadlock in a set of a transaction can be
deadlock recovery. Prevention is commonly used if the
determined by
probability that the system would enter a deadlock state
a) Read-only graph
is relatively high; otherwise, detection and recovery are
b) Wait graph
more efficient.
c) Wait-for graph
advertisement d) All of the mentioned
View Answer
4. When transaction Ti requests a data item currently
held by Tj, Ti is allowed to wait only if it has a timestamp Answer: a
smaller than that of Tj (that is, Ti is older than Tj). Explanation: Each transaction involved in the cycle is
Otherwise, Ti is rolled back (dies). This is said to be deadlocked.
a) Wait-die
8. A deadlock exists in the system if and only if the wait-
b) Wait-wound
for graph contains a ___________
c) Wound-wait
a) Cycle
d) Wait
b) Direction
View Answer
c) Bi-direction
Answer: a d) Rotation
Explanation: The wait–die scheme is a non-preemptive View Answer
technique.
Answer: a
5. When transaction Ti requests a data item currently Explanation: Each transaction involved in the cycle is
held by Tj, Ti is allowed to wait only if it has a timestamp said to be deadlocked.
larger than that of Tj (that is, Ti is younger than Tj ).
9. Selecting the victim to be rollbacked to the previous
Otherwise, Tj is rolled back (Tj is wounded by Ti). This is
state is determined by the minimum cost. The factors
a) Wait-die
determining cost of rollback is
b) Wait-wound
a) How long the transaction has computed, and how
c) Wound-wait
much longer the transaction will compute before it
d) Wait
completes its designated task
View Answer
b) How many data items the transaction has used
Answer: c c) How many more data items the transaction needs for
Explanation: The wound–wait scheme is a preemptive it to complete
technique. It is a counterpart to the wait–die scheme. d) All of the mentioned
View Answer
Note: Join free Sanfoundry classes
at Telegram or Youtube Answer: d
Explanation: We should roll back those transactions that
6. The situation where the lock waits only for a specified
will incur the minimum cost.
amount of time for another lock to be released is
a) Lock timeout 10. __________ rollback requires the system to
b) Wait-wound maintain additional information about the state of all
Page 119 of 139
the running transactions. 4. If a node is locked in __________ explicit locking is
a) Total being done at a lower level of the tree, but with only
b) Partial shared-mode locks.
c) Time a) Intention lock modes
d) Commit b) Intention-shared-exclusive mode
View Answer c) Intention-exclusive (IX) mode
d) Intention-shared (IS) mode
Answer: b
View Answer
Explanation: In total rollback abort the transaction and
then restart it. Answer: a
Explanation: There is an intention mode associated with
Database Questions and Answers – Multiple
shared mode, and there is one with an exclusive mode.
Granularity
5. If a node is locked in ____________ then explicit
This set of Database Multiple Choice Questions &
locking is being done at a lower level, with exclusive-
Answers (MCQs) focuses on “Multiple Granularity”.
mode or shared-mode locks.
1. In a granularity hierarchy the highest level represents a) Intention lock modes
the b) Intention-shared-exclusive mode
a) Entire database c) Intention-exclusive (IX) mode
b) Area d) Intention-shared (IS) mode
c) File View Answer
d) Record
Answer: c
View Answer
Explanation: There is an intention mode associated with
Answer: a shared mode, and there is one with an exclusive mode.
Explanation: This level is the root of the tree.
Subscribe Now: DBMS Newsletter | Important Subjects
2. In a database the file is contained in ________ Newsletters
a) Entire database
6. If a node is locked in ______________ the subtree
b) Two area
rooted by that node is locked explicitly in shared mode,
c) One area
and that explicit locking is being done at a lower level
d) more than one area
with exclusive-mode locks.
View Answer
a) Intention lock modes
Answer: c b) shared and intention-exclusive (SIX) mode
Explanation: This level is below the root of the tree. c) Intention-exclusive (IX) mode
d) Intention-shared (IS) mode
3. If a node is locked in an intention mode, explicit View Answer
locking is done at a lower level of the tree. This is called
a) Intention lock modes Answer: b
b) Explicit lock Explanation: There is an intention mode associated with
c) Implicit lock shared mode, and there is one with an exclusive mode.
d) Exclusive lock
7. ____________ denotes the largest timestamp of any
View Answer
transaction that executed write(Q) successfully.
Answer: a a) W-timestamp(Q)
Explanation: There is an intention mode associated with b) R-timestamp(Q)
shared mode, and there is one with an exclusive mode. c) RW-timestamp(Q)
d) WR-timestamp(Q)
advertisement View Answer

Page 120 of 139


Answer: a Database Questions and Answers – Multiversion
Explanation: The most common method for doing Schemes
ordering transaction is to use a timestamp-ordering
This set of Database Multiple Choice Questions &
scheme.
Answers (MCQs) focuses on “Multiversion Schemes”.
8. The _____________ ensures that any conflicting read
1. The most recent version of standard SQL prescribed
and write operations are executed in timestamp order.
by the American National Standards Institute is
a) Timestamp-ordering protocol
a) SQL 2016
b) Timestamp protocol
b) SQL 2002
c) W-timestamp
c) SQL – 4
d) R-timestamp
d) SQL2
View Answer
View Answer
Answer: a
Answer: a
Explanation: The most common method for doing
Explanation: SQL-2016 is the most recent version of
ordering transaction is to use a timestamp-ordering
standard SQL prescribed by the ANSI.
scheme.
2. ANSI-standard SQL allows the use of special operators
9. The __________ requires that each transaction Ti
in conjunction with the WHERE clause. A special
executes in two or three different phases in its lifetime,
operator used to check whether an attribute value is
depending on whether it is a read-only or an update
null is
transaction.
a) BETWEEN
a) Validation protocol
b) IS NULL
b) Validation-based protocol
c) LIKE
c) Timestamp protocol
d) IN
d) Timestamp-ordering protocol
View Answer
View Answer
Answer: b
Answer: a
Explanation: Exists is used to check whether an attribute
Explanation: A concurrency-control scheme imposes the
value is null or not in conjunction with the where clause.
overhead of code execution and possible delay of
transactions. It may be better to use an alternative 3. A lock that prevents the use of any tables in the
scheme that imposes less overhead. database from one transaction while another
transaction is being processed is called a
10. This validation scheme is called the _________
a) Database-level lock
scheme since transactions execute optimistically,
b) Table-level lock
assuming they will be able to finish execution and
c) Page-level lock
validate at the end.
d) Row-level lock
a) Validation protocol
View Answer
b) Validation-based protocol
c) Timestamp protocol Answer: a
d) Optimistic concurrency-control Explanation: Data base-level lock prevents the use of
View Answer any tables in the data base from one transaction while
another transaction is being processed.
Answer: a
Explanation: A concurrency-control scheme imposes the advertisement
overhead of code execution and possible delay of
transactions. It may be better to use an alternative 4. A condition that occurs when two transactions wait
scheme that imposes less overhead. for each other to unlock data is known as a(n)
a) Shared lock

Page 121 of 139


b) Exclusive lock 8. Which of the following is not true about B+ trees?
c) Binary lock a) B+ tree index takes the form of balanced tree
d) Deadlock b) Performance of B+ tree degrades as the file grows
View Answer c) Look-up in B+ tree is straightforward and efficient
d) Insertion and deletion in B+ tree is complicated but
Answer: d
efficient
Explanation: Deadlock occurs when two transactions
View Answer
wait for each other to unlock data.
Answer: b
5. _______ means that data used during the execution
Explanation: The answer is evident.
of a transaction cannot be used by a second transaction
until the first one is completed. 9. The extent of the database resource that is included
a) Serializability with each lock is called the level of
b) Atomicity a) Impact
c) Isolation b) Granularity
d) Time stamping c) Management
View Answer d) DBMS control
View Answer
Answer: c
Explanation: Isolation means that data used during the Answer: b
execution of a transaction can’t be used by a second Explanation: The extent of the data base resource that is
transaction until the first one is completed. included with each lock is called the level of Granularity.

Subscribe Now: DBMS Newsletter | Important Subjects 10. DBMS periodically suspends all processing and
Newsletters synchronizes its files and journals through the use of
a) Checkpoint facility
6. A unit of storage that can store one or more records
b) Backup facility
in a hash file organization is denoted as
c) Recovery manager
a) Buckets
d) Database change log
b) Disk pages
View Answer
c) Blocks
d) Nodes Answer: a
View Answer Explanation: DBMS periodically suspends all processing
and synchronizes its files and journals through the use
Answer: a
of Check point facility.
Explanation: Buckets are used to store one or more
records in a hash file organization. Database Questions and Answers – Snapshot Isolation

7. The file organization which allows us to read records This set of Database Multiple Choice Questions &
that would satisfy the join condition by using one block Answers (MCQs) focuses on “Snapshot Isolation”.
read is
1. Snapshot isolation is a particular type of
a) Heap file organization
______________ scheme.
b) Sequential file organization
a) Concurrency-control
c) Clustering file organization
b) Concurrency-allowance
d) Hash files organization
c) Redirection
View Answer
d) Repetition-allowance
Answer: c View Answer
Explanation: Clustering file organization allows us to
Answer: a
read records that would satisfy the join condition by
Explanation: It has gained wide acceptance in
using one block read.
Page 122 of 139
commercial and open-source systems, including Oracle, Subscribe Now: DBMS Newsletter | Important Subjects
PostgreSQL, and SQL Server. Newsletters

2. Snapshot isolation is used to give 6. Each of a pair of transactions has read data that is
a) Transaction a snapshot of the database written by the other, but there is no data written by
b) Database a snapshot of the transaction both transactions, is referred to as
c) Database a snapshot of committed values in the a) Read skew
transaction b) Update skew
d) Transaction a snapshot of the database and Database c) Write lock
a snapshot of committed values in the transaction d) None of the mentioned
View Answer View Answer

Answer: d Answer: d
Explanation: The data values in the snapshot consist Explanation: Write skew is the issue addressed here.
only of values written by committed transactions.
7. An application developer can guard against certain
3. Lost update problem is snapshot anomalies by appending a ______ clause to
a) Second update overwrites the first the SQL select query.
b) First update overwrites the second a) For update
c) The updates are lost due to conflicting problem b) For read
d) None of the mentioned c) For write
View Answer d) None of the mentioned
View Answer
Answer: a
Explanation: Lost update problem has to be resolved. Answer: a
Explanation: Adding the for update clause causes the
advertisement
system to treat data that are read as if they had been
4. Under first updater wins the system uses a updated for purposes of concurrency control.
__________ mechanism that applies only to updates.
8. Evaluate the CREATE TABLE statement:
a) Close
b) Read CREATE TABLE products
c) Locking
(product_id NUMBER(6) CONSTRAINT prod_id_pk
d) Beat
PRIMARY KEY, product_name VARCHAR2(15));
View Answer
Which statement is true regarding the PROD_ID_PK
Answer: c
constraint?
Explanation: Reads are unaffected by this, since they do
a) It would be created only if a unique index is manually
not obtain locks.
created first
5. When a transaction Ti attempts to update a data b) It would be created and would use an automatically
item, it requests a _________ on that data item. created unique index
a) Read lock c) It would be created and would use an automatically
b) Update lock created no unique index
c) Write lock d) It would be created and remains in a disabled state
d) Chain lock because no index is specified in the command
View Answer View Answer

Answer: c Answer: b
Explanation: Reads are unaffected by this, since they do Explanation: Syntax: create table table_name(name
not obtain locks. constraint).

Page 123 of 139


9. Evaluate the following CREATE SEQUENCE statement: This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “Insertion Deletion
CREATE SEQUENCE seq1
Predicate Reads”.
START WITH 100
1. Which statements are correct regarding indexes?
INCREMENT BY 10 a) When a table is dropped, the corresponding indexes
are automatically dropped
MAXVALUE 200 b) For each DML operation performed, the
CYCLE corresponding indexes are automatically updated
c) A non-deferrable PRIMARY KEY or UNIQUE KEY
NOCACHE; constraint in a table automatically creates a unique
The sequence SEQ1 has generated numbers up to the index
maximum limit of 200. You issue the following SQL d) All of the mentioned
statement: View Answer
SELECT [Link] FROM dual; Answer: d
What is displayed by the SELECT statement? Explanation: Indexes are used to access the data
a) 1 efficiently.
b) 10
c) 100 2. You executed the following SQL statements in the
d) an error given order:
View Answer CREATE TABLE orders
Answer: a (order_id NUMBER(3) PRIMARY KEY,
Explanation: Sequence is used to generate a series of
values. order_date DATE,

10. In which scenario would you use the ROLLUP customer_idnumber(3));


operator for expression or columns within a GROUP BY
clause?
a) To find the groups forming the subtotal in a row INSERT INTO orders VALUES (100,'10-mar-2007,,222);
b) To create group-wise grand totals for the groups
specified within a GROUP BY clause
c) To create a grouping for expressions or columns ALTER TABLE orders MODIFY order_date NOT NULL;
specified within a GROUP BY clause in one direction,
from
right to left for calculating the subtotals UPDATE orders SET customer_id=333;
d) To create a grouping for expressions or columns
specified within a GROUP BY clause in all possible
directions, which is cross-tabular report for calculating DELETE FROM order;
the subtotals
View Answer The DELETE statement results in the following error:
ERROR at line 1: table or view does not exist
Answer: c What would be the outcome?
Explanation: Sequence is used to generate a series of a) All the statements before the DELETE statement
values. would be rolled back
Database Questions and Answers – Insertion Deletion b) All the statements before the DELETE statement
Predicate Reads would be implicitly committed within the session
c) All the statements up to the ALTER TABLE statement
would be committed and the outcome of UPDATE
Page 124 of 139
statement would be rolled back values from the same table
d) All the statements up to the ALTER TABLE statement c) A SELECT statement that can be embedded in a clause
would be committed and the outcome of the UPDATE of another SELECT statement only
statement is retained uncommitted within the session d) A set of one or more sequential queries in which
View Answer generally the result of the inner query is used as the
search value in the outer query
Answer: d
View Answer
Explanation: Committing a transaction refers to making
the changes to record in the database. Answer: d
Explanation: A noncorrelated subquery is subquery that
advertisement
is independent of the outer query and it can executed
3. Evaluate the following statements: on its own without relying on main outer query.

Sanfoundry Certification Contest of the Month is Live. 5. Which statement is true regarding synonyms?
100+ Subjects. Participate Now! a) Synonyms can be created for tables but not views
b) Synonyms are used to reference only those tables
CREATE TABLE digits that are owned by another user
(id NUMBER(2), c) A public synonym and a private synonym can exist
with the same name for the same table
description VARCHAR2(15)); d) The DROP SYNONYM statement removes the
INSERT INTO digits VALUES (1,'ONE); synonym, and the status of the table on which the
synonym has been created becomes invalid
UPDATE digits SET description ='TWO'WHERE id=1; View Answer
INSERT INTO digits VALUES (2 ,'TWO'); Answer: c
Explanation: A synonym is an alias or alternate name for
COMMIT;
a table, view, sequence, or other schema object. They
DELETE FROM digits; are used mainly to make it easy for users to access
database objects owned by other users.
SELECT description FROM digits
6. SCOTT is a user in the database.
VERSIONS BETWEEN TIMESTAMP MINVALUE AND
MAXVALUE; Evaluate the commands issued BY the DBA:
What would be the outcome of the above query? 1 - CREATE ROLE mgr;
a) It would not display any values
2 - GRANT CREATE TABLE, SELECT
b) It would display the value TWO once
c) It would display the value TWO twice ON oe. orders TO mgr;
d) It would display the values ONE, TWO, and TWO
View Answer 3 - GRANT mgr, CREATE TABLE TO SCOTT;

Answer: c Which statement is true regarding the execution of the


Explanation: The VERSIONS BETWEEN clause of the above commands?
SELECT statement is used to create a Flashback Version a) Statement 1 would not execute because the WITH
Query. GRANT option is missing
b) Statement 1 would not execute because the
4. A non-correlated subquery can be defined IDENTIFIED BY clause is missing
as________ c) Statement 3 would not execute because role and
a) A set of sequential queries, all of which must always system privileges cannot be granted together in a single
return a single value GRANT statement
b) A set of sequential queries, all of which must return d) Statement 2 would not execute because system
Page 125 of 139
privileges and object privileges cannot be granted SAVEPOINT b;
together in a single GRANT command
DELETE FROM product WHERE pcode = 2;
View Answer
COMMIT;
Answer: d
Explanation: The GRANT statement is used to give DELETE FROM product WHERE pcode=10;
privileges to a specific user or role, or to all users, to
perform actions on database objects. ROLLBACK TO SAVEPOINT a;

7. OE and SCOTT are the users in the database. The Which statement describes the consequences?
ORDERS table is owned by OE. Evaluate the statements a) No SQL statement would be rolled back
issued by the DBA in the following sequence: b) Both the DELETE statements would be rolled back
c) Only the second DELETE statement would be rolled
CREATE ROLE r1; back
d) Both the DELETE statements and the UPDATE
GRANT SELECT, INSERT ON oe. orders TO r1;
statement would be rolled back
GRANT r1 TO scott; View Answer

GRANT SELECT ON oe. orders TO scott; Answer: d


Explanation: The SAVEPOINT statement names and
REVOKE SELECT ON [Link] FROM scott;
marks the current point in the processing of a
What would be the outcome after executing the transaction. With the ROLLBACK TO statement,
statements? savepoints undo parts of a transaction instead of the
a) SCOTT would be able to query the [Link] table whole transaction.
b) SCOTT would not be able to query the [Link]
9. Evaluate the following command:
table
c) The REVOKE statement would remove the SELECT CREATE TABLE employees (employee_id NUMBER(2)
privilege from SCOTT as well as from the role R1 PRIMARY KEY, last_name VARCHAR2(25) NOT
d) The REVOKE statement would give an error because
NULL, department_id NUMBER(2), job_id VARCHAR2(8),
the SELECT privilege has been granted to the role R1
salary NUMBER(10,2));
View Answer
You issue the following command TO CREATE a VIEW
Answer: a
that displays the IDs AND LAST names OF the sales staff
Explanation: The REVOKE statement is used to remove
IN the organization:
privileges from a specific user or role, or from all users,
to perform actions on database objects. CREATE OR REPLACE VIEW sales_staff_vu AS SELECT
employee_id, last_name job_id FROM employees
8. Given below are the SQL statements executed in a
user session: WHERE job_id LIKE 'SA_%' WITH CHECK OPTION;
CREATE TABLE product Which statements are true regarding the above view?
a) It allows you to insert details of all new staff into the
(pcode NUMBER(2),
EMPLOYEES table
pnameVARCHAR2(10)); b) It allows you to delete the details of the existing sales
staff from the EMPLOYEES table
INSERT INTO product VALUES(1, 'pen');
c) It allows you to update the job ids of the existing sales
INSERT INTO product VALUES (2,'penci'); staff to any other job id in the EMPLOYEES table
d) It allows you to insert the IDs, last
SAVEPOINT a; View Answer
UPDATE product SET pcode = 10 WHERE pcode = 1;
Page 126 of 139
Answer: d a) Direct
Explanation: SQL Create view syntax : b) Hash
c) Random
CREATE VIEW view_name AS
d) Sequential
SELECT column_name(s) View Answer

FROM TABLE_NAME Answer: b


Explanation: Hash technique uses particular hash key
WHERE condition. value.
10. EMPDET is an external table containing the columns 2. Why do we need concurrency control on B+ trees ?
EMPNO and ENAME. Which command would work in a) To remove the unwanted data
relation to the EMPDET table? b) To easily add the index elements
a) c) To maintain accuracy of index
UPDATE empdet d) All of the mentioned
View Answer
SET ename = 'Amit'
Answer: c
WHERE empno = 1234; Explanation: Indices do not have to be treated like other
b) database structures.

DELETE FROM empdet 3. How many techniques are available to control


concurrency on B+ trees?
WHERE ename LIKE 'J%'; a) One
b) Three
c)
c) Four
CREATE VIEW empvu d) None of the mentioned
View Answer
AS
Answer: d
SELECT* FROM empdept;
Explanation: Two techniques are present.
d)
advertisement
CREATE INDEX empdet_idx
4. In crabbing protocol locking
ON empdet(empno); a) Goes down the tree and back up
b) Goes up the tree and back down
View Answer c) Goes down the tree and releases
Answer: c d) Goes up the tree and releases
Explanation: External tables are created using the SQL View Answer
CREATE TABLE…ORGANIZATION EXTERNAL statement. Answer: a
When an external table is created, you specify type Explanation: It moves in a crab like manner.
,default directory, access parameters and location.
5. The deadlock can be handled by
Database Questions and Answers – Concurrency in a) Removing the nodes that are deadlocked
Index Structures b) Restarting the search after releasing the lock
This set of Database Question Bank focuses on c) Restarting the search without releasing the lock
“Concurrency in Index Structures”. d) Resuming the search
View Answer
1. The method of access that uses key transformation is
called as
Page 127 of 139
Answer: b d) Left
Explanation: Crabbing protocol moves in a crab like View Answer
manner.
Answer: c
Note: Join free Sanfoundry classes Explanation: This pointer is required because a lookup
at Telegram or Youtube that occurs while a node is being split may have to
search not only that node but also that node’s right
6. In crabbing protocol, the lock obtained on the root
sibling.
node is in _________ mode.
a) Shared 10. Instead of locking index leaf nodes in a two-phase
b) Exclusive manner, some index concurrency-control schemes use
c) Read only ___________ on individual key values, allowing other
d) None of the mentioned key values to be inserted or deleted from the same leaf.
View Answer a) B+ tree locking
b) Link level locking
Answer: a
c) Key-value locking
Explanation: Crabbing protocol moves in a crab like
d) Next value locking
manner down the index tree.
View Answer
7. If needed to split a node or coalesce it with its
Answer: c
siblings, or redistribute key values between siblings, the
Explanation: Key-value locking thus provides increased
crabbing protocol locks the parent of the node in
concurrency.
____________ mode.
a) Shared
b) Exclusive
c) Read only
d) None of the mentioned
View Answer

Answer: b
Explanation: Crabbing protocol moves in a crab like
manner down the index tree.

8. In crabbing protocol to inset or delete a key value the


leaf node has to be locked in ___________ mode.
a) Shared
b) Exclusive
c) Read only
d) None of the mentioned
View Answer

Answer: b
Explanation: Crabbing protocol moves in a crab like
manner down the index tree.

9. B-link tree requires a pointer to its __________


sibling.
a) Upper
b) Lower
c) Right

Page 128 of 139


Database Questions and Answers – Failure Answer: c
Classification Explanation: The transaction, can be re-executed at a
later time.
This set of Database Multiple Choice Questions &
Answers (MCQs) focuses on “Failure Classification”. 5. The transaction can no longer continue with its
normal execution because of some internal condition,
1. The recovery scheme must also provide
such as bad input, data not found, overflow, or resource
a) High availability
limit exceeded. This is
b) Low availability
a) Read error
c) High reliability
b) Boot error
d) High durability
c) Logical error
View Answer
d) System error
Answer: a View Answer
Explanation: It must minimize the time for which the
Answer: c
database is not usable after a failure.
Explanation: The transaction, can be re-executed at a
2. Which one of the following is a failure to a system later time.
a) Boot crash
Note: Join free Sanfoundry classes
b) Read failure
at Telegram or Youtube
c) Transaction failure
d) All of the mentioned 6. The assumption that hardware errors and bugs in the
View Answer software bring the system to a halt, but do not corrupt
the nonvolatile storage contents, is known as the
Answer: c
a) Stop assumption
Explanation: Types of system failure are transaction
b) Fail assumption
failure, system crash and disk failure.
c) Halt assumption
3. Which of the following belongs to transaction failure d) Fail-stop assumption
a) Read error View Answer
b) Boot error
Answer: d
c) Logical error
Explanation: Well-designed systems have numerous
d) All of the mentioned
internal checks, at the hardware and the software level,
View Answer
that bring the system to a halt when there is an error.
Answer: c Hence, the fail-stop assumption is a reasonable one.
Explanation: Types of system transaction failure are
7. Which kind of failure loses its data in head crash or
logical and system error.
failure during a transfer operation.
advertisement a) Transaction failure
b) System crash
4. The system has entered an undesirable state (for c) Disk failure
example, deadlock), as a result of which a transaction d) All of the mentioned
cannot continue with its normal execution. This is View Answer
a) Read error
b) Boot error Answer: c
c) Logical error Explanation: Copies of the data on other disks, or
d) System error archival backups on tertiary media, such as DVD or
View Answer tapes, are used to recover from the failure.

8. The failure occurred sufficiently early during the


transfer that the destination block remains intact.
Page 129 of 139
a) Partial Failure 2. In the ___________ scheme, a transaction that wants
b) Total failure to update the database first creates a complete copy of
c) Successful completion the database.
d) Data transfer failure a) Shadow copy
View Answer b) Shadow Paging
c) Update log records
Answer: a
d) All of the mentioned
Explanation: Copies of the data on other disks, or
View Answer
archival backups on tertiary media, such as DVD or
tapes, are used to recover from the failure. Answer: a
Explanation: If at any point the transaction has to be
9. The database is partitioned into fixed-length storage
aborted, the system merely deletes the new copy. The
units called
old copy of the database has not been affected.
a) Parts
b) Blocks 3. The ____________ scheme uses a page table
c) Reads containing pointers to all pages; the page table itself and
d) Build all updated pages are copied to a new location.
View Answer a) Shadow copy
b) Shadow Paging
Answer: b
c) Update log records
Explanation: Blocks are the units of data transfer to and
d) All of the mentioned
from disk, and may contain several data items.
View Answer
10. Which of the following causes system to crash
Answer: b
a) Bug in software
Explanation: Any page which is not updated by a
b) Loss of volatile data
transaction is not copied, but instead the new page
c) Hardware malfunction
table just stores a pointer to the original page.
d) All of the mentioned
View Answer advertisement

Answer: d 4. The current copy of the database is identified by a


Explanation: The content of non-volatile storage pointer, called ____________ which is stored on disk.
remains intact, and is not corrupted. a) Db-pointer
b) Update log
Database Questions and Answers – Recovery
c) Update log records
This set of Database Multiple Choice Questions & d) All of the mentioned
Answers (MCQs) focuses on “Recovery”. View Answer

1. The log is a sequence of _________ recording all the Answer: a


update activities in the database. Explanation: Any page which is not updated by a
a) Log records transaction is not copied, but instead the new page
b) Records table just stores a pointer to the original page.
c) Entries
5. If a transaction does not modify the database until it
d) Redo
has committed, it is said to use the ___________
View Answer
technique.
Answer: a a) Deferred-modification
Explanation: The most widely used structure for b) Late-modification
recording database modifications is the log. c) Immediate-modification
d) Undo
View Answer
Page 130 of 139
Answer: a b) Redo
Explanation: Deferred modification has the overhead c) Replay
that transactions need to make local copies of all d) Undo
updated data items; further, if a transaction reads a data View Answer
item that it has updated, it must read the value from its
Answer: a
local copy.
Explanation: Undo brings the previous contents.
Subscribe Now: DBMS Newsletter | Important Subjects
10. A special redo-only log record < Ti, Xj, V1> is written
Newsletters
to the log, where V1 is the value being restored to data
6. If database modifications occur while the transaction item Xj during the rollback. These log records are
is still active, the transaction is said to use the sometimes called
___________technique. a) Log records
a) Deferred-modification b) Records
b) Late-modification c) Compensation log records
c) Immediate-modification d) Compensation redo records
d) Undo View Answer
View Answer
Answer: c
Answer: c Explanation: Such records do not need undo
Explanation: We say a transaction modifies the database information since we never need to undo such an undo
if it performs an update on a disk buffer, or on the disk operation.
itself; updates to the private part of main memory do
Database Questions and Answers – Buffer
not count as database modifications.
Management
7. ____________ using a log record sets the data item
This set of Database Multiple Choice Questions &
specified in the log record to the old value.
Answers (MCQs) focuses on “Buffer Management”.
a) Deferred-modification
b) Late-modification 1. In order to reduce the overhead in retrieving the
c) Immediate-modification records from the storage space we use
d) Undo a) Logs
View Answer b) Log buffer
c) Medieval space
Answer: d
d) Lower records
Explanation: Undo brings the previous contents.
View Answer
8. In the __________ phase, the system replays updates
Answer: b
of all transactions by scanning the log forward from the
Explanation: The output to stable storage is in units of
last checkpoint.
blocks.
a) Repeating
b) Redo 2. The order of log records in the stable storage
c) Replay ____________ as the order in which they were written
d) Undo to the log buffer.
View Answer a) Must be exactly the same
b) Can be different
Answer: b
c) Is opposite
Explanation: Undo brings the previous contents.
d) Can be partially same
9. The actions which are played in the order while View Answer
recording it is called ______________ history.
a) Repeating
Page 131 of 139
Answer: a 6. ______________ policy allows multiple updates to
Explanation: As a result of log buffering, a log record accumulate on a block before it is output to stable
may reside in only main memory (volatile storage) for a storage, which can reduce the number of output
considerable time before it is output to stable storage. operations greatly for frequently updated blocks.
a) Force
3. Before a block of data in main memory can be output
b) No-force
to the database, all log records pertaining to data in that
c) Steal
block must have been output to stable storage. This is
d) No-steal
a) Read-write logging
View Answer
b) Read-ahead logging
c) Write-ahead logging Answer: b
d) None of the mentioned Explanation: No-force policy allows faster commit of
View Answer transactions.

Answer: c 7. The ___________ policy, allows the system to write


Explanation: The WAL rule requires only that the undo modified blocks to disk even if the transactions that
information in the log has been output to stable storage, made those modifications have not all committed.
and it permits the redo information to be written later. a) Force
b) No-force
advertisement
c) Steal
4. Writing the buffered log to __________ is sometimes d) No-steal
referred to as a log force. View Answer
a) Memory
Answer: c
b) Backup
Explanation: The no-steal policy does not work with
c) Redo memory
transactions that perform a large number of updates.
d) Disk
View Answer 8. Locks on buffer blocks are unrelated to locks used for
concurrency-control of transactions, and releasing them
Answer: d
in a non-two-phase manner does not have any
Explanation: If there are insufficient log records to fill
implications on transaction serializability. This is
the block, all log records in main memory are combined
a) Latches
into a partially full block and are output to stable
b) Swap Space
storage.
c) Dirty Block
5. The _______________ policy, allows a transaction to d) None of the mentioned
commit even if it has modified some blocks that have View Answer
not yet been written back to disk.
Answer: a
a) Force
Explanation: These locks, and other similar locks that
b) No-force
are held for a short duration.
c) Steal
d) No-steal 9. The __________________ contains a list of blocks
View Answer that have been updated in the database buffer.
a) Latches
Answer: b
b) Swap Space
Explanation: No-force policy allows faster commit of
c) Dirty Block
transactions.
d) None of the mentioned
Sanfoundry Certification Contest of the Month is Live. View Answer
100+ Subjects. Participate Now!
Answer: c
Explanation: Dirty blocks are those that have been
Page 132 of 139
updated in memory, and the disk version is not up-to-
date.

10. The operating system reserves space on disk for


storing virtual-memory pages that are not currently in
main memory; this space is called
a) Latches
b) Swap Space
c) Dirty Block
d) None of the mentioned
View Answer

Answer: b
Explanation: Almost all current-generation operating
systems retain complete control of virtual memory.

Page 133 of 139


Database Questions and Answers – Failure with d) Magnetic bubble memory
Nonvolatile Storage View Answer

This set of Database Multiple Choice Questions & Answer: d


Answers (MCQs) focuses on “Failure with Nonvolatile Explanation: Bubble domain visualization by using
Storage”. CMOS-MagView.

1. The silicon chips used for data processing are called 5. The ALU of a computer normally contains a number
a) RAM chips of high speed storage element called
b) ROM chips a) Semiconductor memory
c) Micro processors b) Registers
d) PROM chips c) Hard disks
View Answer d) Magnetic disk
View Answer
Answer: d
Explanation: PROM is Programmable Read Only Answer: b
Memory. Explanation: External control unit tells the ALU what
operation to perform on that data, and then the ALU
2. Which of the following is used for manufacturing
stores its result into an output register.
chips?
a) Control bus Sanfoundry Certification Contest of the Month is Live.
b) Control unit 100+ Subjects. Participate Now!
c) Parity unit
6. Which of the following is used only for data entry and
d) Semiconductor
storage, and never for processing?
View Answer
a) Mouse
Answer: d b) Dumb terminal
Explanation: A semiconductor is a material which has c) Micro computer
electrical conductivity between that of a conductor such d) Dedicated data entry system
as copper and that of an insulator such as glass. View Answer

3. What was the name of the first commercially Answer: b


available microprocessor chip? Explanation: Dumb terminals are those that can
a) Intel 308 interpret a limited number of control codes.
b) Intel 33
7. Non-volatile storage needs to have a _________
c) Intel 4004
where the loses in future can be recovered.
d) Motorola 639
a) Dump
View Answer
b) Recover place
Answer: c c) Disk
Explanation: The Intel 4004 is a 4-bit central processing d) Redo plan
unit (CPU) released by Intel Corporation in 1971 View Answer

advertisement Answer: a
Explanation: The basic scheme is to dump the entire
4. The magnetic storage chip used to provide non-
contents of the database to stable storage periodically—
volatile direct access storage of data and that have no
say, once per day.
moving parts are known as
a) Magnetic core memory 8. A dump of the database contents is also referred to as
b) Magnetic tape memory an _____________ dump.
c) Magnetic disk memory a) Archival

Page 134 of 139


b) Fuzzy Answer: b
c) SQL Explanation: LSN is used to identify which operations
d) All of the mentioned have been applied to a database page.
View Answer
2. ARIES supports ___________ operations, which are
Answer: a physical in that the affected page is physically identified,
Explanation: We can archive the dumps and use them but can be logical within the page.
later to examine old states of the database. a) Physiological redo
b) Physiological undo
9. ________ dump, writes out SQL DDL statements and
c) Logical redo
SQL insert statements to a file, which can then be
d) Logical undo
reexecuted to re-create the database.
View Answer
a) Archival
b) Fuzzy Answer: a
c) SQL Explanation: The deletion of a record from a page may
d) All of the mentioned result in many other records in the page being shifted, if
View Answer a slotted page structure is used.

Answer: c 3. ______________ is used to minimize unnecessary


Explanation: Such dumps are useful when migrating redos during recovery.
data to a different instance of the database, or to a a) Dirty page table
different version of the database software, since the b) Page table
physical locations and layout may be different in the c) Dirty redo
other database instance or database software version. d) All of the mentioned
View Answer
10. _________ dump schemes have been developed
that allow transactions to be active while the dump is in Answer: a
progress. Explanation: Dirty pages are those that have been
a) Archival updated in memory, and the disk version is not up-to-
b) Fuzzy date.
c) SQL
advertisement
d) All of the mentioned
View Answer 4. __________ scheme that records only information
about dirty pages and associated information and does
Answer: b
not even require of writing dirty pages to disk.
Explanation: The simple dump procedure described
a) Fuzzy logic
here is costly and so fuzzy dump is used.
b) Checkpoints
Database Questions and Answers – ARIES c) Fuzzy-checkpoint
d) Logical checkpoint
This set of Database Multiple Choice Questions &
View Answer
Answers (MCQs) focuses on “ARIES”.
Answer: c
1. ARIES uses a ___________ to identify log records, and
Explanation: It flushes dirty pages in the background,
stores it in database pages.
continuously, instead of writing them during
a) Log sequence number
checkpoints.
b) Log number
c) Lock number 5. Whenever an update operation occurs on a page, the
d) Sequence operation stores the LSN of its log record in the _______
View Answer field of the page.
a) LSN
Page 135 of 139
b) ReadLSN 9. __________ starts from a position determined during
c) PageLSN analysis, and performs a redo, repeating history, to bring
d) RedoLSN the database to a state it was in before the crash.
View Answer a) Analysis pass
b) Redo pass
Answer: c
c) Undo pass
Explanation: Each page maintains an identifier called the
d) None of the mentioned
PageLSN.
View Answer
Sanfoundry Certification Contest of the Month is Live.
Answer: b
100+ Subjects. Participate Now!
Explanation: The redo pass repeats history by replaying
6. There are special redo-only log records generated every action that is not already reflected in the page on
during transaction rollback, called _________ in ARIES. disk.
a) Compensation log records
10. ______________ rolls back all transactions that
b) Read log records
were incomplete at the time of crash.
c) Page log records
a) Analysis pass
d) Redo log records
b) Redo pass
View Answer
c) Undo pass
Answer: a d) None of the mentioned
Explanation: These serve the same purpose as the redo- View Answer
only log records in our earlier recovery scheme.
Answer: c
7. The __________________ contains a list of pages Explanation: It performs a single backward scan of the
that have been updated in the database buffer. log, undoing all transactions in undo-list.
a) Dirty page table
Database Questions and Answers – Lock Release and
b) Page table
Undo Operations
c) Dirty redo
d) All of the mentioned This set of Database Multiple Choice Questions &
View Answer Answers (MCQs) focuses on “Lock Release and Undo
Operations”.
Answer: a
Explanation: Dirty pages are those that have been 1. Which lock should be obtained to prevent a
updated in memory, and the disk version is not up-to- concurrent transaction from executing a conflicting
date. read, insert or delete operation on the same key value.
a) Higher-level lock
8. ___________ determines which transactions to undo,
b) Lower-level lock
which pages were dirty at the time of the crash, and the
c) Read only lock
LSN from which the redo pass should start.
d) Read write
a) Analysis pass
View Answer
b) Redo pass
c) Undo pass Answer: a
d) None of the mentioned Explanation: Operations acquire lower-level locks while
View Answer they execute, but release them when they complete;
the corresponding transaction must however retain a
Answer: a
higher-level lock in a two-phase manner to prevent
Explanation: The analysis pass finds the last complete
concurrent transactions from executing conflicting
checkpoint log record, and reads in the DirtyPageTable
actions.
from this record.

Page 136 of 139


2. Once the lower-level lock is released, the operation d) None of the mentioned
cannot be undone by using the old values of updated View Answer
data items, and must instead be undone by executing a
Answer: c
compensating operation; such an operation is called
Explanation: Data structures such as B+-trees would not
a) Logical operation
be in a consistent state, and neither logical redo nor
b) Redo operation
logical undo operations can be performed on an
c) Logical undo operation
inconsistent data structure.
d) Undo operation
View Answer 6. An operation is said to be __________ if executing it
several times in a row gives the same result as executing
Answer: a
it once.
Explanation: It is important that the lower-level locks
a) Idempotent
acquired during an operation are sufficient to perform a
b) Changed
subsequent logical undo of the operation.
c) Repetitive
3. Which of the following is used for undo operations d) All of the above
alone? View Answer
a) Logical logging
Answer: a
b) Physical logging
Explanation: Operations such as inserting an entry into a
c) Physical log records
B+-tree may not be idempotent, and the recovery
d) Physical logging and Physical log records
algorithm must therefore make sure that an operation
View Answer
that has already been performed is not performed
Answer: a again.
Explanation: If the operation inserted an entry in a B+-
Sanfoundry Certification Contest of the Month is Live.
tree, the undo information U would indicate that a
100+ Subjects. Participate Now!
deletion operation is to be performed, and would
identify the B+-tree and what entry to delete from the 7. Immediate database modification technique uses
tree. Such logging of information about operations is a) Both undo and redo
called logical logging. b) Undo but no redo
c) Redo but no undo
4. Redo operations are performed exclusively using
d) Neither undo nor redo
a) Logical logging
View Answer
b) Physical logging
c) Physical log records Answer: a
d) Both Physical logging and Physical log records Explanation: Undo erases all the changes and redo
View Answer makes the deleted changes.
Answer: d 8. Shadow paging has
Explanation: Logging of old-value and new-value a) no redo
information is called physical logging. b) no undo
c) redo but no undo
advertisement
d) neither redo nor undo
5. To perform logical redo or undo, the database state View Answer
on disk must be operation ___________ that is, it
Answer: a
should not have partial effects of any operation.
Explanation: Undo erases all the changes and redo
a) Persistent
makes the deleted changes.
b) Resistant
c) Consistent

Page 137 of 139


9. For correct behaviour during recovery, undo and redo a) Synchronised
operation must be b) Separated
a) Commutative c) Connected
b) Associative d) Detached but related
c) Idempotent View Answer
d) Distributive
Answer: a
View Answer
Explanation: We can achieve high availability by
Answer: c performing transaction processing at one site, called the
Explanation: Undo erases all the changes and redo primary site, and having a remote backup site where all
makes the deleted changes. the data from the primary site are replicated.

10. If ___________ are not obtained in undo operation 3. The backup is taken by
it will cause problem in undo-phase. a) Erasing all previous records
a) Higher-level lock b) Entering the new records
b) Lower-level lock c) Sending all log records from primary site to the
c) Read only lock remote backup site
d) Read write d) Sending selected records from primary site to the
View Answer remote backup site
View Answer
Answer: b
Explanation: Operations acquire lower-level locks while Answer: c
they execute, but release them when they complete; Explanation: We can achieve high availability by
the corresponding transaction must however retain a performing transaction processing at one site, called the
higher-level lock in a two-phase manner to prevent primary site, and having a remote backup site where all
concurrent transactions from executing conflicting the data from the primary site are replicated.
actions.
advertisement

4. When the __________ the backup site takes over


Database Questions and Answers – Remote Backup processing and becomes the primary.
Systems a) Secondary fails
b) Backup recovers
This set of Database Multiple Choice Questions &
c) Primary fails
Answers (MCQs) focuses on “Remote Backup Systems”.
d) None of the mentioned
1. The remote backup site is sometimes also called the View Answer
a) Primary Site
Answer: c
b) Secondary Site
Explanation: When the original primary site recovers, it
c) Tertiary Site
can either play the role of remote backup, or take over
d) None of the mentioned
the role of primary site again.
View Answer
5. The simplest way of transferring control is for the old
Answer: b
primary to receive __________ from the old backup
Explanation: We can achieve high availability by
site.
performing transaction processing at one site, called the
a) Undo logs
primary site, and having a remote backup site where all
b) Redo Logs
the data from the primary site are replicated.
c) Primary Logs
2. Remote backup system must be _________ with the d) All of the mentioned
primary site. View Answer

Page 138 of 139


Answer: c 9. A transaction commits as soon as its commit log
Explanation: If control must be transferred back, the old record is written to stable storage at the primary and
backup site can pretend to have failed, resulting in the the backup site. This is
old primary taking over. a) One Safe
b) Two Safe
Note: Join free Sanfoundry classes
c) Two-very Safe
at Telegram or Youtube
d) Very Safe
6. The time to process the remote backup can be View Answer
reduced by
Answer: c
a) Flags
Explanation: The problem with this scheme is that
b) Breakpoints
transaction processing cannot proceed if either the
c) Redo points
primary or the backup site is down.
d) Checkpoints
View Answer 10. If only the primary is active, the transaction is
allowed to commit as soon as its commit log record is
Answer: d
written to stable storage at the primary site. This is
Explanation: If the log at the remote backup grows
a) One Safe
large, recovery will take a long time. The remote backup
b) Two Safe
site can periodically process the redo log records that it
c) Two-very Safe
has received and can perform a checkpoint, so that
d) Very Safe
earlier parts of the log can be deleted.
View Answer
7. A _______________ configuration can make takeover
Answer: b
by the backup site almost instantaneous.
Explanation: This scheme provides better availability
a) Hot-spare
than does two-very-safe, while avoiding the problem of
b) Remote
lost transactions faced by the one-safe scheme.
c) Direct
d) Spare
View Answer

Answer: d
Explanation: In this configuration, the remote backup
site continually processes redo log records as they
arrive, applying the updates locally.

8. A transaction commits as soon as its commit log


record is written to stable storage at the primary site.
This is
a) One Safe
b) Two Safe
c) Two-very Safe
d) Very Safe
View Answer

Answer: a
Explanation: The problem with this scheme is that the
updates of a committed transaction may not have made
it to the backup site, when the backup site takes over
processing.

Page 139 of 139

You might also like