Database MCQ Set 1
1. A Delete command operates on ______ relation.
a) One
b) Two
c) Several
d) Null
Answer
Answer: a [Reason:] 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
Answer
Answer: a [Reason:] 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;
Answer
Answer: d [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: c [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: d [Reason:] None.
8. The problem of ordering the update in multiple update is avoided using
a) Set
b) Where
c) Case
d) When
Answer
Answer: c [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: d [Reason:] 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.
Database MCQ Set 2
1. In a granularity hierarchy the highest level represents the
a) Entire database
b) Area
c) File
d) Record
Answer
Answer: a [Reason:] This level is the root of the tree.
2. In a database the file is contained in ________
a) Entire database
b) Two area
c) One area
d) more than one area
Answer
Answer: c [Reason:] This level is below the root of the tree.
3. If a node is locked in an intention mode, explicit locking is done at a lower level of the tree. This is called
a) Intention lock modes
b) Explicit lock
c) Implicit lock
d) Exclusive lock
Answer
Answer: a [Reason:] There is an intention mode associated with shared mode, and there is one with exclusive mode.
4. If a node is locked in ____ explicit locking is being done at a lower level of the tree, but with only shared-mode locks.
a) Intention lock modes
b) Intention-shared-exclusive mode
c) Intention-exclusive (IX) mode
d) Intention-shared (IS) mode
Answer
Answer: a [Reason:] There is an intention mode associated with shared mode, and there is one with exclusive mode.
5. If a node is locked in ______ then explicit locking is being done at a lower level, with exclusive-mode or shared-mode locks.
a) Intention lock modes
b) Intention-shared-exclusive mode
c) Intention-exclusive (IX) mode
d) Intention-shared (IS) mode
Answer
Answer: c [Reason:] There is an intention mode associated with shared mode, and there is one with exclusive mode.
6. If a node is locked in ________ the subtree rooted by that node is locked explicitly in shared mode, and that explicit locking is being done at a lower level with exclusive-mode locks.
a) Intention lock modes
b) shared and intention-exclusive (SIX) mode
c) Intention-exclusive (IX) mode
d) Intention-shared (IS) mode
Answer
Answer: b [Reason:] There is an intention mode associated with shared mode, and there is one with exclusive mode.
7. ______ denotes the largest timestamp of any transaction that executed write(Q) successfully.
a) W-timestamp(Q)
b) R-timestamp(Q)
c) RW-timestamp(Q)
d) WR-timestamp(Q)
Answer
Answer: a [Reason:] The most common method for doing ordering transaction is to use a timestamp-ordering scheme.
8. The _______ ensures that any conflicting read and write operations are executed in timestamp order.
a) Timestamp-ordering protocol
b) Timestamp protocol
c) W-timestamp
d) R-timestamp
Answer
Answer: a [Reason:] The most common method for doing ordering transaction is to use a timestamp-ordering scheme.
9. The ____ requires that each transaction Ti executes in two or three different phases in its lifetime, depending on whether it is a read-only or an update transaction.
a) Validation protocol
b) Validation-based protocol
c) Timestamp protocol
d) Timestamp-ordering protocol
Answer
Answer: a [Reason:] A concurrency-control scheme imposes overhead of code execution and possible delay of transactions. It may be better to use an alternative scheme that imposes less overhead.
10. This validation scheme is called the ___ scheme since transactions execute optimistically, assuming they will be able to finish execution and validate at the end.
a) Validation protocol
b) Validation-based protocol
c) Timestamp protocol
d) Optimistic concurrency-control
Answer
Answer: a [Reason:] A concurrency-control scheme imposes overhead of code execution and possible delay of transactions. It may be better to use an alternative scheme that imposes less overhead.
Database MCQ Set 3
1. The most recent version of standard SQL prescribed by the American National Standards Institute is
a) SQL 2011
b) SQL 2002
c) SQL – 4
d) SQL2
Answer
Answer: a [Reason:] SQL-99 is the most recent version of standard SQL prescribed by the ANSI.
2. ANSI-standard SQL allows the use of special operators in conjunction with the WHERE clause. A special operator used to check whether an attribute value is null is
a) BETWEEN
b) IS NULL
c) LIKE
d) IN
Answer
Answer: b [Reason:] Exists is used to check whether an attribute value is null or not in conjunction with the where clause.
3. A lock that prevents the use of any tables in the database from one transaction while another transaction is being processed is called a
a) Database-level lock
b) Table-level lock
c) Page-level lock
d) Row-level lock
Answer
Answer: a [Reason:] Data base-level lock prevents the use of any tables in the data base from one transaction while other transaction is being processed.
4. A condition that occurs when two transactions wait for each other to unlock data is known as a(n)
a) Shared lock
b) Exclusive lock
c) Binary lock
d) Deadlock
Answer
Answer: a [Reason:] Deadlock occurs when two transactions wait for each other to unlock data.
5. _______ means that data used during the execution of a transaction cannot be used by a second transaction until the first one is completed.
a) Serializability
b) Atomicity
c) Isolation
d) Time stamping
Answer
Answer: c [Reason:] Isolation means that data used during the execution of a transaction can’t be used by a second transaction until the first one is completed..
6. A unit of storage that can store one or more records in a hash file organization is denoted as
a) Buckets
b) Disk pages
c) Blocks
d) Nodes
Answer
Answer: a [Reason:] Buckets are used to store one or more records in a hash file organization.
7. The file organization which allows us to read records that would satisfy the join condition by using one block read is
a) Heap file organization
b) Sequential file organization
c) Clustering file organization
d) Hash files organization
Answer
Answer: c [Reason:] Clustering file organization allows us to read records that would satisfy the join condition by using one block read.
8. Which of the following is not true about B+ trees?
a) B+ tree index takes the form of balanced tree
b) Performance of B+ tree degrades as the file grows
c) Look-up in B+ tree is straightforward and efficient
d) Insertion and deletion in B+ tree is complicated but efficient
Answer
Answer: b [Reason:] The answer is evident .
9. The extent of the database resource that is included with each lock is called the level of
a) Impact
b) Granularity
c) Management
d) DBMS control
Answer
Answer: b [Reason:] The extent of the data base resource that is included with each lock is called the level of Granularity.
10. DBMS periodically suspends all processing and synchronizes its files and journals through the use of
a) Checkpoint facility
b) Backup facility
c) Recovery manager
d) Database change log
Answer
Answer: a [Reason:] DBMS periodically suspends all processing and synchronizes its files and journals though the use of Check point facility.
Database MCQ Set 4
1. The silicon chips used for data processing are called
a) RAM chips
b) ROM chips
c) Micro processors
d) PROM chips
Answer
Answer: d [Reason:] PROM is Programmable Read Only Memory.
2. Which of the following is used for manufacturing chips?
a) Control bus
b) Control unit
c) Parity unit
d) Semiconductor
Answer
Answer: d [Reason:] A semiconductor is a material which has electrical conductivity between that of a conductor such as copper and that of an insulator such as glass.
3. What was the name of the first commercially available microprocessor chip?
a) Intel 308
b) Intel 33
c) Intel 4004
d) Motorola 639
Answer
Answer: c [Reason:] The Intel 4004 is a 4-bit central processing unit (CPU) released by Intel Corporation in 1971
4. The magnetic storage chip used to provide non-volatile direct access storage of data and that have no moving parts are known as
a) Magnetic core memory
b) Magnetic tape memory
c) Magnetic disk memory
d) Magnetic bubble memory
Answer
Answer: d [Reason:] Bubble domain visualization by using CMOS-MagView.
5. The ALU of a computer normally contains a number of high speed storage element called
a) Semiconductor memory
b) Registers
c) Hard disks
d) Magnetic disk
Answer
Answer: b [Reason:] External control unit tells the ALU what operation to perform on that data, and then the ALU stores its result into an output register.
6. Which of the following is used only for data entry and storage, and never for processing?
a) Mouse
b) Dumb terminal
c) Micro computer
d) Dedicated data entry system
Answer
Answer: b [Reason:] Dumb terminals are those that can interpret a limited number of control codes.
7. Non-volatile storage needs to have a ___ where the loses in future can be recovered.
a) Dump
b) Recover place
c) Disk
d) Redo plan
Answer
Answer: a [Reason:] The basic scheme is to dump the entire contents of the database to stable storage periodically—say, once per day.
8. A dump of the database contents is also referred to as an _______ dump.
a) Archival
b) Fuzzy
c) SQL
d) All of the mentioned
Answer
Answer: a [Reason:] We can archive the dumps and use them later to examine old states of the database.
9. ________ dump, writes out SQL DDL statements and SQL insert statements to a file, which can then be reexecuted to re-create the database.
a) Archival
b) Fuzzy
c) SQL
d) All of the mentioned
Answer
Answer: c [Reason:] Such dumps are useful when migrating data to a different instance of the database, or to a different version of the database software, since the physical locations and layout may be different in the other database instance or database software version.
10. ___ dump schemes have been developed that allow transactions to be active while the dump is in progress.
a) Archival
b) Fuzzy
c) SQL
d) All of the mentioned
Answer
Answer: b [Reason:] The simple dump procedure described here is costly and so fuzzy dump is used.
Database MCQ Set 5
1. In the ____ normal form, a composite attribute is converted to individual attributes.
A) First
B) Second
C) Third
D) Fourth
Answer
Answer: a [Reason:] The first normal form is used to eliminate the duplicate information.
2. A table on the many side of a one to many or many to many relationship must:
a) Be in Second Normal Form (2NF)
b) Be in Third Normal Form (3NF)
c) Have a single attribute key
d) Have a composite key
Answer
Answer: d [Reason:] The relation in second normal form is also in first normal form and no partial dependencies on any column in primary key.
3. Tables in second normal form (2NF):
a) Eliminate all hidden dependencies
b) Eliminate the possibility of a insertion anomalies
c) Have a composite key
d) Have all non key fields depend on the whole primary key
Answer
Answer: a [Reason:] The relation in second normal form is also in first normal form and no partial dependencies on any column in primary key.
4. Which-one ofthe following statements about normal forms is FALSE?
a) BCNF is stricter than 3 NF
b) Lossless, dependency -preserving decomposition into 3 NF is always possible
c) Loss less, dependency – preserving decomposition into BCNF is always possible
d) Any relation with two attributes is BCNF
Answer
Answer: c [Reason:] We say that the decomposition is a lossless decomposition if there is no loss of information by replacing r (R) with two relation schemas r1(R1) andr2(R2).
5. Functional Dependencies are the types of constraints that are based on______
a) Key
b) Key revisited
c) Superset key
d) None of the mentioned
Answer
Answer: a [Reason:] Key is the basic element needed for the constraints.
6. Which is a bottom-up approach to database design that design by examining the relationship between attributes:
a) Functional dependency
b) Database modeling
c) Normalization
d) Decomposition
Answer
Answer: c [Reason:] Normalisation is the process of removing redundancy and unwanted data.
7. Which forms simplifies and ensures that there is minimal data aggregates and repetitive groups:
a) 1NF
b) 2NF
c) 3NF
d) All of the mentioned
Answer
Answer: c [Reason:] The first normal form is used to eliminate the duplicate information.
8. Which forms has a relation that possesses data about an individual entity:
a) 2NF
b) 3NF
c) 4NF
d) 5NF
Answer
Answer: c [Reason:] A Table is in 4NF if and only if, for every one of its non-trivial multivalued dependencies X twoheadrightarrow Y, X is a superkey—that is, X is either a candidate key or a superset thereof.
9. Which forms are based on the concept of functional dependency:
a) 1NF
b) 2NF
c) 3NF
d) 4NF
Answer
Answer: c [Reason:] The table is in 3NF if every non-prime attribute of R is non-transitively dependent (i.e. directly dependent) on every superkey of R.
10. Empdt1(empcode, name, street, city, state,pincode).
For any pincode, there is only one city and state. Also, for given street, city and state, there is just one pincode. In normalization terms, empdt1 is a relation in
a) 1 NF only
b) 2 NF and hence also in 1 NF
c) 3NF and hence also in 2NF and 1NF
d) BCNF and hence also in 3NF, 2NF and 1NF
Answer
Answer: b [Reason:] The relation in second normal form is also in first normal form and no partial dependencies on any column in primary key.