250+ TOP MCQs on Null Values Operations and Answers

Database Multiple Choice Questions on “Null Values Operations”.

1. A _____ indicates an absent value that may exist but be unknown or that may not exist at all.
a) Empty tuple
b) New value
c) Null value
d) Old value

Answer: c
Clarification: None.

2. If the attribute phone number is included in the relation all the values need not be entered into the phone number column. This type of entry is given as
a) 0
b) –
c) Null
d) Empty space

Answer: c
Clarification: Null is used to represent the absence of a value.

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

Answer: d
Clarification: None.

4.

 SELECT name
FROM instructor
WHERE salary IS NOT NULL;
Selects

a) Tuples with null value
b) Tuples with no null values
c) Tuples with any salary
d) All of the mentioned

Answer: b
Clarification: Not null constraint removes the tpules of null values.

5. In an employee table to include the attributes whose value always have some value which of the following constraint must be used?
a) Null
b) Not null
c) Unique
d) Distinct

Answer: b
Clarification: Not null constraint removes the tuples of null values.

6. Using the ______ clause retains only one copy of such identical tuples.
a) Null
b) Unique
c) Not null
d) Distinct

Answer: d
Clarification: Unique is a constraint.

7.

CREATE TABLE employee (id INTEGER,name VARCHAR(20),salary NOT NULL);
INSERT INTO employee VALUES (1005,Rach,0);
INSERT INTO employee VALUES (1007,Ross, );
INSERT INTO employee VALUES (1002,Joey,335);

Some of these insert statements will produce an error. Identify the statement.
a) Insert into employee values (1005,Rach,0);
b) Insert into employee values (1002,Joey,335);
c) Insert into employee values (1007,Ross, );
d) None of the mentioned

Answer: c
Clarification: Not null constraint is specified which means sone value (can include 0 also) should be given.

8. The primary key must be
a) Unique
b) Not null
c) Both Unique and Not null
d) Either Unique or Not null

Answer: c
Clarification: Primary key must satisfy unique and not null condition for sure.

9. You attempt to query the database with this command:

 SELECT nvl (100 / quantity, NONE)
     FROM inventory;

Why does this statement cause an error when QUANTITY values are null?
a) The expression attempts to divide by a null value
b) The data types in the conversion function are incompatible
c) The character string none should be enclosed in single quotes (‘ ‘)
d) A null value used in an expression cannot be converted to an actual value

Answer: a
Clarification: The expression attempts to divide by a null value is erroneous in sql.

10. The result of _____unknown is unknown.
a) Xor
b) Or
c) And
d) Not

Answer: d
Clarification: Since unknown does not hold any value the value cannot have a reverse value.

250+ TOP MCQs on Tuple Relational Calculus and Domain Relational Calculus

Database test on “Tuple Relational Calculus and Domain Relational Calculus”.

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: a
Clarification: 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: c
Clarification: 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: a
Clarification: 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: c
Clarification: 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: b
Clarification: ∀ 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: b
Clarification: 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: d
Clarification: 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}

View Answer

Answer: b
Clarification: 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: d
Clarification:Э 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: d

250+ TOP MCQs on Web Fundamentals and Answers

Database Multiple Choice Questions on “Web Fundamentals”.

1. Which of the following is a valid uniform resource locator?
a) http://www.acm.org/sigmod
b) www.google.com
c) www.ann.in
d) http:/www.acm.org/sigmod/

Answer: a
Clarification: A uniform resource locator (URL) is a globally unique name for each document that can be accessed on the Web.

2. http://www.google.com/search?q=silberschatz
In the above URL which one is the argument which is used for processing of the URL?
a) google
b) google.com
c) search
d) q=silberschatz

Answer: d
Clarification: Argument is always placed after ? symbol.

3. HTTP defines two ways in which values entered by a user at the browser can be sent to the Web server. The _____ method encodes the values as part of the URL.
a) Post
b) Get
c) Read
d) Argument

Answer: b
Clarification: For example, if the Google search page used a form with an input parameter
named q with the get method, and the user typed in the string “silberschatz” and submitted the form, the browser would request the following URL from the Web server: http://www.google.com/search?q=silberschatz.

4. A __________ is a program running on the server machine, which accepts requests from a Web browser and sends back results in the form of HTML documents.
a) HTML
b) HTTP
c) Web Server
d) Web browser

Answer: c
Clarification: The browser and Web server communicate via HTTP. Web servers provide powerful features, beyond the simple transfer of documents.

5. The application program typically communicates with a database server, through ___________ or other protocols, in order to get or store data.
a) JDBC
b) ODBC
c) All of the mentioned
d) None of the mentioned

Answer: c
Clarification: The common gateway interface (CGI) standard defines how the Web server communicates with application programs.

6. This extra information is usually maintained in the form of a _________ at the client.
a) Cookie
b) History
c) Remainder
d) None of the mentioned

Answer: a
Clarification: A cookie is simply a small piece of text containing identifying information and with an associated name.

7. Which of the following is not true about HTML ?
a)…
b) <meta…./>
c) …
d)

Answer: b
Clarification: Meta data is the data about data which is included in the meta data tag.

8. Html code contains:
a) Tags
b) Attributes
c) Elements
d) All of the mentioned

Answer: d
Clarification: <> are tags,size is a attribute.

9. Html document must always be saved with:
a) .html
b) .htm
c) .doc
d) Both .html & .htm

Answer: d
Clarification: .doc is used only for the word document format.

10. How many levels of headings are in html:
a) 2
b) 7
c) 6
d) 4

Answer: c
Clarification: The heading levels are h1,h2,h3,h4,h5,h6.

250+ TOP MCQs on Hashing techniques and Answers

Database Multiple Choice Questions on “Hashing techniques”.

1. If h is any hashing function and is used to hash n keys in to a table of size m, where n<=m, the expected number of collisions involving a particular key x is :
a) Less than 1
b) Less than n
c) Less than m
d) Less than n/2

Answer: a
Clarification: Hashing is also a method of sorting key values in a database table in an efficient manner.

2. A technique for direct search is
a) Binary Search
b) Linear Search
c) Tree Search
d) Hashing

Answer: d
Clarification: Hashing is one way to enable security during the process of message transmission when the message is intended for a particular recipient only.

3. The searching technique that takes O (1) time to find a data is
a) Linear Search
b) Binary Search
c) Hashing
d) Tree Search

Answer: c
Clarification: A formula generates the hash, which helps to protect the security of the transmission from unauthorized users.

4. The goal of hashing is to produce a search that takes
a) O(1) time
b) O(n2 )time
c) O(log n ) time
d) O(n log n ) time

Answer: a
Clarification: Time complexity is given by the big oh notation.

5. Consider a hash table of size seven, with starting index zero, and a hash function (3x + 4)mod7. Assuming the hash table is initially empty, which of the following is the contents of the table when the sequence 1, 3, 8, 10 is inserted into the table using closed hashing? Note that ‘_’ denotes an empty location in the table.
a) 8, _, _, _, _, _, 10
b) 1, 8, 10, _, _, _, 3
c) 1, _, _, _, _, _,3
d) 1, 10, 8, _, _, _, 3

Answer: b
Clarification: A formula generates the hash, which helps to protect the security of the transmission from unauthorized users.

6. A hash table can store a maximum of 10 records, currently there are records in location 1, 3,4,7,8,9,10. The probability of a new record going into location 2, with hash functions resolving collisions by linear probing is
a) 0.1
b) 0.6
c) 0.2
d) 0.5

Answer: b
Clarification: Hashing is used to index and retrieve items in a database because it is easier to find the item using the shortened hashed key than using the original value.

7. Key value pairs is usually seen in
a) Hash tables
b) Heaps
c) Both Hash tables and Heaps
d) Skip list

Answer: a
Clarification: Hashing is used to index and retrieve items in a database because it is easier to find the item using the shortened hashed key than using the original value.

8. What is the best definition of a collision in a hash table?
a) Two entries are identical except for their keys
b) Two entries with different data have the exact same key
c) Two entries with different keys have the same exact hash value
d) Two entries with the exact same key have different hash values

Answer: a
Clarification: This level is the root of the tree.

9. Which of the following scenarios leads to linear running time for a random search hit in a linear-probing hash table?
a) All keys hash to same index
b) All keys hash to different indices
c) All keys hash to an even-numbered index
d) All keys hash to different even-numbered indices

Answer: a
Clarification: If all keys hash to the same location then the i-th inserted key would need i lookups to be found. The probability of looking up i-th key is 1/n (since it’s random). If you know some probability it’s trivial to show that such lookups have linear time.

10. Breadth First Search is used in
a) Binary trees
b) Stacks
c) Graphs
d) All of the mentioned

Answer: c
Clarification: Hashing is used to index and retrieve items in a database because it is easier to find the item using the shortened hashed key than using the original value.

250+ TOP MCQs on Transaction Atomicity and Durability and Answers

Database Multiple Choice Questions on “Transaction Atomicity and Durability”.

1. A transaction may not always complete its execution successfully. Such a transaction is termed
a) Aborted
b) Terminated
c) Closed
d) All of the mentioned

Answer: a
Clarification: If we are to ensure the atomicity property, an aborted transaction must have no effect on the state of the database.

2. If an transaction is performed in a database and committed, the changes are taken to the previous state of transaction by
a) Flashback
b) Rollback
c) Both Flashback and Rollback
d) Cannot be done

Answer: d
Clarification: Once committed the changes cannot be rolled back.

3. Each modification done in database transaction are first recorded into the
a) Harddrive
b) Log
c) Disk
d) Datamart

Answer: b
Clarification: After commit is issued the data are stored in a database and stored in drive.

4. When the transaction finishes the final statement the transaction enters into
a) Active state
b) Committed state
c) Partially committed state
d) Abort state

Answer: c
Clarification: The commit statement has to be issued to enter into committed state.

5. The name of the transaction file shall be provided by the operator and the file that contains the edited transactions ready for execution shall be called
a) Batch. Exe
b) Trans. Exe
c) Opt. Exe
d) Edit.Exe

Answer: c
Clarification: Transactions has to be managed by the executable files.

6. Which of the following is an atomic sequence of database actions?
a) Transaction
b) Concurrency
c) Relations
d) All of the mentioned

Answer: a
Clarification: Transaction is a collection of operations that provides single logical function in database.

7. If the state of the database no longer reflects a real state of the world that the database is supposed to capture, then such a state is called
a) Consistent state
b) Parallel state
c) Atomic state
d) Inconsistent state

Answer: d
Clarification: If the state of the database no longer reflects a real state of the world that the database is supposed to capture, then such a state is called in a consistent state.

8. _______ 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: c
Clarification: 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.

9. 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: a
Clarification: DBMS periodically suspends all processing and synchronizes its files and journals though the use of Check point facility.

10. Which of the following is not a state in transaction?
a) Active
b) Terminated
c) Aborted
d) Partially committed

Answer: b
Clarification: The transaction states are abort, active, committed, partially committed, Failed.

250+ TOP MCQs on Failure with Nonvolatile Storage and Answers

Database Multiple Choice Questions on “Failure with Nonvolatile Storage”.

1. The silicon chips used for data processing are called
a) RAM chips
b) ROM chips
c) Micro processors
d) PROM chips

Answer: d
Clarification: 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: d
Clarification: 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: c
Clarification: 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: d
Clarification: 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: b
Clarification: 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: b
Clarification: 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: a
Clarification: 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: a
Clarification: 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: c
Clarification: 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: b
Clarification: The simple dump procedure described here is costly and so fuzzy dump is used.