Database MCQ Number 00880

Database MCQ Set 1

1. In SQL, which command is used to issue multiple CREATE TABLE, CREATE VIEW and GRANT statements in a single transaction?
a) CREATE PACKAGE
b) CREATE SCHEMA
c) CREATE CLUSTER
d) All of the mentioned

Answer

Answer: b [Reason:] A database schema of a database system is its structure described in a formal language supported by the database management system and refers to the organization of data as a blueprint of how a database is constructed.

2. In SQL, the CREATE TABLESPACE is used
a) To create a place in the database for storage of scheme objects, rollback segments, and naming the data files to comprise the tablespace
b) To create a database trigger
c) To add/rename data files, to change storage
d) All of the mentioned

Answer

Answer: a [Reason:] Triggers are used to initialise the actions for a activity.

3. Which character function can be used to return a specified portion of a character string?
a) INSTR
b) SUBSTRING
c) SUBSTR
d) POS

Answer

Answer: c [Reason:] SUBSTR are used to match the particular characters in a string.

4. Which of the following is TRUE for the System Variable $date$?
a) Can be assigned to a global variable
b) Can be assigned to any field only during design time
c) Can be assigned to any variable or field during run time
d) Can be assigned to a local variable

Answer

Answer: b [Reason:] A database schema of a database system is its structure described in a formal language supported by the database management system and refers to the organization of data as a blueprint of how a database is constructed.

5. What are the different events in Triggers?
a) Define, Create
b) Drop, Comment
c) Insert, Update, Delete
d) Select, Commit

Answer

Answer: c [Reason:] A database trigger is procedural code that is automatically executed in response to certain events on a particular table or view in a database.

6. Which is the subset of SQL commands used to manipulate Oracle Database Structures, including tables?
a) Data Definition Language
b) Data Manipulation Language
c) Data Described Language
d) Data Retrieval Language

Answer

Answer: a [Reason:] DDL are used to define schema and table characters.

7. The SQL statement SELECT SUBSTR(‘123456789’, INSTR(‘abcabcabc’,’b’), 4) FROM EMP; prints
a) 6789
b) 2345
c) 1234
d) 456789

Answer

Answer: b [Reason:] SUBSTR are used to match the particular characters in a string.

8. Which of the following SQL command can be used to modify existing data in a database table?
a) MODIFY
b) UPDATE
c) CHANGE
d) NEW

Answer

Answer: b [Reason:] Syntax : UPDATE table_name
SET column1=value1,column2=value2,…
WHERE some_column=some_value; .

9. When SQL statements are embedded inside 3GL, we call such a program as
a) Nested query
b) Nested programming
c) Distinct query
d) Embedded SQL

Answer

Answer: d [Reason:] SQL-99 is the most recent version of standard SQL prescribed by the ANSI.

10. ___ provides option for entering SQL queries as execution time, rather than at the development stage.
a) PL/SQL
b) SQL*Plus
c) SQL
d) Dynamic SQL

Answer

Answer: d [Reason:] Dynamic SQL enables you to write programs that reference SQL statements whose full text is not known until runtime.

Database MCQ Set 2

1. Snapshot isolation is a particular type of ________ scheme.
a) Concurrency-control
b) Concurrency-allowance
c) Redirection
d) Repetition-allowance

Answer

Answer: a [Reason:] It has gained wide acceptance in commercial and open-source systems, including Oracle, PostgreSQL, and SQL Server.

2. Snapshot isolation is used to give
a) Transaction a snapshot of the database
b) Database a snapshot of the transaction
c) Database a snapshot of committed values in the transaction
d) Transaction a snapshot of the database and Database a snapshot of committed values in the transaction

Answer

Answer: d [Reason:] The data values in the snapshot consist only of values written by committed transactions.

3. Lost update problem is
a) Second update overwrites the first
b) First update overwrites the second
c) The updates are lost due to conflicting problem
d) None of the mentioned

Answer

Answer: a [Reason:] Lost update problem has to be resolved.

4. Under first updater wins the system uses a ____ mechanism that applies only to updates.
a) Close
b) Read
c) Locking
d) Beat

Answer

Answer: c [Reason:] Reads are unaffected by this, since they do not obtain locks.

5. When a transaction Ti attempts to update a data item, it requests a ___ on that data item.
a) Read lock
b) Update lock
c) Write lock
d) Chain lock

Answer

Answer: c [Reason:] Reads are unaffected by this, since they do not obtain locks.

6. Each of a pair of transactions has read data that is written by the other, but there is no data written by both transactions, is referred to as
a) Read skew
b) Update skew
c) Write lock
d) None of the mentioned

Answer

Answer: d [Reason:] Write skew is the issue addressed here.

7. An application developer can guard against certain snapshot anomalies by appending a ______ clause to the SQL select query.
a) For update
b) For read
c) For write
d) None of the mentioned

Answer

Answer: a [Reason:] Adding the for update clause causes the system to treat data that are read as if they had been updated for purposes of concurrency control.

8. Evaluate the CREATE TABLE statement:

CREATE TABLE products
(product_id NUMBER(6) CONSTRAINT prod_id_pk PRIMARY KEY, product_name VARCHAR2(15));

Which statement is true regarding the PROD_ID_PK constraint?
a) It would be created only if a unique index is manually created first
b) It would be created and would use an automatically created unique index
c) It would be created and would use an automatically created no unique index
d) It would be created and remains in a disabled state because no index is specified in the command

Answer

Answer: b [Reason:] Syntax: create table table_name(name constraint).

9. Evaluate the following CREATE SEQUENCE statement:

CREATE SEQUENCE seq1
START WITH 100
INCREMENT BY 10
MAXVALUE 200
CYCLE
NOCACHE;

The sequence SEQ1 has generated numbers up to the maximum limit of 200. You issue the following SQL statement:
SELECT seq1.nextval FROM dual;
What is displayed by the SELECT statement?
a) 1
b) 10
c) 100
d) an error

Answer

Answer: a [Reason:] Sequence is used to generate a series of values.

10. In which scenario would you use the ROLLUP operator for expression or columns within a GROUP BY clause?
a) To find the groups forming the subtotal in a row
b) To create group-wise grand totals for the groups specified within a GROUP BY clause
c) To create a grouping for expressions or columns specified within a GROUP BY clause in one direction, from
right to left for calculating the subtotals
d) To create a grouping for expressions or columns specified within a GROUP BY clause in all possible
directions, which is cross-tabular report for calculating the subtotals

Answer

Answer: c [Reason:] Sequence is used to generate a series of values.

Database MCQ Set 3

1. Two main measures for the efficiency of an algorithm are
a) Processor and memory
b) Complexity and capacity
c) Time and space
d) Data and space

Answer

Answer: c [Reason:] Depending on the time and space complexity only the algorithm for sorting will be chosen.

2. The time factor when determining the efficiency of algorithm is measured by
a) Counting microseconds
b) Counting the number of key operations
c) Counting the number of statements
d) Counting the kilobytes of algorithm

Answer

Answer: b [Reason:] The operations taking place with the time and space is counted.

3. The space factor when determining the efficiency of algorithm is measured by
a) Counting the maximum memory needed by the algorithm
b) Counting the minimum memory needed by the algorithm
c) Counting the average memory needed by the algorithm
d) Counting the maximum disk space needed by the algorithm

Answer

Answer: a [Reason:] Time complexity maintains the maximum time needed.

4. Which of the following case does not exist in complexity theory
a) Best case
b) Worst case
c) Average case
d) Null case

Answer

Answer: d [Reason:] Null case cannot be counted as the factor for complexity.

5. The Worst case occur in linear search algorithm when
a) Item is somewhere in the middle of the array
b) Item is not in the array at all
c) Item is the last element in the array
d) Item is the last element in the array or is not there at all

Answer

Answer: d [Reason:] Algorithmic complexity is concerned about how fast or slow particular algorithm performs.

6. The Average case occur in linear search algorithm
a) When Item is somewhere in the middle of the array
b) When Item is not in the array at all
c) When Item is the last element in the array
d) When Item is the last element in the array or is not there at all

Answer

Answer: a [Reason:] Algorithmic complexity is concerned about how fast or slow particular algorithm performs.

7. The complexity of the average case of an algorithm is
a) Much more complicated to analyze than that of worst case
b) Much more simpler to analyze than that of worst case
c) Sometimes more complicated and some other times simpler than that of worst case
d) None of the mentioned

Answer

Answer: a [Reason:] Algorithmic complexity is concerned about how fast or slow particular algorithm performs.

8. The complexity of linear search algorithm is
a) O(n)
b) O(log n)
c) O(n2)
d) O(n log n)

Answer

Answer: a [Reason:] It refers to n values complexity in the algorithm which can be reduced by choosing the other algorithms.

9. The complexity of Binary search algorithm is
a) O(n)
b) O(log )
c) O(n2)
d) O(n log n)

Answer

Answer: b [Reason:] This shows that it has a standard complexity in addressing.

10. The complexity of Bubble sort algorithm is
a) O(n)
b) O(log n)
c) O(n2)
d) O(n log n)

Answer

Answer: c [Reason:] Bubble sort, is a simple sorting algorithm that works by repeatedly stepping through the list to be sorted, comparing each pair of adjacent items and swapping them if they are in the wrong order.

Database MCQ Set 4

1. Which one of the following is used to define the structure of the relation ,deleting relations and relating schemas ?
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema

Answer

Answer: b [Reason:] Data Definition language is the language which performs all the operation in defining structure of relation.

2. Which one of the following provides the ability to query information from the database and to insert tuples into, delete tuples from, and modify tuples in the database ?
a) DML(Data Manipulation Langauge)
b) DDL(Data Definition Langauge)
c) Query
d) Relational Schema

Answer

Answer: a [Reason:] DML performs change in the values of the relation.

3. Create table employee (name varchar ,id integer)
What type of statement is this ?
a) DML
b) DDL
c) View
d) Integrity constraint

Answer

Answer: b [Reason:] Data Definition language is the language which performs all the operation in defining structure of relation.

4. Select * from employee
What type of statement is this?
a) DML
b) DDL
c) View
d) Integrity constraint

Answer

Answer: a [Reason:] Select operation just shows the required fields of the relation. So it forms a DML.

5. The basic data type char(n) is a _____ length character string and varchar(n) is _____ length character.
a) Fixed, equal
b) Equal, variable
c) Fixed, variable
d) Variable, equal

Answer

Answer: c [Reason:] Varchar changes its length accordingly whereas char has a specific length which has to be filled by either letters or spaces.

6. An attribute A of datatype varchar(20) has the value “Avi” . The attribute B of datatype char(20) has value ”Reed” .Here attribute A has ____ spaces and attribute B has ____ spaces.
a) 3, 20
b) 20, 4
c) 20 , 20
d) 3, 4

Answer

Answer: a [Reason:] Varchar changes its length accordingly whereas char has a specific length which has to be filled by either letters or spaces.

7. To remove a relation from an SQL database, we use the ______ command.
a) Delete
b) Purge
c) Remove
d) Drop table

Answer

Answer: d [Reason:] Drop table deletes the whole structure of the relation .purge removes the table which cannot be obtained again.

8. Delete from r; r – relation
This command performs which of the following action ?
a) Remove relation
b) Clear relation entries
c) Delete fields
d) Delete rows

Answer

Answer: b [Reason:] Delete command removes the entries in the table.

9. Insert into instructor values (10211, ’Smith’, ’Biology’, 66000);
What type of statement is this ?
a) Query
b) DML
c) Relational
d) DDL

Answer

Answer: b [Reason:] The values are manipulated .So it is a DML.

10. Updates that violate ____ are disallowed.
a) Integrity constraints
b) Transaction control
c) Authorization
d) DDL constraints

Answer

Answer: a [Reason:] Integrity constraint has to be maintained in the entries of the relation.

Database MCQ Set 5

1.

Name
Annie
Bob
Callie
Derek

Which of these query will display the the table given above ?
a) Select employee from name
b) Select name
c) Select name from employee
d) Select employee

Answer

Answer: c [Reason:] The field to be displayed is included in select and the table is included in the from clause.

2. Select ________ dept_name
from instructor;
Here which of the following displays the unique values of the column ?
a) All
b) From
c) Distinct
d) Name

Answer

Answer: c [Reason:] Distinct keyword selects only the entries that are unique.

3. The ______ clause allows us to select only those rows in the result relation of the ____ clause that satisfy a specified predicate.
a) Where, from
b) From, select
c) Select, from
d) From, where

Answer

Answer: a [Reason:] Where selects the rows on a particular condition.From gives the relation which involves the operation.

4. Select ID, name, dept name, salary * 1.1
where instructor;
The query given below will not give an error. Which one of the following has to be replaced to get the desired output?
a) Salary*1.1
b) ID
c) Where
d) Instructor

Answer

Answer: c [Reason:] Where selects the rows on a particular condition.From gives the relation which involves the operation. Since Instructor is a relation it has to have from clause.

5. The ________ clause is used to list the attributes desired in the result of a query.
a) Where
b) Select
c) From
d) Distinct

Answer

Answer: b [Reason:] None

6. Select name, course_id
from instructor, teaches
where instructor_ID= teaches_ID;
This Query can be replaced by which one of the following ?
a) Select name,course_id from teaches,instructor where instructor_id=course_id;
b) Select name, course_id from instructor natural join teaches;
c) Select name ,course_id from instructor;
d) Select course_id from instructor join teaches;

Answer

Answer: b [Reason:] Join clause joins two tables by matching the common column .

7. Select * from employee where salary>10000 and dept_id=101;
Which of the following fields are displayed as output?
a) Salary, dept_id
b) Employee
c) Salary
d) All the field of employee relation

Answer

Answer: d [Reason:] Here * is used to select all the fields of the relation .

8.

Employee_id Name Salary
1001 Annie 6000
1009 Ross 4500
1018 Zeith 7000

This is Employee table.
Select * from employee where employee_id>1009;
Which of the following employee_id will be displayed?
a) 1009, 1001, 1018
b) 1009, 1018
c) 1001
d) 1018

Answer

Answer: d [Reason:] Greater than symbol does not include the given value unlike >=.

9. Which of the following statements contains an error?
A) Select * from emp where empid = 10003;
B) Select empid from emp where empid = 10006;
C) Select empid from emp;
D) Select empid where empid = 1009 and lastname = ‘GELLER’;

Answer

Answer: d [Reason:] This query do not have from clause which specifies the relation from which the values has to be selected .

10. Insert into employee _____ (1002,Joey,2000);
In the given query which of the keyword has to be inserted ?
a) Table
b) Values
c) Relation
d) Field

Answer

Answer: b [Reason:] Value keyword has to be used to insert the values into the table.

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.