0% found this document useful (0 votes)
2 views

dbms 2

The document contains a series of questions and answers related to database transactions, integrity constraints, SQL commands, and database administration. It covers topics such as transaction management, data integrity, SQL syntax, and user privileges. The format includes multiple-choice questions with correct answers indicated for each question.

Uploaded by

zmd141479
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

dbms 2

The document contains a series of questions and answers related to database transactions, integrity constraints, SQL commands, and database administration. It covers topics such as transaction management, data integrity, SQL syntax, and user privileges. The format includes multiple-choice questions with correct answers indicated for each question.

Uploaded by

zmd141479
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 15

1

1. A _________ consists of a sequence of query and/or update statements.(a)


a) Transaction
b) Commit
c) Rollback
d) Flashback

2. Which of the following makes the transaction permanent in the database?(b)


a) View
b) Commit
c) Rollback
d) Flashback

3. In order to undo the work of transaction after last commit which one should be
used?(c)
a) View
b) Commit
c) Rollback
d) Flashback

4. Consider the following action(d)

TRANSACTION.....
Commit;
ROLLBACK;

What does Rollback do?


a) Undoes the transactions before commit
b) Clears all transactions
c) Redoes the transactions before commit
d) No action

5. In case of any shut down during transaction before commit which of the following
statement is done automatically?(c)
a) View
b) Commit
c) Rollback
d) Flashback

6. In order to maintain the consistency during transactions, database provides(b)


a) Commit
b) Atomic
c) Flashback
d) Retain

7. Transaction processing is associated with everything below except(a)


a) Conforming an action or triggering a response
b) Producing detail summary or exception report
c) Recording a business activity
2

d) Maintaining a data

8. A transaction completes its execution is said to be (a)


a) Committed
b) Aborted
c) Rolled back
d) Failed

9. Which of the following is used to get back all the transactions back after rollback?
(c)
a) Commit
b) Rollback
c) Flashback
d) Redo

10. ______ will undo all statements up to commit?(c)


a) Transaction
b) Flashback
c) Rollback
d) Abort

To include integrity constraint in an existing relation use (c)


a) Create table
b) Modify table
c) Alter table
d) Drop table

2. Which of the following is not an integrity constraint?(b)


a) Not null
b) Positive
c) Unique
d) Check ‘predicate’

5. Foreign key is the one in which the ________ of one relation is referenced in
another relation.(b)
a) Foreign key
b) Primary key
c) References
d) Check constraint

6.

CREATE TABLE course


( . . .
FOREIGN KEY (dept name) REFERENCES department
. . . );

Which of the following is used to delete the entries in the referenced table when the
tuple is deleted in course table?(b)
3

a) Delete
b) Delete cascade
c) Set null
d) All of the mentioned

7. Domain constraints, functional dependency and referential integrity are special


forms of _________(c)
a) Foreign key
b) Primary key
c) Assertion
d) Referential constraint

8. Which of the following is the right syntax for the assertion?(a)


a) Create assertion ‘assertion-name’ check ‘predicate’;
b) Create assertion check ‘predicate’ ‘assertion-name’;
c) Create assertions ‘predicates’;
d) All of the mentioned

9. Data integrity constraints are used to(c)


a) Control who is allowed access to the data
b) Ensure that duplicate records are not entered into the table
c) Improve the quality of data entered for a specific property (i.e., table column)
d) Prevent users from changing the values stored in the table

10. Which of the following can be addressed by enforcing a referential integrity


constraint?(c)
a) All phone numbers must include the area code
b) Certain fields are required (such as the email address, or phone number) before the
record is accepted
c) Information on the customer must be known before anything can be sold to that customer
d) When entering an order quantity, the user must input a number and not some text (i.e.,
12 rather than ‘a dozen’)

1. Dates must be specified in the format(b)


a) mm/dd/yy
b) yyyy/mm/dd
c) dd/mm/yy
d) yy/dd/mm

2. A ________ on an attribute of a relation is a data structure that allows the database


system to find those tuples in the relation that have a specified value for that
attribute efficiently, without scanning through all the tuples of the relation.(a)
a) Index
b) Reference
c) Assertion
d) Timestamp

3.
4

Create index studentID_index on student(ID);

Here which one denotes the relation for which index is created?(d)
a) StudentID_index
b) ID
c) StudentID
d) Student

4. Which of the following is used to store movie and image files?(b)


a) Clob
b) Blob
c) Binary
d) Image

5. The user defined data type can be created using(d)


a) Create datatype
b) Create data
c) Create definetype
d) Create type

6. Values of one type can be converted to another domain using which of the
following?(a)
a) Cast
b) Drop type
c) Alter type
d) Convert

7.

CREATE DOMAIN YearlySalary NUMERIC(8,2)


CONSTRAINT salary VALUE test __________;

In order to ensure that an instructor’s salary domain allows only values greater than
a specified value use(c)
a) Value>=30000.00
b) Not null;
c) Check(value >= 29000.00);
d) Check(value)

8. Which of the following closely resembles Create view?(b)


a) Create table . . .like
b) Create table . . . as
c) With data
d) Create view as

9. In contemporary databases, the top level of the hierarchy consists of ______ each
of which can contain _____(a)
a) Catalogs, schemas
5

b) Schemas, catalogs
c) Environment, schemas
d) Schemas, Environment

10. Which of the following statements creates a new table temp instructor that has
the same schema as an instructor.(b)
a) create table temp_instructor;
b) Create table temp_instructor like instructor;
c) Create Table as temp_instructor;
d) Create table like temp_instructor;

1. The database administrator who authorizes all the new users, modifies the
database and takes grants privilege is(d)
a) Super user
b) Administrator
c) Operator of operating system
d) All of the mentioned

2. Which of the following is a basic form of grant statement?(a)


a)

GRANT 'privilege list'


ON 'relation name or view name'
TO 'user/role list';

b)

GRANT 'privilege list'


ON 'user/role list'
TO 'relation name or view name';

c)

GRANT 'privilege list'


TO 'user/role list'

d)

GRANT 'privilege list'


ON 'relation name or view name'
ON 'user/role list';

3. Which of the following is used to provide privilege to only a particular attribute?(b)


a) Grant select on employee to Amit
b) Grant update(budget) on department to Raj
c) Grant update(budget,salary,Rate) on department to Raj
6

d) Grant delete to Amit

4. Which of the following statement is used to remove the privilege from the user
Amir?(b)
a) Remove update on department from Amir
b) Revoke update on employee from Amir
c) Delete select on department from Raj
d) Grant update on employee from Amir

5. Which of the following is used to provide delete authorization to instructor?(c)


a)

CREATE ROLE instructor ;


GRANT DELETE TO instructor;

b)

CREATE ROLE instructor;


GRANT SELECT ON takes
TO instructor;

c)

CREATE ROLE instructor;


GRANT DELETE ON takes
TO instructor;

d) All of the mentioned

6. Which of the following is true regarding views?(c)


a) The user who creates a view cannot be given update authorization on a view without
having update authorization on the relations used to define the view
b) The user who creates a view cannot be given update authorization on a view without
having update authorization on the relations used to define the view
c) If a user creates a view on which no authorization can be granted, the system will allow
the view creation request
d) A user who creates a view receives all privileges on that view

7. If we wish to grant a privilege and to allow the recipient to pass the privilege on to
other users, we append the __________ clause to the appropriate grant command.(d)
a) With grant
b) Grant user
c) Grant pass privelege
d) With grant option

8. In authorization graph, if DBA provides authorization to u1 which inturn gives to u2


which of the following is correct?(c)
a) If DBA revokes authorization from u1 then u2 authorization is also revoked
b) If u1 revokes authorization from u2 then u2 authorization is revoked
7

c) If DBA & u1 revokes authorization from u1 then u2 authorization is also revoked


d) If u2 revokes authorization then u1 authorization is revoked
.

9. Which of the following is used to avoid cascading of authorizations from the user?
(b)
a) Granted by current role
b) Revoke select on department from Amit, Satoshi restrict;
c) Revoke grant option for select on department from Amit;
d) Revoke select on department from Amit, Satoshi cascade;
.

10. The granting and revoking of roles by the user may cause some confusions when
that user role is revoked. To overcome the above situation(a)
a) The privilege must be granted only by roles
b) The privilege is granted by roles and users
c) The user role cannot be removed once given
d) By restricting the user access to the roles

1. Which of the following is used to access the database server at the time of
executing the program and get the data from the server accordingly?(b)
a) Embedded SQL
b) Dynamic SQL
c) SQL declarations
d) SQL data analysis

2. Which of the following header must be included in java program to establish


database connectivity using JDBC ?(a)
a) Import java.sql.*;
b) Import java.sql.odbc.jdbc.*;
c) Import java.jdbc.*;
d) Import java.sql.jdbc.*;

3. DriverManager.getConnection(_______ , ______ , ______)(b)


What are the two parameters that are included?
a) URL or machine name where server runs, Password, User ID
b) URL or machine name where server runs, User ID, Password
c) User ID, Password, URL or machine name where server runs
d) Password, URL or machine name where server runs, User ID

4. Which of the following invokes functions in sql?(c)


a) Prepared Statements
b) Connection statement
c) Callable statements
d) All of the mentioned

5. Which of the following function is used to find the column count of the particular
resultset?(a)
a) getMetaData()
8

b) Metadata()
c) getColumn()
d) get Count()

6. Which of the following is a following statement is a prepared statements?(a)


a) Insert into department values(?,?,?)
b) Insert into department values(x,x,x)
c) SQLSetConnectOption(conn, SQL AUTOCOMMIT, 0)
d) SQLTransact(conn, SQL ROLLBACK)

7. Which of the following is used as the embedded SQL in COBOL?(b)


a) EXEC SQL <embedded SQL statement >;
b) EXEC SQL <embedded SQL statement > END-EXEC
c) EXEC SQL <embedded SQL statement >
d) EXEC SQL <embedded SQL statement > END EXEC;

8. Which of the following is used to distinguish the variables in SQL from the host
language variables?(c)
a) .
b) –
c) :
d) ,

10. Which of the following is used to access large objects from a database ?(d)
a) setBlob()
b) getBlob()
c) getClob()
d) all of the mentioned

3. Which of the following is used to input the entry and give the result in a variable in
a procedure?(d)
a) Put and get
b) Get and put
c) Out and In
d) In and out

5. The format for compound statement is(d)


a) Begin ……. end
b) Begin atomic……. end
c) Begin ……. repeat
d) Both Begin ……. end and Begin atomic……. end

6.
9

Repeat
sequence of statements;
__________________
end repeat

Fill in the correct option (c)


a) While Condition
b) Until variable
c) Until boolean expression
d) Until 0

8. A stored procedure in SQL is a___________(b)


a) Block of functions
b) Group of Transact-SQL statements compiled into a single execution plan.
c) Group of distinct SQL statements.
d) None of the mentioned

9. Temporary stored procedures are stored in _________ database.(d)


a) Master
b) Model
c) User specific
d) Tempdb

10. Declare out of classroom seats condition (b)

DECLARE exit handler FOR OUT OF classroom seats


BEGIN
SEQUENCE OF statements
END

The above statements are used for


a) Calling procedures
b) Handling Exception
c) Handling procedures
d) All of the mentioned

1. A __________ is a special kind of a store procedure that executes in response to


certain action on the table like insertion, deletion or updation of data.(b)
a) Procedures
b) Triggers
c) Functions
d) None of the mentioned

2. Triggers are supported in(c)


a) Delete
b) Update
c) Views
d) All of the mentioned
10

3. The CREATE TRIGGER statement is used to create the trigger. THE _____ clause
specifies the table name on which the trigger is to be attached. The ______ specifies
that this is an AFTER INSERT trigger.(b)
a) for insert, on
b) On, for insert
c) For, insert
d) None of the mentioned

4. What are the after triggers?(b)


a) Triggers generated after a particular operation
b) These triggers run after an insert, update or delete on a table
c) These triggers run after an insert, views, update or delete on a table
d) All of the mentioned

5. The variables in the triggers are declared using(b)


a) –
b) @
c) /
d) /@

6. The default extension for an Oracle SQL*Plus file is(d)


a) .txt
b) .pls
c) .ora
d) .sql

7. Which of the following is NOT an Oracle-supported trigger?(b)


a) BEFORE
b) DURING
c) AFTER
d) INSTEAD OF

8. What are the different in triggers?(c)


a) Define, Create
b) Drop, Comment
c) Insert, Update, Delete
d) All of the mentioned
Explanation: Triggers are not possible for create, drop.

9. Triggers ________ enabled or disabled(a)


a) Can be
b) Cannot be
c) Ought to be
d) Always

10. Which prefixes are available to Oracle triggers?(c)


a) : new only
b) : old only
11

c) Both :new and : old


d) Neither :new nor : old

1. Any recursive view must be defined as the union of two subqueries: a _______
query that is nonrecursive and a __________ query.(a)
a) Base, recursive
b) Recursive, Base
c) Base, Redundant
d) View, Base

2. Ranking of queries is done by which of the following?(b)


a) Group by
b) Order by
c) Having
d) Both Group by and Order by

3. In rank() function if one value is shared by two tuples then(b)


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

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

5.

SELECT ID, GPA


FROM student grades
ORDER BY GPA
____________;

Inorder to give only 10 rank on the whole we should use(a)


a) Limit 10
b) Upto 10
c) Only 10
d) Max 10

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).(c)
a) Ntil()
b) Cum_rank
c) Percent_rank
d) rank()
12

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

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

10. The command ________________ such tables are available only within the
transaction executing the query and are dropped when the transaction finishes.(b)
a) Create table
b) Create temporary table
c) Create view
d) Create label view

1. OLAP stands for(a)


a) Online analytical processing
b) Online analysis processing
c) Online transaction processing
d) Online aggregate processing

2. Data that can be modeled as dimension attributes and measure attributes are
called _______ data.(a)
a) Multidimensional
b) Singledimensional
c) Measured
d) Dimensional

3. The generalization of cross-tab which is represented visually is ____________


which is also called as data cube.(a)
a) Two dimensional cube
b) Multidimensional cube
c) N-dimensional cube
d) Cuboid

4. The process of viewing the cross-tab (Single dimensional) with a fixed value of one
attribute is(a)
a) Slicing
b) Dicing
c) Pivoting
d) Both Slicing and Dicing

5. The operation of moving from finer-granularity data to a coarser granularity (by


means of aggregation) is called a ________(a)
13

a) Rollup
b) Drill down
c) Dicing
d) Pivoting

6. In SQL the cross-tabs are created using(a)


a) Slice
b) Dice
c) Pivot
d) All of the mentioned

8. What do data warehouses support?(a)


a) OLAP
b) OLTP
c) OLAP and OLTP
d) Operational databases

9.

SELECT item name, color, clothes SIZE, SUM(quantity)


FROM sales
GROUP BY rollup(item name, color, clothes SIZE);

How many grouping is possible in this rollup?(b)


a) 8
b) 4
c) 2
d) 1

10. Which one of the following is the right syntax for DECODE?(d)
a) DECODE (search, expression, result [, search, result]… [, default])
b) DECODE (expression, result [, search, result]… [, default], search)
c) DECODE (search, result [, search, result]… [, default], expression)
d) DECODE (expression, search, result [, search, result]… [, default])

1. Relational Algebra is a __________ query language that takes two relations as


input and produces another relation as an output of the query.(c)
a) Relational
b) Structural
c) Procedural
d) Fundamental

2. Which of the following is a fundamental operation in relational algebra?(d)


a) Set intersection
b) Natural join
c) Assignment
d) None of the mentioned
14

3. Which of the following is used to denote the selection operation in relational


algebra?(b)
a) Pi (Greek)
b) Sigma (Greek)
c) Lambda (Greek)
d) Omega (Greek)

4. For select operation the ________ appear in the subscript and the ___________
argument appears in the paranthesis after the sigma.(a)
a) Predicates, relation
b) Relation, Predicates
c) Operation, Predicates
d) Relation, Operation

5. The ___________ operation, denoted by −, allows us to find tuples that are in one
relation but are not in another.(b)
a) Union
b) Set-difference
c) Difference
d) Intersection

6. Which is a unary operation(d)


a) Selection operation
b) Primitive operation
c) Projection operation
d) Generalized selection

Explanation: Generalization Selection takes only one argument for operation.

7. Which is a join condition contains an equality operator(a)


a) Equijoins
b) Cartesian
c) Natural
d) Left
.

8. In precedence of set operators, the expression is evaluated from(b)


a) Left to left
b) Left to right
c) Right to left
d) From user specification

9. Which of the following is not outer join?(d)


a) Left outer join
b) Right outer join
c) Full outer join
d) All of the mentioned
15

10. The assignment operator is denoted by(b)


a) ->
b) <-
c) =
d) ==

10. A set of possible data values is called(d)


a) Attribute
b) Degree
c) Tuple
d) Domain

You might also like