SQL Tough

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 9

In which of the following formats data is stored in the database management system?

a) Image
b) Text
c) Table
d) Graph

Which of the following is a feature of the database?


a) No-backup for the data stored
b) User interface provided
c) Lack of Authentication
d) Store data in multiple locations

Which of the following is not a function of the database?


a) Managing stored data
b) Manipulating data
c) Security for stored data
d) Analysing code

______________ is a set of one or more attributes taken collectively to uniquely


identify a record.
a) Primary Key
b) Foreign key
c) Super key
d) Candidate key

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

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 //

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

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

User
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
View Answer

Answer: c
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

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

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

Updates that violate __________ are disallowed.


a) Integrity constraints
b) Transaction control
c) Authorization
d) DDL constraints
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

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

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

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

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

8. The problem of ordering the update in multiple updates is avoided using


a) Set
b) Where
c) Case
d) When

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

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

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

8. Which of the following closely resembles Create view?


a) Create table . . .like
b) Create table . . . as
c) With data
d) Create view as

5. The user defined data type can be created using


a) Create datatype
b) Create data
c) Create definetype
d) Create type

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

https://www.sanfoundry.com/database-mcqs-authorizations/

4. Which of the following invokes functions in sql?


a) Prepared Statements
b) Connection statement
c) Callable statements
d) All of the mentioned

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

5. Which of the following function is used to find the column count of the
particular resultset?
a) getMetaData().getColCount()
b) Metadata()
c) getColumn()
d) get Count()

6.The format for compound statement is


a) Begin ……. end
b) Begin atomic……. end
c) Begin ……. repeat
d) Both Begin ……. end and Begin atomic……. end

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

10. The command ________________ such tables are available only within the
transaction executing the query and are dropped when the transaction finishes.
a) Create table
b) Create temporary table
c) Create view
d) Create label view
9. The functions which construct histograms and use buckets for ranking is
a) Rank()
b) Newtil()
c) Ntil()
d) None of the mentioned

1. Any recursive view must be defined as the union of two subqueries: a _______
query that is nonrecursive and a __________ query.
a) Base, recursive
b) Recursive, Base
c) Base, Redundant
d) View, Base
View Answer

Answer: a

17.
If attributes A and B determine attribute C, then it is also true that:
A → C.
B → C.
(A,B) is a composite determinant.
C is a determinant.

4.
When assessing the table structure of an acquired set of tables with data,
accessing the validity of possible referential integrity constraints on foreign
keys is (part of) the:
first step.
second step.
third step.
fourth step.

14.
When assessing the table structure of an acquired set of tables with data, counting
the number of table rows is (part of) the:
first step.
second step.
third step.
fourth step.

6.
When assessing the table structure of an acquired set of tables with data,
determining foreign keys is (part of) the:
first step.
second step.
third step.
fourth step.

If a table has been normalized so that all determinants are candidate keys, then
that table is in:
1NF.
2NF.
3NF.
BCNF.
20.
The benefits of a standard relational language include which of the following?
Reduced training costs
Increased dependence on a single vendor
Applications are not needed.
All of the above.

23.
When three or more AND and OR conditions are combined, it is easier to use the SQL
keyword(s):
LIKE only.
IN only.
NOT IN only.
Both IN and NOT IN.

32.
A subquery in an SQL SELECT statement:
can only be used with two tables.
can always be duplicated by a join.
has a distinct form that cannot be duplicated by a join.
cannot have its results sorted using ORDER BY.

5. Which of these methods can be used to convert all characters in a String into a
character array?
a) charAt()
b) both getChars() & charAt()
c) both toCharArray() & getChars()
d) all of the mentioned
Answer: c

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
View Answer

Answer: d
Explanation: For a many-to-many relationship set each related entity set has its
own schema and there is an additional schema for the relationship set.
For a multivalued attribute, a separate schema is created consisting of that
attribute and the primary key of the 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
View Answer

Answer: a
Explanation: If a multivalued dependency holds and is not implied by the
corresponding functional dependency, it usually arises from this source.
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
View Answer

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

5. Suppose the user finds the usage of room number and phone number in a relational
schema there is confusion.This is reduced by
a) Unique-role assumption
b) Unique-key assignment
c) Role intergral assignment
d) None of the mentioned
View Answer

Answer: a

2. 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
View Answer

Answer: d
Explanation: For a many-to-many relationship set each related entity set has its
own schema and there is an additional schema for the relationship set. For a
multivalued attribute, a separate schema is created consisting of that attribute
and the primary key of the entity set.
3. 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) All of the mentioned
View Answer

Answer: a
Explanation: If a multivalued dependency holds and is not implied by the
corresponding functional dependency, it usually arises from this source.
advertisement
4. 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) All of the mentioned

1. In query processing, the ___________ is the lowest-level operator to access


data.
a) Index Search
b) Linear search
c) File scan
d) Access paths
View Answer

Answer: c
Explanation: File scans are search algorithms that locate and retrieve records that
fulfill a selection condition.
2. In a ____________ the system scans each file block and tests all records to see
whether they satisfy the selection condition.
a) Index Search
b) Linear search
c) File scan
d) Access paths
View Answer

Answer: b
Explanation: An initial seek is required to access the first block of the file.
3. Index structures are referred to as __________ since they provide a path through
which data can be located and accessed.
a) Index Search
b) Linear search
c) File scan
d) Access paths
View Answer

Answer: d
Explanation: A primary index is an index that allows the records of a file to be
read in an order that corresponds to the physical order in the file.
advertisement
4. Search algorithms that use an index are referred to as
a) Index Search
b) Linear search
c) File scan
d) Access paths
View Answer

Answer: a
Explanation: Selection predicates are used to guide in the choice of the index to
use in processing the query.

9. Which operation are allowed in a join view:


a) UPDATE
b) INSERT
c) DELETE
d) All of the mentioned

You might also like