BCA 5th Semester
1. A relational
database consists of a collection of
a) Tables
b) Fields
c) Records
d) Keys
View Answer
Answer: a
Explanation: Fields are the column of the relation or
tables.Records are each row in relation.Keys are the constraints in a relation
.
2. A ________ in a
table represents a relationship among a set of values.
a) Column
b) Key
c) Row
d) Entry
View Answer
Answer: c
Explanation: Column has only one set of values.Keys are
constraints and row is one whole set of attributes.Entry is just a piece of
data.
3. The term _______
is used to refer to a row.
a) Attribute
b) Tuple
c) Field
d) Instance
View Answer
Answer: b
Explanation: Tuple is one entry of the relation with
several attributes which are fields.
4. The term attribute
refers to a ___________ of a table.
a) Record
b) Column
c) Tuple
d) Key
View Answer
Answer: b
Explanation: Attribute is a specific domain in the
relation which has entries of all tuples.
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
View Answer
Answer: a
Explanation: The values of the attribute should be
present in the domain.Domain is a set of values permitted .
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
View Answer
Answer: d
Explanation: Instance is a instance of time and schema is
a representation.
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
View Answer
Answer: b
Explanation: The relation course has a set of attributes
course_id,sec_id,semester .
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
View Answer
Answer: c
Explanation: Here the relations are connected by the
common attributes.
9. A domain is atomic
if elements of the domain are considered to be ____________ units.
a) Different
b) Indivisbile
c) Constant
d) Divisible
View Answer
Answer: b
Explanation: None.
10. The tuples of the
relations can be of ________ order.
a) Any
b) Same
c) Sorted
d) Constant
View Answer
Answer: a
Explanation: The values only count .The order of the
tuples does not matter.
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
View Answer
Answer: c
Explanation: Super key is the superset of all the keys in
a relation.
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
View Answer
Answer: b
Explanation: Here the id is the only attribute which can
be taken as a key. Other attributes are not uniquely identified .
3. The subset of
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
View Answer
Answer: a
Explanation: The subset of a set cannot be the same
set.Candidate key is a set from a super key which cannot be the whole of the
super set
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
View Answer
Answer: b
Explanation: Key is the constraint which specifies
uniqueness.
5. Which one of the
following attribute can be taken as a primary key ?
a) Name
b) Street
c) Id
d) Department
View Answer
Answer: c
Explanation: The attributes name , street and department
can repeat for some tuples.But the id attribute has to be unique .So it forms a
primary key.
6. Which one of the
following cannot be taken as a primary key ?
a) Id
b) Register number
c) Dept_id
d) Street
View Answer
Answer: d
Explanation: Street is the only attribute which can occur
more than once.
7. A 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
View Answer
Answer: b
Explanation: The primary key has to be referred in the
other relation to form a foreign key in that relation.
8. The relation with
the attribute which is the primary key is referenced in another relation. The
relation which has the attribute as primary key is called
a) Referential
relation
b) Referencing
relation
c) Referenced
relation
d) Referred relation
View Answer
Answer: b
Explanation: None.
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
View Answer
Answer: c
Explanation: None.
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
View Answer
Answer: a
Explanation: A relation, say r1, may include among its
attributes the primary key of another relation, say r2. This attribute is
called a foreign key from r1, referencing r2. The relation r1 is also called
the referencing relation of the foreign key dependency, and r2 is called the
referenced relation of the foreign key.
1. Using which
language can a user request information from a database ?
a) Query
b) Relational
c) Structural
d) Compiler
View Answer
Answer: a
Explanation: Query language is a method through which the
database entries can be accessed.
2. Student(ID, name,
dept name, tot_cred)
In this query which
attribute form the primary key?
a) Name
b) Dept
c) Tot_cred
d) ID
View Answer
Answer: d
Explanation: The attributes name ,dept and tot_cred can
have same values unlike 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
View Answer
Answer: c
Explanation: Domain and Tuple relational calculus are
non-procedural language.Query language is a method through which the database
entries can be accessed.
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
View Answer
Answer: b
Explanation: Join finds the common tuple in the relations
and combines it.
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
View Answer
6. The
_______operation performs a set union of two “similarly structured” tables
a) Union
b) Join
c) Product
d) Intersect
View Answer
Answer: a
Explanation: Union just combines all the values of
relations of same attributes.
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
View Answer
Answer: c
Explanation: Select is used to view the tuples of the
relation with or without some constraints.
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
View Answer
Answer: b
Explanation: The union operator gives the result which is
the union of two queries and difference is the one where query which is not a
part of second query .
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
View Answer
Answer: a
Explanation: None.
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
View Answer
Answer: b
Explanation: None.
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
View Answer
Answer: b
Explanation: Data Definition language is the language
which performs all the operation in defining structure of relation.
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
View Answer
Answer: a
Explanation: DML performs change in the values of the
relation.
3. Create table
employee (name varchar ,id integer)
What type of
statement is this ?
a) DML
b) DDL
c) View
d) Integrity
constraint
View Answer
Answer: b
Explanation: Data Definition language is the language
which performs all the operation in defining structure of relation.
4. Select * from
employee
What type of
statement is this?
a) DML
b) DDL
c) View
d) Integrity
constraint
View Answer
Answer: a
Explanation: Select operation just shows the required
fields of the relation. So it forms a DML.
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
View Answer
Answer: c
Explanation: Varchar changes its length accordingly
whereas char has a specific length which has to be filled by either letters or
spaces.
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
View Answer
Answer: a
Explanation: Varchar changes its length accordingly
whereas char has a specific length which has to be filled by either letters or
spaces.
7. To remove a
relation from an SQL database, we use the ______ command.
a) Delete
b) Purge
c) Remove
d) Drop table
View Answer
Answer: d
Explanation: Drop table deletes the whole structure of
the relation .purge removes the table which cannot be obtained again.
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
View Answer
Answer: b
Explanation: Delete command removes the entries in the
table.
9. Insert into
instructor values (10211, ’Smith’, ’Biology’, 66000);
What type of
statement is this ?
a) Query
b) DML
c) Relational
d) DDL
View Answer
Answer: b
Explanation: The values are manipulated .So it is a DML.
10. Updates that
violate __________ are disallowed.
a) Integrity
constraints
b) Transaction
control
c) Authorization
d) DDL constraints
View Answer
Answer: a
Explanation: Integrity constraint has to be maintained in
the entries of the relation
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
View Answer
Answer: c
Explanation: The field to be displayed is included in
select and the table is included in the from clause.
2. Select ________
dept_name
from instructor;
Here which of the
following displays the unique values of the column ?
a) All
b) From
c) Distinct
d) Name
View Answer
Answer: c
Explanation: Distinct keyword selects only the entries
that are unique.
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
View Answer
Answer: a
Explanation: Where selects the rows on a particular
condition.From gives the relation which involves the operation.
4. Select ID, name,
dept name, salary * 1.1
where instructor;
The query given below
will not give an error. Which one of the following has to be replaced to get
the desired output?
a) Salary*1.1
b) ID
c) Where
d) Instructor
View Answer
Answer: c
Explanation: Where selects the rows on a particular
condition.From gives the relation which involves the operation. Since
Instructor is a relation it has to have from clause.
5. The ________
clause is used to list the attributes desired in the result of a query.
a) Where
b) Select
c) From
d) Distinct
View Answer
Answer: b
Explanation: None
6. Select name,
course_id
from instructor,
teaches
where instructor_ID=
teaches_ID;
This Query can be
replaced by which one of the following ?
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;
View Answer
Answer: b
Explanation: Join clause joins two tables by matching the
common column .
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
View Answer
Answer: d
Explanation: Here * is used to select all the fields of
the relation .
8.
Employee_id Name Salary
1001 Annie 6000
1009 Ross 4500
1018 Zeith 7000
This is Employee
table.
Select * from
employee where employee_id>1009;
Which of the
following employee_id will be displayed?
a) 1009, 1001, 1018
b) 1009, 1018
c) 1001
d) 1018
View Answer
Answer: d
Explanation: Greater than symbol does not include the
given value unlike >=.
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’;
View Answer
Answer: d
Explanation: This query do not have from clause which
specifies the relation from which the values has to be selected .
10. Insert into
employee _____ (1002,Joey,2000);
In the given query
which of the keyword has to be inserted ?
a) Table
b) Values
c) Relation
d) Field
View Answer
Answer: b
Explanation: Value keyword has to be used to insert the
values into the table.
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
View Answer
Answer: c
Explanation: As keyword is used to rename.
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
View Answer
Answer: c
Explanation: For any string operations single quoted(‘)
must be used to enclose.
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) $
View Answer
Answer: a
Explanation: The % character matches any substring.
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
View Answer
Answer: b
Explanation: None.
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
View Answer
Answer: d
Explanation: Specification of descending order is
essential but it not for 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
View Answer
Answer: c
Explanation: None.
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;
View Answer
Answer: a
Explanation: SQL includes a between comparison operator
to simplify where clauses that specify that a value be less than or equal to
some value and greater than or equal to some other value.
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
View Answer
Answer: b
Explanation: The asterisk symbol “ * ” can be usedin the
select clause to denote “all attributes.”
9. In SQL the spaces
at the end of the string are removed by _______ function .
a) Upper
b) String
c) Trim
d) Lower
View Answer
Answer: c
Explanation: The syntax of trim is Trim(s); where
s-string .
10. _____ operator is
used for appending two strings.
a) &
b) %
c) ||
d) _
View Answer
Answer: c
Explanation: || is the concatenation operator.
1. The union
operation is represented by
a) ∩
b) U
c) –
d) *
View Answer
Answer: b
Explanation: Union operator combines the relations.
2. The intersection
operator is used to get the _____ tuples.
a) Different
b) Common
c) All
d) Repeating
View Answer
Answer: b
Explanation: Intersection operator ignores unique tuples
and takes only common ones.
3. The union
operation automatically __________, unlike the select clause.
a) Adds tuples
b) Eliminates unique
tuples
c) Adds common tuples
d) Eliminates
duplicate
View Answer
Answer: d
Explanation: None.
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
View Answer
Answer: a
Explanation: Union all will combine all the tuples
including duplicates.
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
View Answer
Answer: d
Explanation: Except keyword is used to ignore the values.
6. For like predicate
which of the following is true.
1. A relational
database consists of a collection of
a) Tables
b) Fields
c) Records
d) Keys
View Answer
Answer: a
Explanation: Fields are the column of the relation or
tables.Records are each row in relation.Keys are the constraints in a relation
.
2. A ________ in a
table represents a relationship among a set of values.
a) Column
b) Key
c) Row
d) Entry
View Answer
Answer: c
Explanation: Column has only one set of values.Keys are
constraints and row is one whole set of attributes.Entry is just a piece of
data.
3. The term _______
is used to refer to a row.
a) Attribute
b) Tuple
c) Field
d) Instance
View Answer
Answer: b
Explanation: Tuple is one entry of the relation with
several attributes which are fields.
4. The term attribute
refers to a ___________ of a table.
a) Record
b) Column
c) Tuple
d) Key
View Answer
Answer: b
Explanation: Attribute is a specific domain in the
relation which has entries of all tuples.
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
View Answer
Answer: a
Explanation: The values of the attribute should be
present in the domain.Domain is a set of values permitted .
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
View Answer
Answer: d
Explanation: Instance is a instance of time and schema is
a representation.
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
View Answer
Answer: b
Explanation: The relation course has a set of attributes
course_id,sec_id,semester .
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
View Answer
Answer: c
Explanation: Here the relations are connected by the
common attributes.
9. A domain is atomic
if elements of the domain are considered to be ____________ units.
a) Different
b) Indivisbile
c) Constant
d) Divisible
View Answer
Answer: b
Explanation: None.
10. The tuples of the
relations can be of ________ order.
a) Any
b) Same
c) Sorted
d) Constant
View Answer
Answer: a
Explanation: The values only count .The order of the
tuples does not matter.
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
View Answer
Answer: c
Explanation: Super key is the superset of all the keys in
a relation.
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
View Answer
Answer: b
Explanation: Here the id is the only attribute which can
be taken as a key. Other attributes are not uniquely identified .
3. The subset of
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
View Answer
Answer: a
Explanation: The subset of a set cannot be the same
set.Candidate key is a set from a super key which cannot be the whole of the
super set
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
View Answer
Answer: b
Explanation: Key is the constraint which specifies
uniqueness.
5. Which one of the
following attribute can be taken as a primary key ?
a) Name
b) Street
c) Id
d) Department
View Answer
Answer: c
Explanation: The attributes name , street and department
can repeat for some tuples.But the id attribute has to be unique .So it forms a
primary key.
6. Which one of the
following cannot be taken as a primary key ?
a) Id
b) Register number
c) Dept_id
d) Street
View Answer
Answer: d
Explanation: Street is the only attribute which can occur
more than once.
7. A 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
View Answer
Answer: b
Explanation: The primary key has to be referred in the
other relation to form a foreign key in that relation.
8. The relation with
the attribute which is the primary key is referenced in another relation. The
relation which has the attribute as primary key is called
a) Referential
relation
b) Referencing
relation
c) Referenced
relation
d) Referred relation
View Answer
Answer: b
Explanation: None.
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
View Answer
Answer: c
Explanation: None.
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
View Answer
Answer: a
Explanation: A relation, say r1, may include among its
attributes the primary key of another relation, say r2. This attribute is
called a foreign key from r1, referencing r2. The relation r1 is also called
the referencing relation of the foreign key dependency, and r2 is called the
referenced relation of the foreign key.
1. Using which
language can a user request information from a database ?
a) Query
b) Relational
c) Structural
d) Compiler
View Answer
Answer: a
Explanation: Query language is a method through which the
database entries can be accessed.
2. Student(ID, name,
dept name, tot_cred)
In this query which
attribute form the primary key?
a) Name
b) Dept
c) Tot_cred
d) ID
View Answer
Answer: d
Explanation: The attributes name ,dept and tot_cred can
have same values unlike 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
View Answer
Answer: c
Explanation: Domain and Tuple relational calculus are
non-procedural language.Query language is a method through which the database
entries can be accessed.
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
View Answer
Answer: b
Explanation: Join finds the common tuple in the relations
and combines it.
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
View Answer
6. The
_______operation performs a set union of two “similarly structured” tables
a) Union
b) Join
c) Product
d) Intersect
View Answer
Answer: a
Explanation: Union just combines all the values of
relations of same attributes.
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
View Answer
Answer: c
Explanation: Select is used to view the tuples of the
relation with or without some constraints.
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
View Answer
Answer: b
Explanation: The union operator gives the result which is
the union of two queries and difference is the one where query which is not a
part of second query .
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
View Answer
Answer: a
Explanation: None.
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
View Answer
Answer: b
Explanation: None.
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
View Answer
Answer: b
Explanation: Data Definition language is the language
which performs all the operation in defining structure of relation.
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
View Answer
Answer: a
Explanation: DML performs change in the values of the
relation.
3. Create table
employee (name varchar ,id integer)
What type of
statement is this ?
a) DML
b) DDL
c) View
d) Integrity
constraint
View Answer
Answer: b
Explanation: Data Definition language is the language
which performs all the operation in defining structure of relation.
4. Select * from
employee
What type of
statement is this?
a) DML
b) DDL
c) View
d) Integrity
constraint
View Answer
Answer: a
Explanation: Select operation just shows the required
fields of the relation. So it forms a DML.
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
View Answer
Answer: c
Explanation: Varchar changes its length accordingly
whereas char has a specific length which has to be filled by either letters or
spaces.
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
View Answer
Answer: a
Explanation: Varchar changes its length accordingly
whereas char has a specific length which has to be filled by either letters or
spaces.
7. To remove a
relation from an SQL database, we use the ______ command.
a) Delete
b) Purge
c) Remove
d) Drop table
View Answer
Answer: d
Explanation: Drop table deletes the whole structure of
the relation .purge removes the table which cannot be obtained again.
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
View Answer
Answer: b
Explanation: Delete command removes the entries in the
table.
9. Insert into
instructor values (10211, ’Smith’, ’Biology’, 66000);
What type of
statement is this ?
a) Query
b) DML
c) Relational
d) DDL
View Answer
Answer: b
Explanation: The values are manipulated .So it is a DML.
10. Updates that
violate __________ are disallowed.
a) Integrity
constraints
b) Transaction
control
c) Authorization
d) DDL constraints
View Answer
Answer: a
Explanation: Integrity constraint has to be maintained in
the entries of the relation
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
View Answer
Answer: c
Explanation: The field to be displayed is included in
select and the table is included in the from clause.
2. Select ________
dept_name
from instructor;
Here which of the
following displays the unique values of the column ?
a) All
b) From
c) Distinct
d) Name
View Answer
Answer: c
Explanation: Distinct keyword selects only the entries
that are unique.
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
View Answer
Answer: a
Explanation: Where selects the rows on a particular
condition.From gives the relation which involves the operation.
4. Select ID, name,
dept name, salary * 1.1
where instructor;
The query given below
will not give an error. Which one of the following has to be replaced to get
the desired output?
a) Salary*1.1
b) ID
c) Where
d) Instructor
View Answer
Answer: c
Explanation: Where selects the rows on a particular
condition.From gives the relation which involves the operation. Since
Instructor is a relation it has to have from clause.
5. The ________
clause is used to list the attributes desired in the result of a query.
a) Where
b) Select
c) From
d) Distinct
View Answer
Answer: b
Explanation: None
6. Select name,
course_id
from instructor,
teaches
where instructor_ID=
teaches_ID;
This Query can be
replaced by which one of the following ?
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;
View Answer
Answer: b
Explanation: Join clause joins two tables by matching the
common column .
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
View Answer
Answer: d
Explanation: Here * is used to select all the fields of
the relation .
8.
Employee_id Name Salary
1001 Annie 6000
1009 Ross 4500
1018 Zeith 7000
This is Employee
table.
Select * from
employee where employee_id>1009;
Which of the
following employee_id will be displayed?
a) 1009, 1001, 1018
b) 1009, 1018
c) 1001
d) 1018
View Answer
Answer: d
Explanation: Greater than symbol does not include the
given value unlike >=.
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’;
View Answer
Answer: d
Explanation: This query do not have from clause which
specifies the relation from which the values has to be selected .
10. Insert into
employee _____ (1002,Joey,2000);
In the given query
which of the keyword has to be inserted ?
a) Table
b) Values
c) Relation
d) Field
View Answer
Answer: b
Explanation: Value keyword has to be used to insert the
values into the table.
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
View Answer
Answer: c
Explanation: As keyword is used to rename.
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
View Answer
Answer: c
Explanation: For any string operations single quoted(‘)
must be used to enclose.
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) $
View Answer
Answer: a
Explanation: The % character matches any substring.
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
View Answer
Answer: b
Explanation: None.
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
View Answer
Answer: d
Explanation: Specification of descending order is
essential but it not for 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
View Answer
Answer: c
Explanation: None.
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;
View Answer
Answer: a
Explanation: SQL includes a between comparison operator
to simplify where clauses that specify that a value be less than or equal to
some value and greater than or equal to some other value.
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
View Answer
Answer: b
Explanation: The asterisk symbol “ * ” can be usedin the
select clause to denote “all attributes.”
9. In SQL the spaces
at the end of the string are removed by _______ function .
a) Upper
b) String
c) Trim
d) Lower
View Answer
Answer: c
Explanation: The syntax of trim is Trim(s); where
s-string .
10. _____ operator is
used for appending two strings.
a) &
b) %
c) ||
d) _
View Answer
Answer: c
Explanation: || is the concatenation operator.
1. The union
operation is represented by
a) ∩
b) U
c) –
d) *
View Answer
Answer: b
Explanation: Union operator combines the relations.
2. The intersection
operator is used to get the _____ tuples.
a) Different
b) Common
c) All
d) Repeating
View Answer
Answer: b
Explanation: Intersection operator ignores unique tuples
and takes only common ones.
3. The union
operation automatically __________, unlike the select clause.
a) Adds tuples
b) Eliminates unique
tuples
c) Adds common tuples
d) Eliminates
duplicate
View Answer
Answer: d
Explanation: None.
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
View Answer
Answer: a
Explanation: Union all will combine all the tuples
including duplicates.
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
View Answer
Answer: d
Explanation: Except keyword is used to ignore the values.
i) % matches zero OF
more characters.
ii) _ matches exactly
one CHARACTER.
a) i-only
b) ii-only
c) Both of the
mentioned
d) None of the
mentioned
View Answer
Answer: a
Explanation:% is used with like and _ is used to fill in
the character.
7. The number of
attributes in relation is called as its
a) Cardinality
b) Degree
c) Tuples
d) Entity
View Answer
Answer: b
Explanation: None.
8. _____ clause is an
additional filter that is applied to the result.
a) Select
b) Group-by
c) Having
d) Order by
View Answer
Answer: c
Explanation: Having is used to provide additional
aggregate filtration to the query.
9. _________ joins
are SQL server default
a) Outer
b) Inner
c) Equi
d) None of the
mentioned
View Answer
Answer: b
Explanation: It is optional to give the inner keyword
with join as it is default .
10. The _____________
is essentially used to search for patterns in target string.
a) Like Predicate
b) Null Predicate
c) In Predicate
d) Out Predicate
View Answer
Answer: a
Explanation: Like predicate matches the string in the
given pattern.
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
View Answer
Answer: c
Explanation: None.
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
View Answer
Answer: c
Explanation: Null is used to represent absence of a
value.
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
View Answer
Answer: d
Explanation: None.
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
View Answer
Answer: b
Explanation: Not null constraint removes the tpules of
null values.
5. In a 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
View Answer
Answer: b
Explanation: Not null constraint removes the tpules of
null values.
6. Using the ______
clause retains only one copy of such identical tuples.
a) Null
b) Unique
c) Not null
d) Distinct
View Answer
Answer: d
Explanation: Unique is a constraint.
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
View Answer
Answer: c
Explanation: Not null constraint is specified which means
sone value (can include 0 also) should be given.
8. The primary key
must be
a) Unique
b) Not null
c) Both Unique and
Not null
d) Either Unique or
Not null
View Answer
Answer: c
Explanation: Primary key must satisfy unique and not null
condition for sure.
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
View Answer
Answer: a
Explanation: The expression attempts to divide by a null
value is errorneous in sql.
10. The result of
_____unknown is unknown.
a) Xor
b) Or
c) And
d) Not
View Answer
Answer: d
Explanation: Since unknown does not hold any value the
value cannot have a reverse value.
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
View Answer
Answer: a
Explanation: None.
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)
View Answer
Answer: b
Explanation: Avg() is used to find the mean of the
values.
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
View Answer
Answer: a
Explanation: Distinct keyword is used to select only
unique items from the relation.
4. All aggregate
functions except _____ ignore null values in their input collection.
a) Count(attribute)
b) Count(*)
c) Avg
d) Sum
View Answer
Answer: b
Explanation: * is used to select all values including
null.
5. A Boolean data
type that can take values true, false, and________
a) 1
b) 0
c) Null
d) Unknown
View Answer
Answer: d
Explanation: Unknown values do not take null value but it
is not known.
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
View Answer
Answer: c
Explanation: In checks if the query has the value but not
in checks if it does not have the value.
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);
View Answer
Answer: a
Explanation: None.
8. The phrase
“greater than at least one” is represented in SQL by _____
a) < all
b) < some
c) > all
d) > some
View Answer
Answer: d
Explanation:>some takes atlest one value above it .
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)
View Answer
Answer: a
Explanation: None.
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
View Answer
Answer: b
Explanation: Exists is used to check for existence of
tuples.
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
View Answer
Answer: b
Explanation: Any attribute that is not present in the
group by clause must appear only inside an aggregate function if it appears in
the select clause, otherwise the query is treated as erroneous.
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
View Answer
Answer: b
Explanation: The with clause provides away of defining a
temporary relation whose definition is available only to the query in which the
with clause occurs.
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
View Answer
Answer: b
Explanation: To include aggregate functions having clause
must be included after 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
View Answer
Answer: b
Explanation:
Eg : SELECT name, salary, avg salary
FROM instructor I1, lateral (SELECT
avg(salary) AS avg salary
FROM instructor I2
WHERE I2.dept name= I1.dept name);
Without the lateral
clause, the subquery cannot access the correlation variable
I1 from the outer
query.
5. Which of the
following creates temporary relation for the query on which it is defined ?
a) With
b) From
c) Where
d) Select
View Answer
Answer: a
Explanation: The with clause provides away of defining a
temporary relation whose definition is available only to the query in which the
with clause occurs.
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
View Answer
Answer: d
Explanation: With clause creates a temporary relation.
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.
View Answer
Answer: c
Explanation: None.
8. Which of the
following is not a aggregate function ?
a) Avg
b) Sum
c) With
d) Min
View Answer
Answer: c
Explanation: With is used to create temporary relation
and its not a aggregate function.
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
View Answer
Answer: a
Explanation: EXISTS keyword checks for existance of
condition.
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
View Answer
Answer: b
Explanation: None.
1. A Delete command
operates on ______ relation.
a) One
b) Two
c) Several
d) Null
View Answer
Answer: a
Explanation: Delete can delete from only one table at a
time.
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
View Answer
Answer: a
Explanation: Here P gives the condition for deleting
specific rows.
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;
View Answer
Answer: d
Explanation: Absence of condition deletes all rows.
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
View Answer
Answer: b
Explanation: Using select statement in insert will
include rows which are the result of the selection.
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
View Answer
Answer: c
Explanation: The query must include building=watson
condition to filter the tuples.
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
View Answer
Answer: b
Explanation: Set is used to update the particular value.
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
View Answer
Answer: d
Explanation: None.
8. The problem of
ordering the update in multiple update is avoided using
a) Set
b) Where
c) Case
d) When
View Answer
Answer: c
Explanation: The case statements can add the order of
updating tuples.
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
View Answer
Answer: b
Explanation: None.
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.05
ELSE salary * 1.03
END
d) BOTH a AND c
View Answer
Answer: d
Explanation: The order of the two update statements is
important. If we changed the order of the two statements, an instructor with a
salary just under $100,000 would receive an over 8 percent raise. SQL provides
a case construct that we can use to perform both the updates with a single
update statement, avoiding the problem with the order of updates.
1. The____condition
allows a general predicate over the relations being joined.
a) On
b) Using
c) Set
d) Where
View Answer
Answer: a
Explanation: On gives the condition for the join
expression.
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
View Answer
Answer: c
Explanation: INNER JOIN: Returns all rows when there is
at least one match in BOTH tables.
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
View Answer
Answer: a
Explanation: Join can be replaced by inner join.
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
View Answer
Answer: c
Explanation: An outer join does not require each record
in the two joined tables to have a matching record..
5. How many tables
may be included with a join?
a) One
b) Two
c) Three
d) All of the
mentioned
View Answer
Answer: d
Explanation: Join can combine multiple tables.
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
View Answer
Answer: d
Explanation: There are totally four join types in SQL.
7. How many join
types in join condition:
a) 2
b) 3
c) 4
d) 5
View Answer
Answer: d
Explanation: Types are inner join,left outer join,right
outer join,full join,cross join.
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
View Answer
Answer: b
Explanation: RIGHT OUTER JOIN: Return all rows from the
right table, and the matched rows from the left table.
9. The operation
which is not considered a basic operation of relational algebra is
a) Join
b) Selection
c) Union
d) Cross product
View Answer
Answer: a
Explanation: None.
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
View Answer
Answer: b
Explanation: None.
1. Which of the
following creates a virtual relation for storing the query ?
a) Function
b) View
c) Procedure
d) None of the
mentioned
View Answer
Answer: b
Explanation: Any such relation that is not part of the
logical model, but is made visible to a user as a virtual relation, is called a
view.
2. Which of the
following is the syntax for views where v is view name ?
a) Create view v as
“query name”;
b) Create “query
expression” as view;
c) Create view v as
“query expression”;
d) Create view “query
expression”;
View Answer
Answer: c
Explanation:<query expression> is any legal query
expression. The view name is represented by v.
3.
SELECT course_id
FROM
physics_fall_2009
WHERE building=
’Watson’;
Here the tuples are
selected from the view.Which one denotes the view.
a) Course_id
b) Watson
c) Building
d) physics_fall_2009
View Answer
Answer: c
Explanation: View names may appear in a query any place
where a relation name may appear.
4. Materialised views
make sure that
a) View definition is
kept stable
b) View definition is
kept up-to-date
c) View definition is
verified for error
d) View is deleted
after specified time
View Answer
Answer: b
Explanation: None.
5. Updating the value
of the view
a) Will affect the
relation from which it is defined
b) Will not change
the view definition
c) Will not affect
the relation from which it is defined
d) Cannot determine
View Answer
Answer: a
Explanation: None.
6. SQL view is said
to be updatable (that is, inserts, updates or deletes can be applied on the
view) if which of the following conditions are satisfied by the query defining
the view?
a) The from clause
has only one database relation
b) The query does not
have a group by or having clause
c) The select clause
contains only attribute names of the relation, and does not have any
expressions, aggregates, or distinct specification
d) All of the
mentioned
View Answer
Answer: d
Explanation: All of the conditions must be satisfied to
update the view in sql.
7. Which of the
following is used at the end of the view to reject the tuples which do not
satisfy the condition in where clause ?
a) With
b) Check
c) With check
d) All of the
mentioned
View Answer
Answer: c
Explanation: Views can be defined with a with check
option clause at the end of the view definition; then, if a tuple inserted into
the view does not satisfy the view’s where clause condition, the insertion is
rejected by the database system.
8. Consider the two
relations instructor and department
ID Name Dept_name Salary
1001 Ted Finance 10000
1002 Bob Music 20000
1003 Ron Physics 50000
Department:
Dept_name Building Budget
Biology Watson 40000
Chemistry Painter 30000
Music Taylor 50000
Which of the
following is used to create view for these relations together?
a) CREATE VIEW
instructor_info AS
SELECT ID, name,
building
FROM instructor,
department
WHERE instructor.dept
name= department.dept name;
b) CREATE VIEW instructor_info
SELECT ID, name,
building
FROM instructor,
department;
c) CREATE VIEW
instructor_info AS
SELECT ID, name,
building
FROM instructor;
d) CREATE VIEW
instructor_info AS
SELECT ID, name,
building
FROM department;
View Answer
Answer: a
Explanation: None.
9. For the view
Create view instructor_info as
SELECT ID, name, building
FROM instructor, department
WHERE instructor.dept name=
department.dept name;
If we insert tuple
into the view as insert into instructor info values (’69987’, ’White’,
’Taylor’);
What will be the
values of the other attributes in instructor and department relations?
a) Default value
b) Null
c) Error statement
d) 0
View Answer
Answer: b
Explanation: The values take null if there is no
constraint in the attribute else it is a Erroneous statement.
10.
CREATE VIEW faculty
AS
SELECT ID, name, dept name
FROM instructor;
Find the error in
this query .
a) Instructor
b) Select
c) View …as
d) None of the
mentioned
View Answer
Answer: d
Explanation: Syntax is – create view v as ;.
1. A _________
consists of a sequence of query and/or update statements.
a) Transaction
b) Commit
c) Rollback
d) Flashback
View Answer
Answer: a
Explanation: Transaction is a set of operation until commit.
2. Which of the
following makes the transaction permanent in the database ?
a) View
b) Commit
c) Rollback
d) Flashback
View Answer
Answer: b
Explanation: Commit work commits the current transaction.
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
View Answer
Answer: c
Explanation: Rollback work causes the current transaction
to be rolled back; that is, it undoes all the updates performed by the SQL
statements in the transaction.
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
View Answer
Answer: d
Explanation: Once a transaction has executed commit work,
its effects can no longer be undone by rollback work.
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
View Answer
Answer: c
Explanation: Once a transaction has executed commit work,
its effects can no longer be undone by rollback work.
6. In order to
maintain the consistency during transactions database provides
a) Commit
b) Atomic
c) Flashback
d) Retain
View Answer
Answer: b
Explanation: By atomic , either all the effects of the
transaction are reflected in the database, or none are (after rollback).
7. Transaction
processing is associated with everything below except
a) Conforming a action
or triggering a response
b) Producing detail
summary or exception report
c) Recording a
business activity
d) Maintaining a data
View Answer
Answer: a
Explanation: None.
8. A transaction
completes its execution is said to be
a) Committed
b) Aborted
c) Rolled back
d) Failed
View Answer
Answer: a
Explanation: A complete transaction always commits.
9. Which of the
following is used to get back all the transactions back after rollback ?
a) Commit
b) Rollback
c) Flashback
d) Redo
View Answer
Answer: c
Explanation: None.
10. ______ will undo
all statements up to commit?
a) Transaction
b) Flashback
c) Rollback
d) Abort
View Answer
Answer: c
Explanation: Flashback will undo all the statements and
Abort will terminate the operation.
1. To include
integrity constraint in a existing relation use :
a) Create table
b) Modify table
c) Alter table
d) Drop table
View Answer
Answer: c
Explanation: SYNTAX – alter table table-name add
constraint , where constraint can be any constraint on the relation.
2. Which of the
following is not a integrity constraint ?
a) Not null
b) Positive
c) Unique
d) Check ‘predicate’
View Answer
Answer: b
Explanation: Positive is a value and not a constraint.
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);
View Answer
Answer: d
Explanation: The not null specification prohibits the
insertion of a null value for the attribute.
The unique
specification says that no two tuples in the relation can be equal on all the
listed attributes.
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)
View Answer
Answer: a
Explanation: A common use of the check clause is to
ensure that attribute values satisfy specified conditions, in effect creating a
powerful type system.
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
View Answer
Answer: b
Explanation: The foreign-key declaration specifies that
for each course tuple, the department name specified in the tuple must exist in
the department relation.
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
View Answer
Answer: b
Explanation: The delete “cascades” to the course
relation, deletes the tuple that refers to the department that was deleted.
7. Domain
constraints, functional dependency and referential integrity are special forms
of _________
a) Foreign key
b) Primary key
c) Assertion
d) Referential
constraint
View Answer
Answer: c
Explanation: An assertion is a predicate expressing a
condition we wish the database to always satisfy.
8. Which of the
following is the right syntax for assertion?
a) Create assertion
‘assertion-name’ check ‘predicate’;
b) Create assertion
check ‘predicate’ ‘assertion-name’;
c) Create assertions
‘predicates’;
d) All of the
mentioned
View Answer
Answer: a
Explanation: None.
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
View Answer
Answer: c
Explanation: None.
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’)
View Answer
Answer: c
Explanation: The information can be referred and
obtained.
1. Dates must be
specified in the format
a) mm/dd/yy
b) yyyy/mm/dd
c) dd/mm/yy
d) yy/dd/mm
View Answer
Answer: b
Explanation: yyyy/mm/dd is the default format in sql .
2. An ________ 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
View Answer
Answer: a
Explanation: Index is the reference to the tuples in a
relation.
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
View Answer
Answer: d
Explanation: The statement creates an index named
studentID index on the attribute ID of the relation student.
4. Which of the
following is used to store movie and image files ?
a) Clob
b) Blob
c) Binary
d) Image
View Answer
Answer: b
Explanation: SQL therefore provides large-object data
types for character data (clob) and binary data (blob). The letters “lob” in
these data types stand for “Large OBject.” .
5. The user defined
data type can be created using
a) Create datatype
b) Create data
c) Create definetype
d) Create type
View Answer
Answer: d
Explanation: The create type clause can be used to define
new types.Syntax : create type Dollars as numeric(12,2) final; .
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
View Answer
Answer: a
Explanation: Example of cast :cast (department.budget to
numeric(12,2)). SQL provides drop type and alter type clauses to drop or modify
types that have been created earlier.
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)
View Answer
Answer: c
Explanation: Check(value ‘condition’) is the syntax.
8. Which of the
following closely resembles Create view ?
a) Create table . .
.like
b) Create table . . .
as
c) With data
d) Create view as
View Answer
Answer: b
Explanation: The ‘create table . . . as’ statement
closely resembles the create view statement and both are defined by using
queries.The main difference is that the contents of the table are set when the
table is created, whereas the contents of a view always reflect the current
query result.
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
View Answer
Answer: a
Explanation: None.
10. Which of the
following statements creates a new table temp instructor that has the same
schema as 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;
View Answer
Answer: b
Explanation: None.
1. The database
administrator who authorizes all the new users, modifies database and takes
grants privilege is
a) Super user
b) Administrator
c) Operator of
operating system
d) All of the mentioned
View Answer
Answer: d
Explanation: The authorizations provided by the
administrator to the user is privilege.
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';
View Answer
Answer: a
Explanation: The privilege list allows the granting of
several privileges in one command .
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
View Answer
Answer: b
Explanation: This grant statement gives user Raj update
authorization on the budget attribute of the department relation.
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
View Answer
Answer: b
Explanation: revoke on from ;
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
View Answer
Answer: c
Explanation: The role is first created and the
authorization is given on relation takes to the role.
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
View Answer
Answer: c
Explanation: A user who creates a view does not
necessarily receive 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
View Answer
Answer: d
Explanation: None.
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
View Answer
Answer: c
Explanation: A user has an authorization if and only if
there is a path from the root of the authorization graph down to the node
representing the user.
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;
View Answer
Answer: b
Explanation: The revoke statement may specify restrict in
order to prevent cascading revocation.The keyword cascade can be used instead
of restrict to indicate that revocation should 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
View Answer
Answer: a
Explanation: The current role associated with a session
can be set by executing set role role name. The specified role must have been
granted to the user, else the set role statement fails.
1. Which of the
following is used to access the database server at time of executing the
program and get the data from the server accordingly ?
a) Embedded SQL
b) Dynamic SQL
c) SQL declarations
d) SQL data analysis
View Answer
Answer: b
Explanation: Embedded SQL, the SQL statements are
identified at compile time using a preprocessor. The preprocessor submits the
SQL statements to the database system for precompilation and optimization; then
it replaces the SQL statements in the application program with appropriate code
and function calls before invoking the programming-language compiler.
2. Which of the
following header must be included in java program to establish database
connectivity using JDBC ?
a) Import java.sql.*;
b) Import
java.sql.odbc.jdbc.*;
c) Import
java.jdbc.*;
d) Import
java.sql.jdbc.*;
View Answer
Answer: a
Explanation: The Java program must import java.sql.*,
which contains the interface definitions for the functionality provided by
JDBC.
3.
DriverManager.getConnection(_______ , ______ , ______)
What are the two
parameters that are included ?
a) URL or machine
name where server runs, Password, User ID
b) URL or machine
name where server runs, User ID, Password
c) User ID, Password,
URL or machine name where server runs
d) Password, URL or
machine name where server runs, User ID
View Answer
Answer: b
Explanation: The database must be opened first in order
to perform any operations for which this get connection method is used .
4. Which of the
following invokes functions in sql ?
a) Prepared
Statements
b) Connection
statement
c) Callable
statements
d) All of the
mentioned
View Answer
Answer: c
Explanation: JDBC provides a Callable Statement interface
that allows invocation of SQL stored procedures and functions.
5. Which of the following
function is used to find the column count of the particular resultset ?
a) getMetaData()
b) Metadata()
c) getColumn()
d) get Count()
View Answer
Answer: a
Explanation: The interface ResultSet
has a method,
getMetaData(), that returns a ResultSetMetaData object that contains metadata
about the result set. ResultSetMetaData, in turn, has methods to find metadata
information, such as the number of columns in the result, the name of a
specified column, or the type of a specified column.
6. Which of the
following is a following statement is a prepared statements ?
a) Insert into
department values(?,?,?)
b) Insert into
department values(x,x,x)
c)
SQLSetConnectOption(conn, SQL AUTOCOMMIT, 0)
d) SQLTransact(conn,
SQL ROLLBACK)
View Answer
Answer: a
Explanation:? is used as a placeholder whose value can be
provided later.
7. Which of the
following is used as the embedded SQL in COBOL ?
a) EXEC SQL
<embedded SQL statement >;
b) EXEC SQL
<embedded SQL statement > END-EXEC
c) EXEC SQL
<embedded SQL statement >
d) EXEC SQL
<embedded SQL statement > END EXEC;
View Answer
Answer: b
Explanation: EXEC SQL <embedded SQL statement >; is
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
Answer: b
Explanation:
EXEC SQL
DECLARE c cursor FOR
SELECT ID, name
FROM student
WHERE tot cred >
:credit amount;
.
9. The update
statement can be executed in host language using
a) EXEC SQL UPDATE c;
b) EXEC SQL UPDATE c INTO
:si, :sn;
c) EXEC SQL
UPDATE instructor
SET salary = salary + 100
WHERE CURRENT OF c;
d) EXEC SQL UPDATE
END-SQL
View Answer
Answer: c
Explanation: The SQL can be terminated by ; to terminate
the sentence.
10. Which of the
following is used to access large objects from a database ?
a) setBlob()
b) getBlob()
c) getClob()
d) all of the
mentioned
View Answer
Answer: d
Explanation: None.
1.
Create function dept count(dept_name
varchar(20))
begin
declare d count
integer;
select count(*) into d
count
from instructor
where
instructor.dept_name= dept_name
return d count;
end
Find the error in the
the above statement .
a) Return type
missing
b) Dept_name is
mismatched
c) Reference relation
is not mentioned
d) All of the
mentioned
View Answer
Answer: a
Explanation: Return integer should be given after create
function for this particular function .
2. For the function
created in Question 1 ,which of the following is a proper select statement ?
a) SELECT dept name,
budget
FROM instructor
WHERE dept COUNT()
> 12;
b) SELECT dept name,
budget
FROM instructor
WHERE dept COUNT(dept
name) > 12;
c) SELECT dept name,
budget
WHERE dept COUNT(dept
name) > 12;
d) SELECT dept name,
budget
FROM instructor
WHERE dept
COUNT(budget) > 12;
View Answer
Answer: b
Explanation: The count of the dept_name must be checked
for the displaying from instructor relation.
3. Which of he
following is used to input the entry and give the result in a variable in a
procedure ?
a) Put and get
b) Get and put
c) Out and In
d) In and out
View Answer
Answer: d
Explanation: Create procedure dept count proc(in dept
name varchar(20), out d count integer).Here in and out refers to input and
result of procedure.
4.
Create procedure
dept_count proc(in dept name varchar(20),
out d count integer)
begin
select count(*) into
d count
from instructor
where instructor.dept
name= dept count proc.dept name
end
Which of the
following is used to call the procedure given above ?
a) Declare d_count
integer;
b) Declare d_count
integer;
call dept_count
proc(’Physics’, d_count);
c) Declare d_count
integer;
call dept_count
proc(’Physics’);
d) Declare d_count;
call dept_count
proc(’Physics’, d_count);
View Answer
Answer: b
Explanation: Here the ‘Physics’ is in variable and
d_count is out variable.
5. The format for
compound statement is
a) Begin ……. end
b) Begin atomic…….
end
c) Begin ……. repeat
d) Both Begin ……. end
and Begin atomic……. end
View Answer
Answer: d
Explanation: A compound statement is of the form begin .
. . end, and it may contain multiple SQL statements between the begin and the
end.A compound statement of the form begin atomic . . . end ensures that all
the statements contained within it are executed as a single transaction.
6.
Repeat
sequence of
statements;
__________________
end repeat
Fill in the correct
option :
a) While Condition
b) Until variable
c) Until boolean
expression
d) Until 0
View Answer
Answer: c
Explanation: None.
7. Which of the
following is the correct format for if statement ?
a) If boolean
expression
then statement or
compound statement
elseif boolean
expression
then statement or
compound statement
else statement or
compound statement
end if
b) If boolean
expression
then statement or compound
statement
elsif boolean
expression
then statement or
compound statement
else statement or
compound statement
end if
c) If boolean
expression
then statement or
compound statement
elif boolean
expression
then statement or
compound statement
else statement or
compound statement
end if
d) If boolean
expression
then statement or
compound statement
else
statement or compound
statement
else statement or
compound statement
end if
View Answer
Answer: a
Explanation: The conditional statements supported by SQL
include if-then-else statements by using this syntax.elif and elsif are not
allowed.
8. A stored procedure
in SQL is a___________
a) Block of functions
b) Group of
Transact-SQL statements compiled into a single execution plan.
c) Group of distinct
SQL statements.
d) None of the
mentioned
View Answer
Answer: b
Explanation: If it a atomic statement then the statements
are in single transaction.
9. Temporary stored
procedures are stored in _________ database.
a) Master
b) Model
c) User specific
d) Tempdb
View Answer
Answer: d
Explanation: None.
10. Declare out of
classroom seats condition
DECLARE exit handler
FOR OUT OF classroom seats
BEGIN
SEQUENCE OF
statements
END
The above statements
are used for
a) Calling procedures
b) Handling Exception
c) Handling
procedures
d) All of the
mentioned
View Answer
Answer: b
Explanation: The SQL procedural language also supports
the signaling of exception conditions, and declaring of handlers that can
handle the exception, as in this code.
1. A __________ is a special
kind of a store procedure that executes in response to certain action on the
table like insertion, deletion or updation of data.
a) Procedures
b) Triggers
c) Functions
d) None of the
mentioned
View Answer
Answer: b
Explanation: Triggers are automatically generated when a
particular operation takes place.
2. Trigger are
supported in
a) Delete
b) Update
c) Views
d) All of the
mentioned
View Answer
Answer: c
Explanation: The triggers run after an insert, update or
delete on a table. They are not supported for views.
3. The CREATE TRIGGER
statement is used to create the trigger. THE _____ clause specifies the table
name on which the trigger is to be attached. The ______ specifies that this is
an AFTER INSERT trigger.
a) for insert, on
b) On, for insert
c) For, insert
d) None of the
mentioned
View Answer
Answer: b
Explanation: The triggers run after an insert, update or
delete on a table. They are not supported for views.
4. What are the after
triggers ?
a) Triggers generated
after a particular operation
b) These triggers run
after an insert, update or delete on a table
c) These triggers run
after an insert, views, update or delete on a table
d) All of the
mentioned
View Answer
Answer: b
Explanation: AFTER TRIGGERS can be classified further
into three types as: AFTER INSERT Trigger, AFTER UPDATE Trigger. ,AFTER DELETE
Trigger.
5. The variables in
the triggers are declared using
a) –
b) @
c) /
d) /@
View Answer
Answer: b
Explanation: Example : declare @empid int; where empid is
the variable.
6. The default
extension for an Oracle SQL*Plus file is:
a) .txt
b) .pls
c) .ora
d) .sql
View Answer
Answer: d
Explanation: Example :None.
7. Which of the
following is NOT an Oracle-supported trigger?
a) BEFORE
b) DURING
c) AFTER
d) INSTEAD OF
View Answer
Answer: b
Explanation: Example :During trigger is not possible in
any database.
8. What are the
different in triggers ?
a) Define, Create
b) Drop, Comment
c) Insert, Update,
Delete
d) All of the
mentioned
View Answer
Answer: c
Explanation: Triggers are not possible for create,drop.
9. Triggers ________
enabled or disabled
a) Can be
b) Cannot be
c) Ought to be
d) Always
View Answer
Answer: a
Explanation: Triggers can be manipulated.
10. Which prefixes
are available to Oracle triggers?
a) : new only
b) : old only
c) Both :new and :
old
d) Neither :new nor :
old
View Answer
Answer: c
Explanation: None.