Database MCQ Number 00887

Database MCQ Set 1

1. Let us consider phone_number ,which can take single or several values . Treating phone_numberas an ___ permits instructors to have several phone numbers (including zero) associated with them.
a) Entity
b) Attribute
c) Relation
d) Value

Answer

Answer: a [Reason:] Treating a phone as an attribute phone_number implies that instructors have precisely one phone number each.

2. The total participation by entities is represented in E-R diagram as
a) Dashed line
b) Double line
c) Double rectangle
d) Circle

Answer

Answer: b [Reason:] It is used to represent the relation between several attributes.

3. Given the basic ER and relational models, which of the following is INCORRECT?
a) An attribute of an entity can have more than one value
b) An attribute of an entity can be composite
c) In a row of a relational table, an attribute can have more than one value
d) In a row of a relational table, an attribute can have exactly one value or a NULL value

Answer

Answer: c [Reason:] It is possible to have several values for a single attribute provide it is a multi-valued attribute.

4. Which of the following indicates the maximum number of entities that can be involved in a relationship?
a) Minimum cardinality
b) Maximum cardinality
c) ERD
d) Greater Entity Count

Answer

Answer: b [Reason:] In SQL (Structured Query Language), the term cardinality refers to the uniqueness of data values contained in a particular column (attribute) of a database table.

5. In E-R diagram generalization is represented by
a) Ellipse
b) Dashed ellipse
c) Rectangle
d) Triangle

Answer

Answer: d [Reason:] Ellipse represents attributes,rectangle represents entity.

6. What is a relationship called when it is maintained between two entities?
a) Unary
b) Binary
c) Ternary
d) Quaternary

Answer

Answer: b [Reason:] Binary word usually represents two attributes.

7. Which of the following is a low level operator?
a) Insert
b) Update
c) Delete
d) Directory

Answer

Answer: d [Reason:] Directory is a low level to word on in file system .

8. Key to represent relationship between tables is called
a) Primary key
b) Secondary Key
c) Foreign Key
d) None of the mentioned

Answer

Answer: c [Reason:] Primary key of one relation used as an attribute in another relation is called foreign key.

9. A window into a portion of a database is
a) Schema
b) View
c) Query
d) Data dictionary

Answer

Answer: b [Reason:] View is a logical portion of a database which is needed by some users.

10. A primary key is combined with a foreign key creates
a) Parent-Child relation ship between the tables that connect them
b) Many to many relationship between the tables that connect them
c) Network model between the tables that connect them
d) None of the mentioned

Answer

Answer: a [Reason:] Using the two relationships mother and father provides us a record of a child’s mother, even if we are not aware of the father’s identity; a null value would be required if the ternary relationship parent is used. Using binary relationship sets is preferable in this case.

Database MCQ Set 2

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

Answer

Answer: a [Reason:] First compute the base query and add all the resultant tuples to the recursively defined view relation.

2. Ranking of queries is done by which of the following ?
a) Group by
b) Order by
c) Having
d) Both Group by and Order by

Answer

Answer: b [Reason:] Order by clause arranges the values in ascending or descending order where default is ascending order .

3. In rank() function if one value is shared by two tuples then
a) The rank order continues as counting numbers
b) The rank order continues by leaving one rank in the middle
c) The user specifies the order
d) The order does not change

Answer

Answer: b [Reason:] Example . rank() over (order by (GPA) desc).

4. The ____ function that does not create gaps in the ordering.
a) Intense_rank()
b) Continue_rank()
c) Default_rank()
d) Dense_rank()

Answer

Answer: d [Reason:] For dense_rank() the tuples with the second highest value all get rank 2, and tuples with the third highest value get rank 3, and so on .

5.

SELECT ID, GPA
FROM student grades
ORDER BY GPA
______;

Inorder to give only 10 rank on the whole we should use
a) Limit 10
b) Upto 10
c) Only 10
d) Max 10

Answer

Answer: a [Reason:] However, the limit clause does not support partitioning, so we cannot get the top n within each partition without performing ranking; further, if more than one student gets the same GPA, it is possible that one is included in the top 10, while another is excluded.

6. If there are n tuples in the partition and the rank of the tuple is r , then its ________ is defined as (r −1)/(n−1) .
a) Ntil()
b) Cum_rank
c) Percent_rank
d) rank()

Answer

Answer: c [Reason:] Percent rank of a tuple gives the rank of the tuple as a fraction.

7. Inorder to simplify the null value confusion in the rank function we can specify
a) Not Null
b) Nulls last
c) Nulls first
d) Either Nulls last or first

Answer

Answer: d [Reason:] select ID, rank () over (order by GPA desc nulls last) as s rank from student grades;.

8. Suppose we are given a view tot credits (year, num credits) giving the total number of credits taken by students in each year.The query that computes averages over the 3 preceding tuples in the specified sort order is

a) SELECT YEAR, avg(num credits)
OVER (ORDER BY YEAR ROWS 3 preceding)
AS avg total credits
FROM tot credits;
b) SELECT YEAR, avg(num credits)
OVER (ORDER BY YEAR ROWS 3 unbounded preceding)
AS avg total credits
FROM tot credits;
c) ALL OF the mentioned
d) NONE OF the mentioned
Answer

Answer: a [Reason:] Suppose that instead of going back a fixed number of tuples, we want the window to consist of all prior years we use rows unbounded preceding.

9. The functions which construct histograms and use buckets for ranking is
a) Rank()
b) Newtil()
c) Ntil()
d) None of the mentioned

Answer

Answer: c [Reason:] For each tuple, ntile(n) then gives the number of the bucket in which it is placed, with bucket numbers starting with 1.

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

Answer

Answer: b [Reason:] None.

Database MCQ Set 3

1. The Java ____ specification defines an application programming interface for communication between the Web server and the application program.
a) Servlet
b) Server
c) Program
d) Randomize

Answer

Answer: a [Reason:] Servlets are commonly used to generate dynamic responses to HTTP requests.

2. The doGet() method in the example extracts values of the parameter’s type and number by using ____
a) request.getParameter()
b) request.setParameter()
c) responce.getParameter()
d) responce.getAttribute()

Answer

Answer: a [Reason:] These methods uses these values to run a query against a database.

3. How many JDBC driver types does Sun define?
a) One
b) Two
c) Three
d) Four

Answer

Answer: d [Reason:] JBDB.DriverManager.getConnection() is used to get the connection to the database.

4. Which JDBC driver Type(s) can be used in either applet or servlet code?
a) Both Type 1 and Type 2
b) Both Type 1 and Type 3
c) Both Type 3 and Type 4
d) Type 4 only

Answer

Answer: c [Reason:] In a Type 3 driver, a three-tier approach is used to accessing databases. The JDBC clients use standard network sockets to communicate with an middleware application server.In a Type 4 driver, a pure Java-based driver that communicates directly with vendor’s database through socket connection.

5. What MySQL property is used to create a surrogate key in MySQL?
a) UNIQUE
b) SEQUENCE
c) AUTO_INCREMENT
d) None of the mentioned

Answer

Answer: c [Reason:] A surrogate key in a database is a unique identifier for either an entity in the modeled world or an object in the database.

6. A JSP is transformed into a(n):
a) Java applet
b) Java servlet
c) Either 1 or 2 above
d) Neither 1 nor 2 above

Answer

Answer: b [Reason:] Servlets are commonly used to generate dynamic responses to HTTP requests.

7. Which JDBC driver Type(s) is(are) the JDBC-ODBC bridge?
a) Type 1
b) Type 2
c) Type 3
d) Type 4

Answer

Answer: a [Reason:] In a Type 1 driver, a JDBC bridge is used to access ODBC drivers installed on each client machine.

8. What programming language(s) or scripting language(s) does Java Server Pages (JSP) support?
a) VBScript only
b) Jscript only
c) Java only
d) All of the mentioned

Answer

Answer: c [Reason:] JSP primarily uses Java for the certain codes.

9. What is bytecode?
a) Machine-specific code
b) Java code
c) Machine-independent code
d) None of the mentioned

Answer

Answer: c [Reason:] Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions.

10. Where is metadata stored in MySQL?
a) In the MySQL database metadata
b) In the MySQL database metasql
c) In the MySQL database mysql
d) None of the mentioned

Answer

Answer: c [Reason:] Metadata contains data about other data which is given in the … tags.

Database MCQ Set 4

1. Find the ID, name, dept name, salary for instructors whose salary is greater than $80,000 .
a) {t | t ε instructor ∧ t[salary] > 80000}
b) Э t ∈ r (Q(t))
c) {t | Э s ε instructor (t[ID] = s[ID]∧ s[salary] > 80000)}
d) None of the mentioned

Answer

Answer: a [Reason:] This expression is in tuple relational format.

2. A query in the tuple relational calculus is expressed as:
a) {t | P() | t}
b) {P(t) | t }
c) {t | P(t)}
d) All of the mentioned

Answer

Answer: c [Reason:] The tuple relational calculus, is a nonprocedural query language. It describes the desired information without giving a specific procedure for obtaining that information.

3.

{t | Э s ε instructor (t[name] = s[name]
∧ Э u ε department (u[dept name] = s[dept name]
∧ u[building] = “Watson”))}

Which of the following best describes the query ?
a) Finds the names of all instructors whose department is in the Watson building.
b) Finds the names of all department is in the Watson building.
c) Finds the name of the dapartment whose instructor and building is Watson.
d) Returns the building name of all the departments.

Answer

Answer: a [Reason:] This query has two “there exists” clauses in our tuple-relational-calculus expression, connected by and (∧).

4. Which of the following symbol is used in the place of except ?
a) ^
b) V
c) ¬
d) ~

Answer

Answer: c [Reason:] The query ¬P negates the value of P .

5. “Find all students who have taken all courses offered in the Biology department.” The expressions that matches this sentence is :
a) Э t ε r (Q(t))
b) ∀ t ε r (Q(t))
c) ¬ t ε r (Q(t))
d) ~ t ε r (Q(t))

Answer

Answer: b [Reason:] ∀ is used denote “for all” in SQL.

6. Which of the following is the comparison operator in tuple relational calculus
a) ⇒
b) =
c) ε
d) All of the mentioned

Answer

Answer: b [Reason:] The comparison operators are (<, ≤, =, =, >, ≥).

7. An expression in the domain relational calculus is of the form
a) {P(x1, x2, . . . , xn) | < x1, x2, . . . , xn > }
b) {x1, x2, . . . , xn | < x1, x2, . . . , xn > }
c) { x1, x2, . . . , xn | x1, x2, . . . , xn}
d) {< x1, x2, . . . , xn > | P(x1, x2, . . . , xn)}

Answer

Answer: d [Reason:] Here x1, x2, . . . , xn represent domain variables. P represents a formula composed of atoms, as was the case in the tuple relational calculus.

8. Find the names of all instructors in the Physics department together with the course id of all courses they teach:
a) {< c > | Э s (< c, a, s, y, b, r, t >ε section
∧s = “Fall” ∧ y = “2009”
∨Эu (< c, a, s, y, b, r, t >ε section
∧s = “Spring” ∧ y = “2010”
b) {< n, c > | Э i, a (< i, c, a, s, y > ε teaches
∧ Э d, s (< i, n, d, s > ε instructor ∧ d = “Physics”))}
c) {< n > | Э i, d, s (< i, n, d, s > ε instructor ∧ s > 80000)}
d) {< i, n, d, s > | < i, n, d, s > ε instructor ∧ s > 80000}

Answer

Answer: b [Reason:] None.

9. In domain relaional calculus “there exist” can be expressed as
a) (P1(x))
b) (P1(x)) Э x
c) V x (P1(x))
d) Э x (P1(x))

Answer

Answer: d [Reason:]Э is used to denote “some” values in relational calculus.

10. A set of possible data values is called
a) Attribute
b) Degree
c) Tuple
d) Domain

Answer

Answer: d [Reason:] None.

Database MCQ Set 5

1. The method of access that uses key transformation is called as
a) Direct
b) Hash
c) Random
d) Sequential

Answer

Answer: b [Reason:] Hash technique uses particular hash key value.

2. Why do we need concurrency control on B+ trees ?
a) To remove the unwanted data
b) To easily add the index elements
c) To maintain accuracy of index
d) All of the mentioned

Answer

Answer: c [Reason:] Indices do not have to be treated like other database structures.

3. How many techniques are available to control concurrency on B+ trees?
a) One
b) Three
c) Four
d) None of the mentioned

Answer

Answer: d [Reason:] Two techniques are present.

4. In crabbing protocol locking
a) Goes down the tree and back up
b) Goes up the tree and back down
c) Goes down the tree and releases
d) Goes up the tree and releases

Answer

Answer: a [Reason:] It moves in a crab like manner.

5. The deadlock can be handled by
a) Removing the nodes that are deadlocked
b) Restarting the search after releasing the lock
c) Restarting the search without releasing the lock
d) Resuming the search

Answer

Answer: b [Reason:] Crabbing protocol moves in a crab like manner.

6. In crabbing protocol the the lock obtained on the root node is in ___ mode.
a) Shared
b) Exclusive
c) Read only
d) None of the mentioned

Answer

Answer: a [Reason:] Crabbing protocol moves in a crab like manner down the index tree.

7. If needed to split a node or coalesce it with its siblings, or redistribute key values between siblings, the crabbing protocol locks the parent of the node in ______ mode.
a) Shared
b) Exclusive
c) Read only
d) None of the mentioned

Answer

Answer: b [Reason:] Crabbing protocol moves in a crab like manner down the index tree.

8. In crabbing protocol to inset or delete a key value the leaf node has to be locked in _____ mode.
a) Shared
b) Exclusive
c) Read only
d) None of the mentioned

Answer

Answer: b [Reason:] Crabbing protocol moves in a crab like manner down the index tree.

9. B-link tree requires a pointer to its ____ sibling.
a) Upper
b) Lower
c) Right
d) Left

Answer

Answer: c [Reason:] This pointer is required because a lookup that occurs while a node is being split may have to search not only that node but also that node’s right sibling.

10. Instead of locking index leaf nodes in a two-phase manner, some index concurrency-control schemes use _____ on individual key values, allowing other key values to be inserted or deleted from the same leaf.
a) B+ tree locking
b) Link level locking
c) Key-value locking
d) Next value locking

Answer

Answer: c [Reason:] Key-value locking thus provides increased concurrency.

ed010d383e1f191bdb025d5985cc03fc?s=120&d=mm&r=g

DistPub Team

Distance Publisher (DistPub.com) provide project writing help from year 2007 and provide writing and editing help to hundreds student every year.