0% found this document useful (0 votes)
0 views52 pages

dbms mcq

The document provides a comprehensive overview of database concepts, including relational databases, keys, query operations, relational algebra, calculus, ER models, constraints, and diagrams. It includes multiple-choice questions to test understanding of these topics, covering definitions, relationships, operations, and integrity constraints. The content is structured to facilitate learning and assessment in database management systems.

Uploaded by

sorkarsandy
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)
0 views52 pages

dbms mcq

The document provides a comprehensive overview of database concepts, including relational databases, keys, query operations, relational algebra, calculus, ER models, constraints, and diagrams. It includes multiple-choice questions to test understanding of these topics, covering definitions, relationships, operations, and integrity constraints. The content is structured to facilitate learning and assessment in database management systems.

Uploaded by

sorkarsandy
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
You are on page 1/ 52

Database & Schema

1. A relational database consists of a collection of


a) Tables
b) Fields
c) Records
d) Keys
2. A ________ in a table represents a relationship among a set of values.
a) Column
b) Key
c) Row
d) Entry
3. The term _______ is used to refer to a row.
a) Attribute
b) Tuple
c) Field
d) Instance
4. The term attribute refers to a ___________ of a table.
a) Record
b) Column
c) Tuple
d) Key
5. For each attribute of a relation, there is a set of permitted values, called the ________ of that
attribute.
a) Domain
b) Relation
c) Set
d) Schema
6. Database __________ which is the logical design of the database, and the database _______ which
is a snapshot of the data in the database at a given instant in time.
a) Instance, Schema
b) Relation, Schema
c) Relation, Domain
d) Schema, Instance
7. Course(course_id,sec_id,semester)
Here the course_id,sec_id and semester are __________ and course is a _________
a) Relations, Attribute
b) Attributes, Relation
c) Tuple, Relation
d) Tuple, Attributes
8. Department (dept name, building, budget) and Employee (employee_id, name, dept name,
salary)
Here the dept_name attribute appears in both the relations. Here using common attributes in
relation schema is one way of relating ___________ relations.
a) Attributes of common
b) Tuple of common
c) Tuple of distinct
d) Attributes of distinct
9. A domain is atomic if elements of the domain are considered to be ____________ units.
a) Different
b) Indivisbile
c) Constant
d) Divisible
10. The tuples of the relations can be of ________ order.
a) Any
b) Same
c) Sorted
d) Constant
Keys

1. Which one of the following is a set of one or more attributes taken collectively to uniquely
identify a record?
a) Candidate key
b) Sub key
c) Super key
d) Foreign key
2. Consider attributes ID, CITY and NAME. Which one of this can be considered as a super key?
a) NAME
b) ID
c) CITY
d) CITY, ID
3. The subset of a super key is a candidate key under what condition?
a) No proper subset is a super key
b) All subsets are super keys
c) Subset is a super key
d) Each subset is a super key
4. A _____ is a property of the entire relation, rather than of the individual tuples in which each
tuple is unique.
a) Rows
b) Key
c) Attribute
d) Fields
5. Which one of the following attribute can be taken as a primary key?
a) Name
b) Street
c) Id
d) Department
6. Which one of the following cannot be taken as a primary key?
a) Id
b) Register number
c) Dept_id
d) Street
7. An attribute in a relation is a foreign key if the _______ key from one relation is used as an
attribute in that relation.
a) Candidate
b) Primary
c) Super
d) Sub
8. The relation with the attribute which is the primary key is referenced in another relation. The
relation which has the attribute as a primary key is called ______________
a) Referential relation
b) Referencing relation
c) Referenced relation
d) Referred relation
9. The ______ is the one in which the primary key of one relation is used as a normal attribute in
another relation.
a) Referential relation
b) Referencing relation
c) Referenced relation
d) Referred relation
10. A _________ integrity constraint requires that the values appearing in specified attributes of any
tuple in the referencing relation also appear in specified attributes of at least one tuple in the
referenced relation.
a) Referential
b) Referencing
c) Specific
d) Primary

Query operation and operators

1. Using which language can a user request information from a database?


a) Query
b) Relational
c) Structural
d) Compiler
2. Student(ID, name, dept name, tot_cred)
In this query which attributes form the primary key?
a) Name
b) Dept
c) Tot_cred
d) ID
3. Which one of the following is a procedural language?
a) Domain relational calculus
b) Tuple relational calculus
c) Relational algebra
d) Query language
4. The_____ operation allows the combining of two relations by merging pairs of tuples, one from
each relation, into a single tuple.
a) Select
b) Join
c) Union
d) Intersection
5. The result which operation contains all pairs of tuples from the two relations, regardless of
whether their attribute values match.
a) Join
b) Cartesian product
c) Intersection
d) Set difference
6. The _______operation performs a set union of two “similarly structured” tables
a) Union
b) Join
c) Product
d) Intersect
7. The most commonly used operation in relational algebra for projecting a set of tuple from a
relation is
a) Join
b) Projection
c) Select
d) Union
8. The _______ operator takes the results of two queries and returns only rows that appear in both
result sets.
a) Union
b) Intersect
c) Difference
d) Projection
9. A ________ is a pictorial depiction of the schema of a database that shows the relations in the
database, their attributes, and primary keys and foreign keys.
a) Schema diagram
b) Relational algebra
c) Database diagram
d) Schema flow
10. The _________ provides a set of operations that take one or more relations as input and return
a relation as an output.
a) Schematic representation
b) Relational algebra
c) Scheme diagram
d) Relation flow

Relational algebra

1. Relational Algebra is a __________ query language that takes two relations as input and produces
another relation as an output of the query.
a) Relational
b) Structural
c) Procedural
d) Fundamental
2. Which of the following is a fundamental operation in relational algebra?
a) Set intersection
b) Natural join
c) Assignment
d) None of the mentioned
3. Which of the following is used to denote the selection operation in relational algebra?
a) Pi (Greek)
b) Sigma (Greek)
c) Lambda (Greek)
d) Omega (Greek)
4. For select operation the ________ appear in the subscript and the ___________ argument appears
in the paranthesis after the sigma.
a) Predicates, relation
b) Relation, Predicates
c) Operation, Predicates
d) Relation, Operation
5. The ___________ operation, denoted by −, allows us to find tuples that are in one relation but are
not in another.
a) Union
b) Set-difference
c) Difference
d) Intersection
6. Which is a unary operation:
a) Selection operation
b) Primitive operation
c) Projection operation
d) Generalized selection
7. Which is a join condition contains an equality operator:
a) Equijoins
b) Cartesian
c) Natural
d) Left
8. In precedence of set operators, the expression is evaluated from
a) Left to left
b) Left to right
c) Right to left
d) From user specification
9. Which of the following is not outer join?
a) Left outer join
b) Right outer join
c) Full outer join
d) All of the mentioned
10. The assignment operator is denoted by
a) ->
b) <-
c) =
d) ==

Calculas

1. Find the ID, name, dept name, salary for instructors whose salary is greater than $80,000 .
a) {t | t ε instructor ∧ t[salary] > 80000}
b) Э t ∈ r (Q(t))
c) {t | Э s ε instructor (t[ID] = s[ID]∧ s[salary] > 80000)}
d) None of the mentioned
2. A query in the tuple relational calculus is expressed as:
a) {t | P() | t}
b) {P(t) | t }
c) {t | P(t)}
d) All of the mentioned
3.

{t | Э s ε instructor (t[name] = s[name]


∧ Э u ε department (u[dept name] = s[dept name]
∧ u[building] = “Watson”))}

Which of the following best describes the query?


a) Finds the names of all instructors whose department is in the Watson building
b) Finds the names of all department is in the Watson building
c) Finds the name of the dapartment whose instructor and building is Watson
d) Returns the building name of all the departments
4. Which of the following symbol is used in the place of except?
a) ^
b) V
c) ¬
d) ~
5. “Find all students who have taken all courses offered in the Biology department.” The
expressions that matches this sentence is :
a) Э t ε r (Q(t))
b) ∀ t ε r (Q(t))
c) ¬ t ε r (Q(t))
d) ~ t ε r (Q(t))
6. Which of the following is the comparison operator in tuple relational calculus
a) ⇒
b) =
c) ε
d) All of the mentioned
7. An expression in the domain relational calculus is of the form
a) {P(x1, x2, . . . , xn) | < x1, x2, . . . , xn > }
b) {x1, x2, . . . , xn | < x1, x2, . . . , xn > }
c) { x1, x2, . . . , xn | x1, x2, . . . , xn}
d) {< x1, x2, . . . , xn > | P(x1, x2, . . . , xn)}

8. Find the names of all instructors in the Physics department together with the course id of all
courses they teach:
a)

{< c > | Э s (< c, a, s, y, b, r, t >ε section

∧s = “Fall” ∧ y = “2009”

∨Эu (< c, a, s, y, b, r, t >ε section

∧s = “Spring” ∧ y = “2010”

b)
{< n, c > | Э i, a (< i, c, a, s, y > ε teaches

∧ Э d, s (< i, n, d, s > ε instructor ∧ d = “Physics”))}

c)

{< n > | Э i, d, s (< i, n, d, s > ε instructor ∧ s > 80000)}

d)

{< i, n, d, s > | < i, n, d, s > ε instructor ∧ s > 80000}

9. In domain relaional calculus “there exist” can be expressed as


a) (P1(x))
b) (P1(x)) Э x
c) V x (P1(x))
d) Э x (P1(x))
10. A set of possible data values is called
a) Attribute
b) Degree
c) Tuple
d) Domain

Er model

1. An ________ is a set of entities of the same type that share the same properties, or attributes.
a) Entity set
b) Attribute set
c) Relation set
d) Entity model
2. Entity is a _________
a) Object of relation
b) Present working model
c) Thing in real world
d) Model of relation
3. The descriptive property possessed by each entity set is _________
a) Entity
b) Attribute
c) Relation
d) Model
4. The function that an entity plays in a relationship is called that entity’s _____________
a) Participation
b) Position
c) Role
d) Instance
5. The attribute name could be structured as an attribute consisting of first name, middle initial,
and last name. This type of attribute is called
a) Simple attribute
b) Composite attribute
c) Multivalued attribute
d) Derived attribute
6. The attribute AGE is calculated from DATE_OF_BIRTH. The attribute AGE is
a) Single valued
b) Multi valued
c) Composite
d) Derived
7. Not applicable condition can be represented in relation entry as
a) NA
b) 0
c) NULL
d) Blank Space
8. Which of the following can be a multivalued attribute?
a) Phone_number
b) Name
c) Date_of_birth
d) All of the mentioned
9. Which of the following is a single valued attribute
a) Register_number
b) Address
c) SUBJECT_TAKEN
d) Reference
10. In a relation between the entities the type and condition of the relation should be specified.
That is called as______attribute.
a) Desciptive
b) Derived
c) Recursive
d) Relative

Constraints

1. _____________ express the number of entities to which another entity can be associated via a
relationship set.
a) Mapping Cardinality
b) Relational Cardinality
c) Participation Constraints
d) None of the mentioned
2. An entity in A is associated with at most one entity in B, and an entity in B is associated with at
most one entity in A.This is called as
a) One-to-many
b) One-to-one
c) Many-to-many
d) Many-to-one
3. An entity in A is associated with at most one entity in B. An entity in B, however, can be
associated with any number (zero or more) of entities in A.
a) One-to-many
b) One-to-one
c) Many-to-many
d) Many-to-one
4. Data integrity constraints are used to:
a) Control who is allowed access to the data
b) Ensure that duplicate records are not entered into the table
c) Improve the quality of data entered for a specific property
d) Prevent users from changing the values stored in the table
5. Establishing limits on allowable property values, and specifying a set of acceptable, predefined
options that can be assigned to a property are examples of:
a) Attributes
b) Data integrity constraints
c) Method constraints
d) Referential integrity constraints
6. Which of the following can be addressed by enforcing a referential integrity constraint?
a) All phone numbers must include the area code
b) Certain fields are required (such as the email address, or phone number) before the record is
accepted
c) Information on the customer must be known before anything can be sold to that customer
d) Then entering an order quantity, the user must input a number and not some text (i.e., 12
rather than ‘a dozen’)
7. ______ is a special type of integrity constraint that relates two relations & maintains consistency
across the relations.
a) Entity Integrity Constraints
b) Referential Integrity Constraints
c) Domain Integrity Constraints
d) Domain Constraints
8. Which one of the following uniquely identifies the elements in the relation?
a) Secondary Key
b) Primary key
c) Foreign key
d) Composite key
9. Drop Table cannot be used to drop a table referenced by a _________ constraint.
a) Local Key
b) Primary Key
c) Composite Key
d) Foreign Key
10. ____________ is preferred method for enforcing data integrity
a) Constraints
b) Stored Procedure
c) Triggers
d) Cursors
Diagram

1. Which of the following gives a logical structure of the database graphically?


a) Entity-relationship diagram
b) Entity diagram
c) Database diagram
d) Architectural representation
2. The entity relationship set is represented in E-R diagram as
a) Double diamonds
b) Undivided rectangles
c) Dashed lines
d) Diamond
3. The Rectangles divided into two parts represents
a) Entity set
b) Relationship set
c) Attributes of a relationship set
d) Primary key
4. Consider a directed line(->) from the relationship set advisor to both entity sets instructor and
student. This indicates _________ cardinality
a) One to many
b) One to one
c) Many to many
d) Many to one
5. We indicate roles in E-R diagrams by labeling the lines that connect ___________ to __________
a) Diamond , diamond
b) Rectangle, diamond
c) Rectangle, rectangle
d) Diamond, rectangle
6. An entity set that does not have sufficient attributes to form a primary key is termed a
__________
a) Strong entity set
b) Variant set
c) Weak entity set
d) Variable set
7. For a weak entity set to be meaningful, it must be associated with another entity set, called the
a) Identifying set
b) Owner set
c) Neighbour set
d) Strong entity set
8. Weak entity set is represented as
a) Underline
b) Double line
c) Double diamond
d) Double rectangle
9. If you were collecting and storing information about your music collection, an album would be
considered a(n) _____
a) Relation
b) Entity
c) Instance
d) Attribute
10. What term is used to refer to a specific record in your music database; for instance;
information stored about a specific album?
a) Relation
b) Instance
c) Table
d) Column
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
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
3.

Check this: Computer Science Books | RDBMS MCQ


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
4.
SELECT Id, Course_id, Building FROM SECTION s AND teaches t WHERE t.year=2009;

Which of the following Id are displayed?


a) 1003
b) 1001
c) Both 1003 and 1001
d) Error message appears
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’;
d) Select Course_id from section where Sec_id = ‘3’;
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)
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 )
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’;
9. In the above teaches relation ” Select * from teaches where Year = ‘2010’” displays how many
rows?
a) 2
b) 4
c) 5
d) 1
10. The relation changes can be got back using ________ command.
a) Flashback
b) Purge
c) Delete
d) Getback

1. Let us consider phone_number ,which can take single or several values .


Treating phone_numberas an _________ permits instructors to have several phone numbers
(including zero) associated with them.
a) Entity
b) Attribute
c) Relation
d) Value
2. The total participation by entities is represented in E-R diagram as
a) Dashed line
b) Double line
c) Double rectangle
d) Circle
3. Given the basic ER and relational models, which of the following is INCORRECT?
a) An attribute of an entity can have more than one value
b) An attribute of an entity can be composite
c) In a row of a relational table, an attribute can have more than one value
d) In a row of a relational table, an attribute can have exactly one value or a NULL value
4. Which of the following indicates the maximum number of entities that can be involved in a
relationship?
a) Minimum cardinality
b) Maximum cardinality
c) ERD
d) Greater Entity Count
5. In E-R diagram generalization is represented by
a) Ellipse
b) Dashed ellipse
c) Rectangle
d) Triangle
6. What is a relationship called when it is maintained between two entities?
a) Unary
b) Binary
c) Ternary
d) Quaternary
7. Which of the following is a low level operator?
a) Insert
b) Update
c) Delete
d) Directory
8. Key to represent relationship between tables is called
a) Primary key
b) Secondary Key
c) Foreign Key
d) None of the mentioned
9. A window into a portion of a database is
a) Schema
b) View
c) Query
d) Data dictionary
10. A primary key is combined with a foreign key creates
a) Parent-Child relation ship between the tables that connect them
b) Many to many relationship between the tables that connect them
c) Network model between the tables that connect them
d) None of the mentioned

1. The entity set person is classified as student and employee. This process is called _________
a) Generalization
b) Specialization
c) Inheritance
d) Constraint generalization
2. Which relationship is used to represent a specialization entity?
a) ISA
b) AIS
c) ONIS
d) WHOIS
3. The refinement from an initial entity set into successive levels of entity subgroupings
represents a ________ design process in which distinctions are made explicit.
a) Hierarchy
b) Bottom-up
c) Top-down
d) Radical
4. There are similarities between the instructor entity set and the secretary entity set in the sense
that they have several attributes that are conceptually the same across the two entity sets:
namely, the identifier, name, and salary attributes. This process is called
a) Commonality
b) Specialization
c) Generalization
d) Similarity
5. If an entity set is a lower-level entity set in more than one ISA relationship, then the entity set
has
a) Hierarchy
b) Multilevel inheritance
c) Single inheritance
d) Multiple inheritance
6. A _____________ constraint requires that an entity belong to no more than one lower-level entity
set.
a) Disjointness
b) Uniqueness
c) Special
d) Relational
7. Consider the employee work-team example, and assume that certain employees participate in
more than one work team. A given employee may therefore appear in more than one of the team
entity sets that are lower level entity sets of employee. Thus, the generalization is _____________
a) Overlapping
b) Disjointness
c) Uniqueness
d) Relational
8. The completeness constraint may be one of the following: Total generalization or
specialization, Partial generalization or specialization. Which is the default?
a) Total
b) Partial
c) Should be specified
d) Cannot be determined
9. Functional dependencies are a generalization of
a) Key dependencies
b) Relation dependencies
c) Database dependencies
d) None of the mentioned
10. Which of the following is another name for a weak entity?
a) Child
b) Owner
c) Dominant
d) All of the mentioned

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),
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


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
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
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
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
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)
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
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
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
d) Course_id,sec_id,room_number
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);
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 ;

DML

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

ID Name Dept_name Salary

10101 Hayley Comp.Sci. 65000

12121 Jackson Finance 90000

15151 Nathan Music 87000

22222 April Biology 73000

34345 Crick Comp.Sci. 100000

The course relation

Course_id Title Dept_name Credits

CS-101 Robotics Comp.Sci. 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;
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;
3. Select distinct Dept_name from instructor ;
How many row(s) are displayed ?
a) 4
b) 3
c) 5
d) Error
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);


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
6.

SELECT DISTINCT T.name


FROM instructor AS T, instructor AS S
WHERE T.salary > S.salary AND S.dept name = ’Comp.Sci.’;

What will be displayed as the value of name for the above query?
a) Hayley
b) Jackson
c) Hayley and Crick
d) Crick
7.

SELECT Name
FROM instructor
WHERE salary > SOME (SELECT salary FROM instructor WHERE dept_name = 'Comp.Sci.');

How many rows are selected ?


a) 3
b) 4
c) 2
d) 1
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%;

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


a) Dist
b) Distinct
c) Count
d) Count,Dist
10. Which function is used to identify the title with Least scope?
a) Min(Credits)
b) Max(Credits)
c) Min(title)
d) Min(Salary)

1. A domain is ______ if elements of the domain are considered to be indivisible units.


a) Atomic
b) Subatomic
c) Substructure
d) Subset
2. Identify the composite attributes
a) Salary
b) Credits
c) Section_id
d) None of the mentioned
3. Consider the relation given below and ind the maximum normal form applicable to them

i. R(A, B) WITH productions { A --> B }


ii. R(A, B) WITH productions { B --> A }
iii. R(A, B) WITH productions {A —> B, B --> A }
iv. R(A, B, C) WITH productions {A -->B, B --> A, AB --> C }

a) i, ii and iii are in 3NF and iv is in BCNF


b) i and ii are in BCNF and iii and iv are in 3NF
c) All are in 3NF
d) All are in BCNF
4. Which one is based on multi-valued dependency:
a) First
b) Second
c) Third
d) Fourth
5. If a relation is in BCNF, then it is also in
a) 1 NF
b) 2 NF
c) 3 NF
d) All of the mentioned
6. If every non-key attribute is functionally dependent primary key, then the relation will be in
a) First normal form
b) Second normal form
c) Third form
d) Fourth normal form
7. If an attribute of a composite key is dependent on an attribute of the other composite key, a
normalization called _____ is needed.
a) DKNF
b) BCNF
c) Fourth
d) Third
8. The term for information that describes what type of data is available in a database is:
a) Data dictionary
b) data repository
c) Index data
d) Metadata
9. A data type that creates unique numbers for key columns in Microsoft Access is:
a) Autonumber
b) Boolean
c) Sequential key
d) Sequential number
10. A dependency exist between two columns when
a) Together they constitute a composite key for the table
b) Knowing the value in one column determines the value stored in another column
c) The table is in 3NF
d) Together they constitute a foreign key
Normalization

1. In the __________ normal form, a composite attribute is converted to individual attributes.


a) First
b) Second
c) Third
d) Fourth
2. A table on the many side of a one to many or many to many relationship must:
a) Be in Second Normal Form (2NF)
b) Be in Third Normal Form (3NF)
c) Have a single attribute key
d) Have a composite key
3. Tables in second normal form (2NF):
a) Eliminate all hidden dependencies
b) Eliminate the possibility of a insertion anomalies
c) Have a composite key
d) Have all non key fields depend on the whole primary key
4. Which-one ofthe following statements about normal forms is FALSE?
a) BCNF is stricter than 3 NF
b) Lossless, dependency -preserving decomposition into 3 NF is always possible
c) Loss less, dependency – preserving decomposition into BCNF is always possible
d) Any relation with two attributes is BCNF
5. Functional Dependencies are the types of constraints that are based on______
a) Key
b) Key revisited
c) Superset key
d) None of the mentioned
6. Which is a bottom-up approach to database design that design by examining the relationship
between attributes:
a) Functional dependency
b) Database modeling
c) Normalization
d) Decomposition
7. Which forms simplifies and ensures that there are minimal data aggregates and repetitive
groups:
a) 1NF
b) 2NF
c) 3NF
d) All of the mentioned
8. Which forms has a relation that possesses data about an individual entity:
a) 2NF
b) 3NF
c) 4NF
d) 5NF
9. Which forms are based on the concept of functional dependency:
a) 1NF
b) 2NF
c) 3NF
d) 4NF
10.

Empdt1(empcode, name, street, city, state, pincode).

For any pincode, there is only one city and state. Also, for given street, city and state, there is just
one pincode. In normalization terms, empdt1 is a relation in
a) 1 NF only
b) 2 NF and hence also in 1 NF
c) 3NF and hence also in 2NF and 1NF
d) BCNF and hence also in 3NF, 2NF and 1NF
1. We can use the following three rules to find logically implied functional dependencies. This
collection of rules is called
a) Axioms
b) Armstrong’s axioms
c) Armstrong
d) Closure
2. Which of the following is not Armstrong’s Axiom?
a) Reflexivity rule
b) Transitivity rule
c) Pseudotransitivity rule
d) Augmentation rule
3. The relation employee(ID,name,street,Credit,street,city,salary) is decomposed into

employee1 (ID, name)


employee2 (name, street, city, salary)

This type of decomposition is called


a) Lossless decomposition
b) Lossless-join decomposition
c) All of the mentioned
d) None of the mentioned
4. Inst_dept (ID, name, salary, dept name, building, budget) is decomposed into

instructor (ID, name, dept name, salary)


department (dept name, building, budget)

This comes under


a) Lossy-join decomposition
b) Lossy decomposition
c) Lossless-join decomposition
d) Both Lossy and Lossy-join decomposition
5. There are two functional dependencies with the same set of attributes on the left side of the
arrow:
A->BC
A->B
This can be combined as
a) A->BC
b) A->B
c) B->C
d) None of the mentioned
6. Consider a relation R(A,B,C,D,E) with the following functional dependencies:

ABC -> DE and


D -> AB

The number of superkeys of R is:


a) 2
b) 7
c) 10
d) 12
7. Suppose we wish to find the ID’s of the employees that are managed by people who are
managed by the employee with ID 123. Here are two possible queries:

I.SELECT ee.empID
FROM Emps ee, Emps ff
WHERE ee.mgrID = ff.empID AND ff.mgrID = 123;
II.SELECT empID
FROM Emps
WHERE mgrID IN
(SELECT empID FROM Emps WHERE mgrID = 123);

Which, if any, of the two queries above will correctly (in SQL2) get the desired set of employee
ID’s?
a) Both I and II
b) I only
c) II only
d) Neither I nor I
8. Suppose relation R(A,B) currently has tuples {(1,2), (1,3), (3,4)} and relation S(B,C) currently has
{(2,5), (4,6), (7,8)}. Then the number of tuples in the result of the SQL query:

<i>SELECT *
FROM R NATURAL OUTER JOIN S; </i>IS:

a) 2
b) 4
c) 6
d) None of the mentioned
9. Suppose now that R(A,B) and S(A,B) are two relations with r and s tuples, respectively (again,
not necessarily distinct). If m is the number of (not necessarily distinct) tuples in the result of the
SQL query:

R intersect S;

Then which of the following is the most restrictive, correct condition on the value of m?
a) m = min(r,s)
b) 0 <= m <= r + s
c) min(r,s) <= m <= max(r,s)
d) 0 <= m <= min(r,s)
10. Suppose relation R(A,B,C,D,E) has the following functional dependencies:

A -> B
B -> C
BC -> A
A -> D
E -> A
D -> E

Which of the following is not a key?


a) A
b) E
c) B, C
d) D
1. A relation is in ____________ if an attribute of a composite key is dependent on an attribute of
other composite key.
a) 2NF
b) 3NF
c) BCNF
d) 1NF
2. What are the desirable properties of a decomposition
a) Partition constraint
b) Dependency preservation
c) Redundancy
d) Security
3. R (A,B,C,D) is a relation. Which of the following does not have a lossless join dependency
preserving BCNF decomposition?
a) A->B, B->CD
b) A->B, B->C, C->D
c) AB->C, C->AD
d) A->BCD
4.
Class (course id, title, dept name, credits, sec id, semester, YEAR, building, room
NUMBER, capacity, TIME slot id)
The SET OF functional dependencies that we require TO hold ON class are:
course id->title, dept name, credits
building, room number->capacity
course id, sec id, semester, year->building, room NUMBER, TIME slot id
A candidate KEY FOR this schema IS {course id, sec id, semester, YEAR}

Consider the above conditions. Which of the following relation holds?


a) Course id-> title, dept name, credits
b) Title-> dept name, credits
c) Dept name-> credits
d) Cannot be determined
5. The algorithm that takes a set of dependencies and adds one schema at a time, instead of
decomposing the initial schema repeatedly is
a) BCNF algorithm
b) 2NF algorithm
c) 3NF synthesis algorithm
d) 1NF algorithm
6. The functional dependency can be tested easily on the materialized view, using the constraints
____________.
a) Primary key
b) Null
c) Unique
d) Both Null and Unique
7. Which normal form is considered adequate for normal relational database design?
a) 2NF
b) 5NF
c) 4NF
d) 3NF
8. Relation R with an associated set of functional dependencies, F, is decomposed into BCNF. The
redundancy (arising out of functional dependencies) in the resulting set of relations is
a) Zero
b) More than zero but less than that of an equivalent 3NF decomposition
c) Proportional to the size of F+
d) Indeterminate
9. A table has fields F1, F2, F3, F4, and F5, with the following functional dependencies:

F1->F3
F2->F4
(F1,F2)->F5

in terms of normalization, this table is in


a) 1NF
b) 2NF
c) 3NF
d) None of the mentioned
10. Let R(A,B,C,D,E,P,G) be a relational schema in which the following FDs are known to hold:

AB->CD
DE->P
C->E
P->C
B->G

The relation schema R is


a) in BCNF
b) in 3NF, but not in BCNF
c) in 2NF, but not in 3NF
d) not in 2NF

1. The normal form which satisfies multivalued dependencies and which is in BCNF is
a) 4 NF
b) 3 NF
c) 2 NF
d) All of the mentioned
2. Which of the following is a tuple-generating dependencies?
a) Functional dependency
b) Equality-generating dependencies
c) Multivalued dependencies
d) Non-functional dependency
3. The main task carried out in the __________ is to remove repeating attributes to separate tables.
a) First Normal Form
b) Second Normal Form
c) Third Normal Form
d) Fourth Normal Form

4. Which of the normal form is based on multivalued dependencies?


a) First
b) Second
c) Third
d) Fourth
5. Which forms has a relation that possesses data about an individual entity?
a) 2NF
b) 3NF
c) 4NF
d) 5NF
6. If a multivalued dependency holds and is not implied by the corresponding functional
dependency, it usually arises from one of the following sources.
a) A many-to-many relationship set
b) A multivalued attribute of an entity set
c) A one-to-many relationship set
d) Both A many-to-many relationship set and A multivalued attribute of an entity set
7. Which of the following has each related entity set has its own schema and there is an additional
schema for the relationship set?
a) A many-to-many relationship set
b) A multivalued attribute of an entity set
c) A one-to-many relationship set
d) None of the mentioned
8. In which of the following, a separate schema is created consisting of that attribute and the
primary key of the entity set.
a) A many-to-many relationship set
b) A multivalued attribute of an entity set
c) A one-to-many relationship set
d) None of the mentioned
9. Fifth Normal form is concerned with
a) Functional dependency
b) Multivalued dependency
c) Join dependency
d) Domain-key
10. In 2NF
a) No functional dependencies (FDs) exist
b) No multivalued dependencies (MVDs) exist
c) No partial FDs exist
d) No partial MVDs exist

Transaction

1. Consider money is transferred from (1)account-A to account-B and (2) account-B to account-A.
Which of the following form a transaction?
a) Only 1
b) Only 2
c) Both 1 and 2 individually
d) Either 1 or 2
2. A transaction is delimited by statements (or function calls) of the form __________
a) Begin transaction and end transaction
b) Start transaction and stop transaction
c) Get transaction and post transaction
d) Read transaction and write transaction
3. Identify the characteristics of transactions
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
4. Which of the following has “all-or-none” property?
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
5. The database system must take special actions to ensure that transactions operate properly
without interference from concurrently executing database statements. This property is referred
to as
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
6. The property of a transaction that persists all the crashes is
a) Atomicity
b) Durability
c) Isolation
d) All of the mentioned
7. __________ states that only valid data will be written to the database.
a) Consistency
b) Atomicity
c) Durability
d) Isolation
8. Transaction processing is associated with everything below except
a) Producing detail summary or exception reports
b) Recording a business activity
c) Confirming an action or triggering a response
d) Maintaining a data
9. The Oracle RDBMS uses the ____ statement to declare a new transaction start and its
properties.
a) BEGIN
b) SET TRANSACTION
c) BEGIN TRANSACTION
d) COMMIT
10. ____ means that the data used during the execution of a transaction cannot be used by a
second transaction until the first one is completed.
a) Consistency
b) Atomicity
c) Durability
d) Isolation

1. A transaction may not always complete its execution successfully. Such a transaction is termed
a) Aborted
b) Terminated
c) Closed
d) All of the mentioned
2. If an transaction is performed in a database and committed, the changes are taken to the
previous state of transaction by
a) Flashback
b) Rollback
c) Both Flashback and Rollback
d) Cannot be done
3. Each modification done in database transaction are first recorded into the
a) Harddrive
b) Log
c) Disk
d) Datamart
4. When the transaction finishes the final statement the transaction enters into
a) Active state
b) Committed state
c) Partially committed state
d) Abort state
5. The name of the transaction file shall be provided by the operator and the file that contains the
edited transactions ready for execution shall be called
a) Batch. Exe
b) Trans. Exe
c) Opt. Exe
d) Edit.Exe
6. Which of the following is an atomic sequence of database actions?
a) Transaction
b) Concurrency
c) Relations
d) All of the mentioned
7. If the state of the database no longer reflects a real state of the world that the database is
supposed to capture, then such a state is called
a) Consistent state
b) Parallel state
c) Atomic state
d) Inconsistent state
8. _______ means that data used during the execution of a transaction cannot be used by a second
transaction until the first one is completed.
a) Serializability
b) Atomicity
c) Isolation
d) Time stamping
9. DBMS periodically suspends all processing and synchronizes its files and journals through the
use of
a) Checkpoint facility
b) Backup facility
c) Recovery manager
d) Database change log
10. Which of the following is not a state in transaction?
a) Active
b) Terminated
c) Aborted
d) Partially committed

Indexing
1. In ordered indices the file containing the records is sequentially ordered, a ___________ is an
index whose search key also defines the sequential order of the file.
a) Clustered index
b) Structured index
c) Unstructured index
d) Nonclustered index
2. Indices whose search key specifies an order different from the sequential order of the file are
called ___________ indices.
a) Nonclustered
b) Secondary
c) All of the mentioned
d) None of the mentioned
3. An ____________ consists of a search-key value and pointers to one or more records with that
value as their search-key value.
a) Index entry
b) Index hash
c) Index cluster
d) Index map
4. In a _______ clustering index, the index record contains the search-key value and a pointer to
the first data record with that search-key value and the rest of the records will be in the
sequential pointers.
a) Dense
b) Sparse
c) Straight
d) Continuous
5. In a __________ index, an index entry appears for only some of the search-key values.
a) Dense
b) Sparse
c) Straight
d) Continuous
6. Incase the indices values are larger, index is created for these values of the index. This is called
a) Pointed index
b) Sequential index
c) Multilevel index
d) Multiple index
7. A search key containing more than one attribute is referred to as a _________ search key.
a) Simple
b) Composite
c) Compound
d) Secondary
8. In B+ tree the node which points to another node is called
a) Leaf node
b) External node
c) Final node
d) Internal node
9. Insertion of a large number of entries at a time into an index is referred to as __________ of the
index.
a) Loading
b) Bulk insertion
c) Bulk loading
d) Increase insertion
10. While inserting the record into the index, if the search-key value does not appear in the index.
a) The system adds a pointer to the new record in the index entry
b) The system places the record being inserted after the other records with the same search-key
values
c) The system inserts an index entry with the search-key value in the index at the appropriate
position
d) None of the mentioned

Query processing

1. A collection of data designed to be used by different people is called a/an


a) Organization
b) Database
c) Relationship
d) Schema
2. Which of the following is the oldest database model?
a) Relational
b) Deductive
c) Physical
d) Network
3. Which of the following schemas does define a view or views of the database for particular
users?
a) Internal schema
b) Conceptual schema
c) Physical schema
d) External schema
4. Which of the following is an attribute that can uniquely identify a row in a table?
a) Secondary key
b) Candidate key
c) Foreign key
d) Alternate key
5. Which of the following are the process of selecting the data storage and data access
characteristics of the database?
a) Logical database design
b) Physical database design
c) Testing and performance tuning
d) Evaluation and selecting
6. Which of the following terms does refer to the correctness and completeness of the data in a
database?
a) Data security
b) Data constraint
c) Data independence
d) Data integrity
7. The relationship between DEPARTMENT and EMPLOYEE is a
a) One-to-one relationship
b) One-to-many relationship
c) Many-to-many relationship
d) Many-to-one relationship
8. A table can be logically connected to another table by defining a
a) Super key
b) Candidate key
c) Primary key
d) Unique key
9. If the state of the database no longer reflects a real state of the world that the database is
supposed to capture, then such a state is called
a) Consistent state
b) Parallel state
c) Durable state
d) Inconsistent state
10. Ensuring isolation property is the responsibility of the
a) Recovery-management component of the DBMS
b) Concurrency-control component of the DBMS
c) Transaction-management component of the DBMS
d) Buffer management component in DBMS

SQL

1. Which one of the following is used to define the structure of the relation, deleting relations and
relating schemas?
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema
2. Which one of the following provides the ability to query information from the database and to
insert tuples into, delete tuples from, and modify tuples in the database?
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema
3.

CREATE TABLE employee (name VARCHAR, id INTEGER)

What type of statement is this?


a) DML
b) DDL
c) View
d) Integrity constraint
4.

SELECT * FROM employee

What type of statement is this?


a) DML
b) DDL
c) View
d) Integrity constraint
5. The basic data type char(n) is a _____ length character string and varchar(n) is _____ length
character.
a) Fixed, equal
b) Equal, variable
c) Fixed, variable
d) Variable, equal
6. An attribute A of datatype varchar(20) has the value “Avi”. The attribute B of datatype char(20)
has value ”Reed”. Here attribute A has ____ spaces and attribute B has ____ spaces.
a) 3, 20
b) 20, 4
c) 20, 20
d) 3, 4
7. To remove a relation from an SQL database, we use the ______ command.
a) Delete
b) Purge
c) Remove
d) Drop table
8.

DELETE FROM r; //r - relation

This command performs which of the following action?


a) Remove relation
b) Clear relation entries
c) Delete fields
d) Delete rows
9.

INSERT INTO instructor VALUES (10211, ’Smith’, ’Biology’, 66000);

What type of statement is this?


a) Query
b) DML
c) Relational
d) DDL
10. Updates that violate __________ are disallowed.
a) Integrity constraints
b) Transaction control
c) Authorization
d) DDL constraints

1.

Name

Annie
Bob

Callie

Derek

Which of these query will display the the table given above ?
a) Select employee from name
b) Select name
c) Select name from employee
d) Select employee
2. Here which of the following displays the unique values of the column?

SELECT ________ dept_name

FROM instructor;

a) All
b) From
c) Distinct
d) Name
3. The ______ clause allows us to select only those rows in the result relation of the ____ clause that
satisfy a specified predicate.
a) Where, from
b) From, select
c) Select, from
d) From, where
4. The query given below will not give an error. Which one of the following has to be replaced to
get the desired output?

SELECT ID, name, dept name, salary * 1.1


WHERE instructor;

a) Salary*1.1
b) ID
c) Where
d) Instructor
5. The ________ clause is used to list the attributes desired in the result of a query.
a) Where
b) Select
c) From
d) Distinct
6. This Query can be replaced by which one of the following?

SELECT name, course_id


FROM instructor, teaches
WHERE instructor_ID= teaches_ID;

a) Select name,course_id from teaches,instructor where instructor_id=course_id;


b) Select name, course_id from instructor natural join teaches;
c) Select name, course_id from instructor;
d) Select course_id from instructor join teaches;
7.

SELECT * FROM employee WHERE salary>10000 AND dept_id=101;

Which of the following fields are displayed as output?


a) Salary, dept_id
b) Employee
c) Salary
d) All the field of employee relation
8.

Employee_id Name Salary

1001 Annie 6000

1009 Ross 4500

1018 Zeith 7000

This is Employee table.


Which of the following employee_id will be displayed for the given query?

SELECT * FROM employee WHERE employee_id>1009;

a) 1009, 1001, 1018


b) 1009, 1018
c) 1001
d) 1018
9. Which of the following statements contains an error?
a) Select * from emp where empid = 10003;
b) Select empid from emp where empid = 10006;
c) Select empid from emp;
d) Select empid where empid = 1009 and lastname = ‘GELLER’;
10. In the given query which of the keyword has to be inserted?

INSERT INTO employee _____ (1002,Joey,2000);

a) Table
b) Values
c) Relation
d) Field

1.

SELECT name ____ instructor name, course id


FROM instructor, teaches
WHERE instructor.ID= teaches.ID;

Which keyword must be used here to rename the field name?


a) From
b) Rename
c) As
d) Join
2.

SELECT * FROM employee WHERE dept_name="Comp Sci";

In the SQL given above there is an error . Identify the error.


a) Dept_name
b) Employee
c) “Comp Sci”
d) From
3.

SELECT emp_name
FROM department
WHERE dept_name LIKE ’ _____ Computer Science’;

Which one of the following has to be added into the blank to select the dept_name which has
Computer Science as its ending string?
a) %
b) _
c) ||
d) $
4. ’_ _ _ ’ matches any string of ______ three characters. ’_ _ _ %’ matches any string of at ______
three characters.
a) Atleast, Exactly
b) Exactly, Atleast
c) Atleast, All
d) All, Exactly
5.

SELECT name
FROM instructor
WHERE dept name = ’Physics’
ORDER BY name;

By default, the order by clause lists items in ______ order.


a) Descending
b) Any
c) Same
d) Ascending
6.

SELECT *
FROM instructor
ORDER BY salary ____, name ___;

To display the salary from greater to smaller and name in ascending order which of the following
options should be used?
a) Ascending, Descending
b) Asc, Desc
c) Desc, Asc
d) Descending, Ascending
7.

SELECT name
FROM instructor
WHERE salary <= 100000 AND salary >= 90000;

This query can be replaced by which of the following ?


a)

SELECT name
FROM instructor
WHERE salary BETWEEN 90000 AND 100000;

b)

SELECT name
FROM employee
WHERE salary <= 90000 AND salary>=100000;

c)

SELECT name
FROM employee
WHERE salary BETWEEN 90000 AND 100000;

d)

SELECT name
FROM instructor
WHERE salary BETWEEN 100000 AND 90000;

8.

SELECT instructor.*
FROM instructor, teaches
WHERE instructor.ID= teaches.ID;

This query does which of the following operation?


a) All attributes of instructor and teaches are selected
b) All attributes of instructor are selected on the given condition
c) All attributes of teaches are selected on given condition
d) Only the some attributes from instructed and teaches are selected
9. In SQL the spaces at the end of the string are removed by _______ function.
a) Upper
b) String
c) Trim
d) Lower
10. _____ operator is used for appending two strings.
a) &
b) %
c) ||
d) _

1. The union operation is represented by


a) ∩
b) U
c) –
d) *
2. The intersection operator is used to get the _____ tuples.
a) Different
b) Common
c) All
d) Repeating
3. The union operation automatically __________ unlike the select clause.
a) Adds tuples
b) Eliminates unique tuples
c) Adds common tuples
d) Eliminates duplicate
4. If we want to retain all duplicates, we must write ________ in place of union.
a) Union all
b) Union some
c) Intersect all
d) Intersect some
5.

(SELECT course id
FROM SECTION
WHERE semester = ’Fall’ AND YEAR= 2009)
EXCEPT
(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010);

This query displays


a) Only tuples from second part
b) Only tuples from the first part which has the tuples from second part
c) Tuples from both the parts
d) Tuples from first part which do not have second part
6. For like predicate which of the following is true.

i) % matches zero OF more characters.


ii) _ matches exactly one CHARACTER.

a) i-only
b) ii-only
c) i & ii
d) None of the mentioned
7. The number of attributes in relation is called as its
a) Cardinality
b) Degree
c) Tuples
d) Entity
8. _____ clause is an additional filter that is applied to the result.
a) Select
b) Group-by
c) Having
d) Order by
9. _________ joins are SQL server default
a) Outer
b) Inner
c) Equi
d) None of the mentioned
10. The _____________ is essentially used to search for patterns in target string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate

1. A _____ indicates an absent value that may exist but be unknown or that may not exist at all.
a) Empty tuple
b) New value
c) Null value
d) Old value
2. If the attribute phone number is included in the relation all the values need not be entered into
the phone number column. This type of entry is given as
a) 0
b) –
c) Null
d) Empty space
3. The predicate in a where clause can involve Boolean operations such as and. The result of true
and unknown is_______ false and unknown is _____ while unknown and unknown is _____
a) Unknown, unknown, false
b) True, false, unknown
c) True, unknown, unknown
d) Unknown, false, unknown
4.

SELECT name
FROM instructor
WHERE salary IS NOT NULL;
Selects

a) Tuples with null value


b) Tuples with no null values
c) Tuples with any salary
d) All of the mentioned
5. In an employee table to include the attributes whose value always have some value which of
the following constraint must be used?
a) Null
b) Not null
c) Unique
d) Distinct
6. Using the ______ clause retains only one copy of such identical tuples.
a) Null
b) Unique
c) Not null
d) Distinct
7.

CREATE TABLE employee (id INTEGER,name VARCHAR(20),salary NOT NULL);


INSERT INTO employee VALUES (1005,Rach,0);
INSERT INTO employee VALUES (1007,Ross, );
INSERT INTO employee VALUES (1002,Joey,335);

Some of these insert statements will produce an error. Identify the statement.
a) Insert into employee values (1005,Rach,0);
b) Insert into employee values (1002,Joey,335);
c) Insert into employee values (1007,Ross, );
d) None of the mentioned
8. The primary key must be
a) Unique
b) Not null
c) Both Unique and Not null
d) Either Unique or Not null
9. You attempt to query the database with this command:

SELECT nvl (100 / quantity, NONE)


FROM inventory;

Why does this statement cause an error when QUANTITY values are null?
a) The expression attempts to divide by a null value
b) The data types in the conversion function are incompatible
c) The character string none should be enclosed in single quotes (‘ ‘)
d) A null value used in an expression cannot be converted to an actual value
10. The result of _____unknown is unknown.
a) Xor
b) Or
c) And
d) Not

1. Aggregate functions are functions that take a ___________ as input and return a single value.
a) Collection of values
b) Single value
c) Aggregate value
d) Both Collection of values & Single value

2.

SELECT __________
FROM instructor
WHERE dept name= ’Comp. Sci.’;

Which of the following should be used to find the mean of the salary ?
a) Mean(salary)
b) Avg(salary)
c) Sum(salary)
d) Count(salary)
3.
SELECT COUNT (____ ID)
FROM teaches
WHERE semester = ’Spring’ AND YEAR = 2010;

If we do want to eliminate duplicates, we use the keyword ______in the aggregate expression.
a) Distinct
b) Count
c) Avg
d) Primary key
4. All aggregate functions except _____ ignore null values in their input collection.
a) Count(attribute)
b) Count(*)
c) Avg
d) Sum
5. A Boolean data type that can take values true, false, and________
a) 1
b) 0
c) Null
d) Unknown
6. The ____ connective tests for set membership, where the set is a collection of values produced
by a select clause. The ____ connective tests for the absence of set membership.
a) Or, in
b) Not in, in
c) In, not in
d) In, or
7. Which of the following should be used to find all the courses taught in the Fall 2009 semester
but not in the Spring 2010 semester .
a)

SELECT DISTINCT course id


FROM SECTION
WHERE semester = ’Fall’ AND YEAR= 2009 AND
course id NOT IN (SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010);

b)

SELECT DISTINCT course_id


FROM instructor
WHERE name NOT IN (’Fall’, ’Spring’);

c)

(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)

d)

SELECT COUNT (DISTINCT ID)


FROM takes
WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id, semester, YEAR
FROM teaches
WHERE teaches.ID= 10101);
8. The phrase “greater than at least one” is represented in SQL by _____
a) < all
b) < some
c) > all
d) > some
9. Which of the following is used to find all courses taught in both the Fall 2009 semester and in
the Spring 2010 semester .
a)

SELECT course id
FROM SECTION AS S
WHERE semester = ’Fall’ AND YEAR= 2009 AND
EXISTS (SELECT *
FROM SECTION AS T
WHERE semester = ’Spring’ AND YEAR= 2010 AND
S.course id= T.course id);

b)

SELECT name
FROM instructor
WHERE salary > SOME (SELECT salary
FROM instructor
WHERE dept name = ’Biology’);

c)

SELECT COUNT (DISTINCT ID)


FROM takes
WHERE (course id, sec id, semester, YEAR) IN (SELECT course id, sec id, semester, YEAR
FROM teaches
WHERE teaches.ID= 10101);

d)

(SELECT course id
FROM SECTION
WHERE semester = ’Spring’ AND YEAR= 2010)

10. We can test for the nonexistence of tuples in a subquery by using the _____ construct.
a) Not exist
b) Not exists
c) Exists
d) Exist

1.

SELECT dept_name, ID, avg (salary)


FROM instructor
GROUP BY dept_name;
This statement IS erroneous because

a) Avg(salary) should not be selected


b) Dept_id should not be used in group by clause
c) Misplaced group by clause
d) Group by clause is not valid in this query
2. SQL applies predicates in the _______ clause after groups have been formed, so aggregate
functions may be used.
a) Group by
b) With
c) Where
d) Having
3. Aggregate functions can be used in the select list or the_______clause of a select statement or
subquery. They cannot be used in a ______ clause.
a) Where, having
b) Having, where
c) Group by, having
d) Group by, where
4. The ________ keyword is used to access attributes of preceding tables or subqueries in the from
clause.
a) In
b) Lateral
c) Having
d) With
5. Which of the following creates a temporary relation for the query on which it is defined?
a) With
b) From
c) Where
d) Select
6.

WITH max_budget (VALUE) AS


(SELECT MAX(budget)
FROM department)
SELECT budget
FROM department, max_budget
WHERE department.budget = MAX budget.value;

In the query given above which one of the following is a temporary relation?
a) Budget
b) Department
c) Value
d) Max_budget
7. Subqueries cannot:
a) Use group by or group functions
b) Retrieve data from a table different from the one in the outer query
c) Join tables
d) Appear in select, update, delete, insert statements.
8. Which of the following is not an aggregate function?
a) Avg
b) Sum
c) With
d) Min
9. The EXISTS keyword will be true if:
a) Any row in the subquery meets the condition only
b) All rows in the subquery fail the condition only
c) Both of these two conditions are met
d) Neither of these two conditions is met
10. How can you find rows that do not match some specified condition?
a) EXISTS
b) Double use of NOT EXISTS
c) NOT EXISTS
d) None of the mentioned

1. A Delete command operates on ______ relation.


a) One
b) Two
c) Several
d) Null
2.

Delete from r where P;

The above command


a) Deletes a particular tuple from the relation
b) Deletes the relation
c) Clears all entries from the relation
d) All of the mentioned
3. Which one of the following deletes all the entries but keeps the structure of the relation.
a) Delete from r where P;
b) Delete from instructor where dept name= ’Finance’;
c) Delete from instructor where salary between 13000 and 15000;
d) Delete from instructor;
4. Which of the following is used to insert a tuple from another relation?
a)

INSERT INTO course (course id, title, dept name, credits)


VALUES (’CS-437’, ’DATABASE Systems’, ’Comp. Sci.’, 4);

b)

INSERT INTO instructor


SELECT ID, name, dept name, 18000
FROM student
WHERE dept name = ’Music’ AND tot cred > 144;

c)

INSERT INTO course VALUES (’CS-437’, ’DATABASE Systems’, ’Comp. Sci.’, 4);

d) Not possible
5. Which of the following deletes all tuples in the instructor relation for those instructors
associated with a department located in the Watson building which is in department relation.
a)

DELETE FROM instructor


WHERE dept_name IN 'Watson';
b)

DELETE FROM department


WHERE building='Watson';

c)

DELETE FROM instructor


WHERE dept_name IN (SELECT dept name
FROM department
WHERE building = ’Watson’);

d) None of the mentioned


6.

UPDATE instructor
_____ salary= salary * 1.05;

Fill in with correct keyword to update the instructor relation.


a) Where
b) Set
c) In
d) Select
7. _________ are useful in SQL update statements, where they can be used in the set clause.
a) Multiple queries
b) Sub queries
c) Update
d) Scalar subqueries
8. The problem of ordering the update in multiple updates is avoided using
a) Set
b) Where
c) Case
d) When
9. Which of the following is the correct format for case statements.
a)

CASE
WHEN pred1 ... result1
WHEN pred2 ... result2
. . .
WHEN predn ... resultn
ELSE result0
END

b)

CASE
WHEN pred1 THEN result1
WHEN pred2 THEN result2
. . .
WHEN predn THEN resultn
ELSE result0
END

c)

CASE
WHEN pred1 THEN result1
WHEN pred2 THEN result2
. . .
WHEN predn THEN resultn
ELSE result0

d) All of the mentioned


10. Which of the following relation updates all instructors with salary over $100,000 receive a 3
percent raise, whereas all others receive a 5 percent raise.
a)

UPDATE instructor
SET salary = salary * 1.03
WHERE salary > 100000;
UPDATE instructor
SET salary = salary * 1.05
WHERE salary <= 100000;

b)

UPDATE instructor
SET salary = salary * 1.05
WHERE salary < (SELECT avg (salary)
FROM instructor);

c)

UPDATE instructor
SET salary = CASE
WHEN salary <= 100000 THEN salary * 1.03
ELSE salary * 1.05
END

d) None of the mentioned

1. The____condition allows a general predicate over the relations being joined.


a) On
b) Using
c) Set
d) Where
2. Which of the join operations do not preserve non matched tuples?
a) Left outer join
b) Right outer join
c) Inner join
d) Natural join
3.

SELECT *
FROM student JOIN takes USING (ID);

The above query is equivalent to


a)

SELECT *
FROM student INNER JOIN takes USING (ID);

b)
SELECT *
FROM student OUTER JOIN takes USING (ID);

c)

SELECT *
FROM student LEFT OUTER JOIN takes USING (ID);

d) None of the mentioned


4. What type of join is needed when you wish to include rows that do not have matching values?
a) Equi-join
b) Natural join
c) Outer join
d) All of the mentioned
5. How many tables may be included with a join?
a) One
b) Two
c) Three
d) All of the mentioned
6. Which are the join types in join condition:
a) Cross join
b) Natural join
c) Join with USING clause
d) All of the mentioned
7. How many join types in join condition:
a) 2
b) 3
c) 4
d) 5
8. Which join refers to join records from the right table that have no matching key in the left table
are include in the result set:
a) Left outer join
b) Right outer join
c) Full outer join
d) Half outer join
9. The operation which is not considered a basic operation of relational algebra is
a) Join
b) Selection
c) Union
d) Cross product
10. In SQL the statement select * from R, S is equivalent to
a) Select * from R natural join S
b) Select * from R cross join S
c) Select * from R union join S
d) Select * from R inner join S

1. A _________ consists of a sequence of query and/or update statements.


a) Transaction
b) Commit
c) Rollback
d) Flashback
2. Which of the following makes the transaction permanent in the database?
a) View
b) Commit
c) Rollback
d) Flashback
3. In order to undo the work of transaction after last commit which one should be used?
a) View
b) Commit
c) Rollback
d) Flashback
4. Consider the following action:

TRANSACTION.....
Commit;
ROLLBACK;

What does Rollback do?


a) Undoes the transactions before commit
b) Clears all transactions
c) Redoes the transactions before commit
d) No action
5. In case of any shut down during transaction before commit which of the following statement is
done automatically?
a) View
b) Commit
c) Rollback
d) Flashback
6. In order to maintain the consistency during transactions, database provides
a) Commit
b) Atomic
c) Flashback
d) Retain
7. Transaction processing is associated with everything below except
a) Conforming an action or triggering a response
b) Producing detail summary or exception report
c) Recording a business activity
d) Maintaining a data
8. A transaction completes its execution is said to be
a) Committed
b) Aborted
c) Rolled back
d) Failed
9. Which of the following is used to get back all the transactions back after rollback?
a) Commit
b) Rollback
c) Flashback
d) Redo
10. ______ will undo all statements up to commit?
a) Transaction
b) Flashback
c) Rollback
d) Abort

1. To include integrity constraint in an existing relation use :


a) Create table
b) Modify table
c) Alter table
d) Drop table
2. Which of the following is not an integrity constraint?
a) Not null
b) Positive
c) Unique
d) Check ‘predicate’
3.

CREATE TABLE Employee(Emp_id NUMERIC NOT NULL, Name VARCHAR(20) , dept_name


VARCHAR(20), Salary NUMERIC UNIQUE(Emp_id,Name));
INSERT INTO Employee VALUES(1002, Ross, CSE, 10000)
INSERT INTO Employee VALUES(1006,Ted,Finance, );
INSERT INTO Employee VALUES(1002,Rita,Sales,20000);

What will be the result of the query?


a) All statements executed
b) Error in create statement
c) Error in insert into Employee values(1006,Ted,Finance, );
d) Error in insert into Employee values(1008,Ross,Sales,20000);
4.

CREATE TABLE Manager(ID NUMERIC,Name VARCHAR(20),budget NUMERIC,Details VARCHAR(30));

Inorder to ensure that the value of budget is non-negative which of the following should be used?
a) Check(budget>0)
b) Check(budget<0)
c) Alter(budget>0)
d) Alter(budget<0)
5. Foreign key is the one in which the ________ of one relation is referenced in another relation.
a) Foreign key
b) Primary key
c) References
d) Check constraint
6.

CREATE TABLE course


( . . .
FOREIGN KEY (dept name) REFERENCES department
. . . );

Which of the following is used to delete the entries in the referenced table when the tuple is
deleted in course table?
a) Delete
b) Delete cascade
c) Set null
d) All of the mentioned
7. Domain constraints, functional dependency and referential integrity are special forms of
_________
a) Foreign key
b) Primary key
c) Assertion
d) Referential constraint
8. Which of the following is the right syntax for the assertion?
a) Create assertion ‘assertion-name’ check ‘predicate’;
b) Create assertion check ‘predicate’ ‘assertion-name’;
c) Create assertions ‘predicates’;
d) All of the mentioned
9. Data integrity constraints are used to:
a) Control who is allowed access to the data
b) Ensure that duplicate records are not entered into the table
c) Improve the quality of data entered for a specific property (i.e., table column)
d) Prevent users from changing the values stored in the table
10. Which of the following can be addressed by enforcing a referential integrity constraint?
a) All phone numbers must include the area code
b) Certain fields are required (such as the email address, or phone number) before the record is
accepted
c) Information on the customer must be known before anything can be sold to that customer
d) When entering an order quantity, the user must input a number and not some text (i.e., 12
rather than ‘a dozen’)

1. Dates must be specified in the format


a) mm/dd/yy
b) yyyy/mm/dd
c) dd/mm/yy
d) yy/dd/mm
2. A ________ on an attribute of a relation is a data structure that allows the database system to
find those tuples in the relation that have a specified value for that attribute efficiently, without
scanning through all the tuples of the relation.
a) Index
b) Reference
c) Assertion
d) Timestamp
3.

Create index studentID_index on student(ID);

Here which one denotes the relation for which index is created?
a) StudentID_index
b) ID
c) StudentID
d) Student
4. Which of the following is used to store movie and image files?
a) Clob
b) Blob
c) Binary
d) Image
5. The user defined data type can be created using
a) Create datatype
b) Create data
c) Create definetype
d) Create type
6. Values of one type can be converted to another domain using which of the following?
a) Cast
b) Drop type
c) Alter type
d) Convert
7.

CREATE DOMAIN YearlySalary NUMERIC(8,2)


CONSTRAINT salary VALUE test __________;

In order to ensure that an instructor’s salary domain allows only values greater than a specified
value use:
a) Value>=30000.00
b) Not null;
c) Check(value >= 29000.00);
d) Check(value)
8. Which of the following closely resembles Create view?
a) Create table . . .like
b) Create table . . . as
c) With data
d) Create view as
9. In contemporary databases, the top level of the hierarchy consists of ______ each of which can
contain _____
a) Catalogs, schemas
b) Schemas, catalogs
c) Environment, schemas
d) Schemas, Environment
10. Which of the following statements creates a new table temp instructor that has the same
schema as an instructor.
a) create table temp_instructor;
b) Create table temp_instructor like instructor;
c) Create Table as temp_instructor;
d) Create table like temp_instructor;

1. The database administrator who authorizes all the new users, modifies the database and takes
grants privilege is
a) Super user
b) Administrator
c) Operator of operating system
d) All of the mentioned
2. Which of the following is a basic form of grant statement?
a)

GRANT 'privilege list'


ON 'relation name or view name'
TO 'user/role list';

b)

GRANT 'privilege list'


ON 'user/role list'
TO 'relation name or view name';

c)

GRANT 'privilege list'


TO 'user/role list'

d)

GRANT 'privilege list'


ON 'relation name or view name'
ON 'user/role list';

3. Which of the following is used to provide privilege to only a particular attribute?


a) Grant select on employee to Amit
b) Grant update(budget) on department to Raj
c) Grant update(budget,salary,Rate) on department to Raj
d) Grant delete to Amit
4. Which of the following statement is used to remove the privilege from the user Amir?
a) Remove update on department from Amir
b) Revoke update on employee from Amir
c) Delete select on department from Raj
d) Grant update on employee from Amir
5. Which of the following is used to provide delete authorization to instructor?
a)

CREATE ROLE instructor ;


GRANT DELETE TO instructor;

b)

CREATE ROLE instructor;


GRANT SELECT ON takes
TO instructor;

c)

CREATE ROLE instructor;


GRANT DELETE ON takes
TO instructor;

d) All of the mentioned


6. Which of the following is true regarding views?
a) The user who creates a view cannot be given update authorization on a view without having
update authorization on the relations used to define the view
b) The user who creates a view cannot be given update authorization on a view without having
update authorization on the relations used to define the view
c) If a user creates a view on which no authorization can be granted, the system will allow the
view creation request
d) A user who creates a view receives all privileges on that view
7. If we wish to grant a privilege and to allow the recipient to pass the privilege on to other users,
we append the __________ clause to the appropriate grant command.
a) With grant
b) Grant user
c) Grant pass privelege
d) With grant option
8. In authorization graph, if DBA provides authorization to u1 which inturn gives to u2 which of
the following is correct?
a) If DBA revokes authorization from u1 then u2 authorization is also revoked
b) If u1 revokes authorization from u2 then u2 authorization is revoked
c) If DBA & u1 revokes authorization from u1 then u2 authorization is also revoked
d) If u2 revokes authorization then u1 authorization is revoked
9. Which of the following is used to avoid cascading of authorizations from the user?
a) Granted by current role
b) Revoke select on department from Amit, Satoshi restrict;
c) Revoke grant option for select on department from Amit;
d) Revoke select on department from Amit, Satoshi cascade;
10. The granting and revoking of roles by the user may cause some confusions when that user
role is revoked. To overcome the above situation
a) The privilege must be granted only by roles
b) The privilege is granted by roles and users
c) The user role cannot be removed once given
d) By restricting the user access to the roles

You might also like

pFad - Phonifier reborn

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

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


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy