Database MCQ Set 1
1. Consider the following relational schemes for a library database:
Book (Title, Author, Catalog_no, Publisher, YEAR, Price) Collection (Title, Author, Catalog_no) WITH the following functional dependencies: I. Title Author -> Catalog_no II. Catalog_no -> Title Author Publisher YEAR III. Publisher Title YEAR -> Price
Assume {Author, Title} is the key for both schemes. Which of the following statements is true?
a) Both Book and Collection are in BCNF
b) Both Book and Collection are in 3NF only
c) Book is in 2NF and Collection is in 3NF
d) Both Book and Collection are in 2NF only
Answer
Answer: c [Reason:] The relation Collection is in BCNF: Its given that {Author, Title} is the key and there is only one functional dependency (FD) applicable to the relation Collection {i.e. Title Author –> Catalog_no}.
2. Let R(A,B,C,D,E,P,G) be a relational schema in which the following FDs are known to hold:
AB->CD DE->P C->E P->C B->G
The relation schema R is
a) in BCNF
b) in 3NF, but not in BCNF
c) in 2NF, but not in 3NF
d) not in 2NF
Answer
Answer: d [Reason:] From the closure set of attributes we can see that the key for the relation is AB. The FD B->G is a partial dependency, hence it is not in 2NF.
3. Which of the following is/are false for RAW mode of FOR XML?
a) XMLSCHEMA option does not returns an in-line XSD schema
b) BINARY BASE32 returns the binary data in base32-encoded format
c) Each row in the query result is transformed into an XML element
d) None of the mentioned
Answer
Answer: b [Reason:] XML was designed to transport and store data.
4. _____ refers to the ability of the system to recover committed transaction updates if either the system or the storage media fails.
a) Isolation
b) Atomicity
c) Consistency
d) Durability
Answer
Answer: d [Reason:] In database systems, durability is the ACID property which guarantees that transactions that have committed will survive permanently.
5. Which utilities can we used to export data from sql server to a text file?
a) DTS export wizard
b) BCP
c) ISQL
d) DTS export wizard and BCP
Answer
Answer: d [Reason:] The bcp utility bulk copies data between an instance of Microsoft SQL Server and a data file in a user-specified format.
6. You have a column that will only contain values from 0 to 256. What is the most economical data type to use for the column?
a) TINYINT
b) SMALLINT
c) INT
d) DECIMAL(1)
Answer
Answer: b [Reason:] The bcp utility bulk copies data between an instance of Microsoft SQL Server and a data file in a user-specified format.
7. Problems occurs if we don’t implement proper locking strategy
a) Dirty reads
b) Phantom reads
c) Lost updates
d) Unrepeatable reads
Answer
Answer: b [Reason:] Phantom reads occur when an insert or delete action is performed against a row that belongs to a range of rows being read by a transaction.
8. Which of the following fixed database roles can add or remove user IDs?
a) db_accessadmin
b) db_securityadmin
c) db_setupadmin
d) db_sysadmin
Answer
Answer: a [Reason:] The db_accessadmin role manages security, but handles access to the database, as the name implies.
9. By default sql server has _____ isolation level
a) READ COMMITTED
b) READ UNCOMMITTED
c) SERIALIZABLE
d) REPEATABLE READ
Answer
Answer: a [Reason:] READ UNCOMMITTED is the most optimistic concurrency isolation option available in SQL Server.
10. Which of the following pair of regular expression are not equivalent?
a) 1(01)* and (10)*1
b) x(xx)* and (xx)*x
c) (ab)* and a*b*
d) x+ and x*x+
Answer
Answer: c [Reason:] (ab)*=(a*b*)*.
Database MCQ Set 2
1. Which s essential a business problem not a data problem:
a) Data
b) Database
c) Database design
d) All of the mentioned
Answer
Answer: c [Reason:] SQL-99 is the most recent version of standard SQL prescribed by the ANSI.
2. Which is primarily the result of a thorough understanding of information about an enterprise:
a) Data
b) Database
c) Database design
d) Data modeling
Answer
Answer: d [Reason:] Data modelling designs the data in a secured manner.
3. McFadden has defined normalization in his which book_____
a) Database modern management
b) Management database of modern
c) Modern database management
d) Database management
Answer
Answer: c [Reason:] SQL-99 is the most recent version of standard SQL prescribed by the ANSI.
4. The database design prevents some data from being represented due to _______
a) Deletion anomalies
b) Insertion anomalies
c) Update anomaly
d) None of the mentioned
Answer
Answer: b [Reason:] Insertion anomaly is due to confusion in data deletion or insertion.
5. How many types of insertion anomalies:
a) 1
b) 2
c) 3
d) 4
Answer
Answer: b [Reason:] Insertion anomaly is due to confusion in data deletion or insertion.
6. Who developed the normalization process:
a) E.F. codd
b) F.F. codd
c) E.E. codd
d) None of the mentioned
Answer
Answer: a [Reason:] Normalization helps in improving the quality of the data.
7. E.F.Codd developed the normalization process in the which early:
a) 1969
b) 1970
c) 1971
d) 1972
Answer
Answer: b [Reason:] Normalization helps in improving the quality of the data.
8. 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:] Normalization helps in improving the quality of the data.
9. Which is the process of breaking a relation into multiple relations:
a) Functional dependency
b) Database modeling
c) Normalization
d) Decomposition
Answer
Answer: d [Reason:] SQL-99 is the most recent version of standard SQL prescribed by the ANSI.
10. Which formal method that locates and analyses relation schemas on the basis of their primary, candidate keys, and the FD’s that are present among the attributes of these schemas:
a) Functional dependency
b) Database modeling
c) Normalization
d) Decomposition
Answer
Answer: c [Reason:] Normalization helps in improving the quality of the data.
Database MCQ Set 3
ID | Name | Dept_name | Salary |
10101 | Hayley | Comp.Sci. | 65000 |
12121 | Jackson | Finance | 90000 |
15151 | Nathan | Music | 87000 |
22222 | April | Biology | 73000 |
34345 | Crick | Comp.Sci. | 100000 |
Course_id | Title | Dept_name | Credits |
CS-101 | Robotics | Comp.Sci. | 5 |
BIO-244 | Genetics | Biology | 4 |
PHY-333 | Physical Principles | Physics | 3 |
MUS-562 | Music Video Production | Music | 2 |
FIN-101 | Investment Banking | Finance | 3 |
Answer the questions based on the above relations
1. Which of the following command is used to display the departments of the instructor relation ?
a) Select * from instructor where Dept_name = Finance;
b) Select * from instructor ;
c) Select dept_name from instructor;
d) Select dept_name for instructor where Name=Jackson;
Answer
Answer: c [Reason:] Only one field is necessary for the query and where clause is not needed for the selection.
2. How can we select the elements which have common Dept_name in both the relation ?
a) Select * from instructor i , course c where i.Dept_name=c.Dept_name;
b) Select Dept name from instructor ,Course ;
c) Select * from instructor i , course c ;
d) Select Dept_name from instructor where Dept_name = NULL;
Answer
Answer: a [Reason:] Here only the common elements are displayed .
3. Select distinct Dept_name from instructor ;
How many row(s) are displayed ?
a) 4
b) 3
c) 5
d) Error
Answer
Answer: a [Reason:] Distinct keyword eliminates the the common Dept_name .
4. Suppose the Authority want to include a new instructor for the title Neuroscience what command should be inserted ?
a) Insert into instructor values(12111,Emma,NeuroScience,200000);
b) Insert into course values(12111,Introduction,NeuroScience,2);
c) Insert into instructor values(12111,Emma,Biology,200000);
Insert into course values(BIO-112,Introduction to Neuro Science,NeuroScience,2);
d) Insert into course values(12111,Emma,NeuroScience,200000);
Answer
Answer: c [Reason:] The values have to be inserted into both the relations to be intact .
5. If a person all the people in Music department gets fired which of the following has to be performed on the instructor relation ?
a) Delete Dept_name=Music in instructor;
b) Delete from instructor where Dept_name=Music;
c) Remove Dept_name= Music
d) All of the mentioned
Answer
Answer: b [Reason:] Delete from table_name where condition .
6.
SELECT DISTINCT T.name FROM instructor AS T, instructor AS S WHERE T.salary > S.salary AND S.dept name = ’Comp.Sci.’;
What will be displayed as the value of name for the above query ?
a) Hayley
b) Jackson
c) Hayley and Crick
d) Crick
Answer
Answer: d [Reason:] Only the greatest salary in Comp.Sci dept is selected for the query.
7.
SELECT Name FROM instructor WHERE salary > SOME (SELECT salary FROM instructor WHERE dept_name = 'Comp.Sci.');
How many rows are selected ?
a) 3
b) 4
c) 2
d) 1
Answer
Answer: d [Reason:] This displays the names of instructors with salary greater than that of some (at least one) instructor in the Biology department .
8. How will you select the Names whose first letter is E ?
a) SELECT Name FROM instructor WHERE Name LIKE ’A%; b) SELECT Name FROM course WHERE Name LIKE ’A%; c) SELECT Dept_name FROM instructor WHERE Name LIKE ’A%; d) SELECT Name FROM instructor WHERE Dept_name LIKE ’A%;
Answer
Answer: a [Reason:] % is used to indicate that some characters may appear .
9. Which function is used to find the count of distinct departments?
a) Dist
b) Distinct
c) Count
d) Count,Dist
Answer
Answer: a [Reason:] Count (distinct ID) is the correct usage .
10. Which function is used to identify the title with Least scope ?
a) Min(Credits)
b) Max(Credits)
c) Min(title)
d) Min(Salary)
Answer
Answer: a [Reason:] Max is used to find the highest element and Min is used to find the lowest element .
Database MCQ Set 4
1. Using which language can a user request information from a database ?
a) Query
b) Relational
c) Structural
d) Compiler
Answer
Answer: a [Reason:] 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
Answer
Answer: d [Reason:] 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
Answer
Answer: c [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: b [Reason:] Cartesian product is the multiplication of all the values in the attributes.
6. The _______operation performs a set union of two “similarly structured” tables
a) Union
b) Join
c) Product
d) Intersect
Answer
Answer: a [Reason:] 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
Answer
Answer: c [Reason:] 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
Answer
Answer: b [Reason:] 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
Answer
Answer: a [Reason:] 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
Answer
Answer: b [Reason:] None.
Database MCQ Set 5
1. The normal form which satisfies multivalued dependencies and which is in BCNF is
a) 4 NF
b) 3 NF
c) 2 NF
d) All of the mentioned
Answer
Answer: a [Reason:] Fourth normal form is more restrictive than BCNF.
2. Which of the following is a tuple-generating dependencies ?
a) Functional dependency
b) Equality-generating dependencies
c) Multivalued dependencies
d) Non-functional dependency
Answer
Answer: c [Reason:] Multivalued dependencies, do not rule out the existence of certain tuples. Instead, they require that other tuples of a certain form be present in the relation.
3. The main task carried out in the ____ is to remove repeating attributes to separate tables.
a) First Normal Form
b) Second Normal Form
c) Third Normal Form
d) Fourth Normal Form
Answer
Answer: a [Reason:] Multivalued dependencies, do not rule out the existence of certain tuples. Instead, they require that other tuples of a certain form be present in the relation.
4. Which of the normal form is based on multivalued dependencies ?
a) First
b) Second
c) Third
d) Fourth
Answer
Answer: d [Reason:] Multivalued dependencies, do not rule out the existence of certain tuples. Instead, they require that other tuples of a certain form be present in the relation.
5. 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.
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
Answer
Answer: d [Reason:] 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
Answer
Answer: a [Reason:] 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
Answer
Answer: b [Reason:] If a multivalued dependency holds and is not implied by the corresponding functional dependency, it usually arises from this source.
9. Fifth Normal form is concerned with
a) Functional dependency
b) Multivalued dependency
c) Join dependency
d) Domain-key
Answer
Answer: c [Reason:] If a multivalued dependency holds and is not implied by the corresponding functional dependency, it usually arises from this source.
10. In 2NF
a) No functional dependencies (FDs) exist
b) No multivalued dependencies (MVDs) exist
c) No partial FDs exist
d) No partial MVDs exist
Answer
Answer: c [Reason:] If a multivalued dependency holds and is not implied by the corresponding functional dependency, it usually arises from this source.