Database MCQ Set 1
1. Relational Algebra is a ____ query language that takes two relation as input and produces another relation as output of the query.
a) Relational
b) Structural
c) Procedural
d) Fundamental
Answer
Answer: c [Reason:] This language has fundamental and other operations which are used on relations .
2. Which of the following is a fundamental operation in relational algebra ?
a) Set intersection
b) Natural join
c) Assignment
d) None of the mentioned
Answer
Answer: d [Reason:] The fundamental operations are select, project, union, set difference, Cartesian product, and rename.
3. Which of the following is used to denote the selection operation in relational algebra ?
a) Pi (Greek)
b) Sigma (Greek)
c) Lambda (Greek)
d) Omega (Greek)
Answer
Answer: b [Reason:] The select operation selects tuples that satisfy a given predicate.
4. For select operation the ________ appear in the subscript and the _____ argument appears in the paranthesis after the sigma.
a) Predicates, relation
b) Relation, Predicates
c) Operation, Predicates
d) Relation, Operation
Answer
Answer: a [Reason:] None.
5. The _____ operation, denoted by −, allows us to find tuples that are in one relation but are not in another.
a) Union
b) Set-difference
c) Difference
d) Intersection
Answer
Answer: b [Reason:] The expression r − s produces a relation containing those tuples in r but not in s.
6. Which is a unary operation:
a) Selection operation
b) Primitive operation
c) Projection operation
d) Generalized selection
Answer
Answer: d [Reason:] Generalization Selection takes only one argument for operation.
7. Which is a join condition contains an equality operator:
a) Equijoins
b) Cartesian
c) Natural
d) Left
Answer
Answer: a [Reason:] None.
8. In precedence of set operators the expression is evaluated from
a) Left to left
b) Left to right
c) Right to left
d) From user specification
Answer
Answer: b [Reason:] The expression is evaluated from left to right according to the precedence.
9. Which of the following is not outer join ?
a) Left outer join
b) Right outer join
c) Full outer join
d) All of the mentioned
Answer
Answer: d [Reason:] The FULL OUTER JOIN keyword combines the result of both LEFT and RIGHT joins.
10. The assignment operator is denoted by
a) ->
b) <-
c) =
d) ==
Answer
Answer: b [Reason:] The result of the expression to the right of the ← is assigned to the relation variable on the left of the ←.
Database MCQ Set 2
1. A relational database consists of a collection of
a) Tables
b) Fields
c) Records
d) Keys
Answer
Answer: a [Reason:] 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
Answer
Answer: c [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: a [Reason:] 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
Answer
Answer: d [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: c [Reason:] 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
Answer
Answer: b [Reason:] None.
10. The tuples of the relations can be of ________ order.
a) Any
b) Same
c) Sorted
d) Constant
Answer
Answer: a [Reason:] The values only count .The order of the tuples does not matter.
Database MCQ Set 3
1. The remote backup site is sometimes also called the
a) Primary Site
b) Secondary Site
c) Tertiary Site
d) None of the mentioned
Answer
Answer: b [Reason:] We can achieve high availability by performing transaction processing at one site, called the primary site, and having a remote backup site where all the data from the primary site are replicated.
2. Remote backup system must be ___ with the primary site.
a) Synchronised
b) Separated
c) Connected
d) Detached but related
Answer
Answer: a [Reason:] We can achieve high availability by performing transaction processing at one site, called the primary site, and having a remote backup site where all the data from the primary site are replicated.
3. The backup is taken by
a) Erasing all previous records
b) Entering the new records
c) Sending all log records from primary site to the remote backup site
d) Sending selected records from primary site to the remote backup site
Answer
Answer: c [Reason:] We can achieve high availability by performing transaction processing at one site, called the primary site, and having a remote backup site where all the data from the primary site are replicated.
4. When the ____ the backup site takes over processing and becomes the primary.
a) Secondary fails
b) Backup recovers
c) Primary fails
d) None of the mentioned
Answer
Answer: c [Reason:] When the original primary site recovers, it can either play the role of remote backup, or take over the role of primary site again.
5. The simplest way of transferring control is for the old primary to receive ____ from the old backup site.
a) Undo logs
b) Redo Logs
c) Primary Logs
d) All of the mentioned
Answer
Answer: c [Reason:] If control must be transferred back, the old backup site can pretend to have failed, resulting in the old primary taking over.
6. The time to process the remote backup can be reduced by
a) Flags
b) Breakpoints
c) Redo points
d) Checkpoints
Answer
Answer: d [Reason:] If the log at the remote backup grows large, recovery will take a long time. The remote backup site can periodically process the redo log records that it has received and can perform a checkpoint, so that earlier parts of the log can be deleted.
7. A ___ configuration can make takeover by the backup site almost instantaneous.
a) Hot-spare
b) Remote
c) Direct
d) Spare
Answer
Answer: d [Reason:] In this configuration, the remote backup site continually processes redo log records as they arrive, applying the updates locally.
8. A transaction commits as soon as its commit log record is written to stable storage at the primary site. This is
a) One Safe
b) Two Safe
c) Two-very Safe
d) Very Safe
Answer
Answer: a [Reason:] The problem with this scheme is that the updates of a committed transaction may not have made it to the backup site, when the backup site takes over processing.
9. A transaction commits as soon as its commit log record is written to stable storage at the primary and the backup site.This is
a) One Safe
b) Two Safe
c) Two-very Safe
d) Very Safe
Answer
Answer: c [Reason:] The problem with this scheme is that transaction processing cannot proceed if either the primary or the backup site is down.
10. If only the primary is active, the transaction is allowed to commit as soon as its commit log record is written to stable storage at the primary site. This is
a) One Safe
b) Two Safe
c) Two-very Safe
d) Very Safe
Answer
Answer: b [Reason:] This scheme provides better availability than does two-very-safe,while avoiding the problem of lost transactions faced by the one-safe scheme.
Database MCQ Set 4
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
Answer
Answer: c [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: d [Reason:] 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.
4. Search algorithms that use an index are referred to as
a) Index Search
b) Linear search
c) File scan
d) Access paths
Answer
Answer: a [Reason:] Selection predicates are used to guide in the choice of the index to use in processing the query.
5. Which algorithm uses equality comparison on a key attribute with a primary index to retrieve a single record that satisfies the corresponding equality condition.
a) A2
b) A4
c) A5
d) A6
Answer
Answer: a [Reason:] A2 – primary index, equality on key.
6. The strategy can retrieve a single record if the equality condition is on a key;multiple records may be retrieved if the indexing field is not a key is
a) A2
b) A4
c) A5
d) A6
Answer
Answer: b [Reason:] A4 – Secondary index, equality.
7. The algorithm that uses a secondary ordered index to guide retrieval for comparison conditions involving <,≤,≥, or > is
a) A2
b) A4
c) A5
d) A6
Answer
Answer: d [Reason:] A6 – Secondary index, comparison.
8. The ___ algorithm scans each index for pointers to tuples that satisfy an individual condition.
a) A2
b) A4
c) A9
d) A6
Answer
Answer: c [Reason:] A9 – Conjunctive selection by intersection of identifiers.
9. If access paths are available on all the conditions of a disjunctive selection, each index is scanned for pointers to tuples that satisfy the individual condition. This is satisfied by
a) A10
b) A7
c) A9
d) A6
Answer
Answer: a [Reason:] A10 – Disjunctive selection by union of identifiers.
10. Conjunctive selection using one index. This is
a) A10
b) A7
c) A9
d) A6
Answer
Answer: b [Reason:] To reduce the cost of A7 we choose a i and one of algorithms A1 through A6 for which the combination results in the least cost for i (r ). The cost of algorithm A7 is given by the cost of the chosen algorithm.
Database MCQ Set 5
1. The union operation is represented by
a) ∩
b) U
c) –
d) *
Answer
Answer: b [Reason:] Union operator combines the relations.
2. The intersection operator is used to get the _____ tuples.
a) Different
b) Common
c) All
d) Repeating
Answer
Answer: b [Reason:] 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
Answer
Answer: d [Reason:] 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
Answer
Answer: a [Reason:] 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
Answer
Answer: d [Reason:] Except keyword is used to ignore the values.
6. For like predicate which of the following is true.
i) % matches zero OF more characters. ii) _ matches exactly one CHARACTER.
a) i-only
b) ii-only
c) Both of the mentioned
d) None of the mentioned
Answer
Answer: a [Reason:]% 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
Answer
Answer: b [Reason:] None.
8. _____ clause is an additional filter that is applied to the result.
a) Select
b) Group-by
c) Having
d) Order by
Answer
Answer: c [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: a [Reason:] Like predicate matches the string in the given pattern.