DB2 Mock Test



This section presents you various set of Mock Tests related to DB2. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.

Questions and Answers

DB2 Mock Test II

Q 1 - What is the maximum size of a CHAR data type in DB2?

A - 256 bytes

B - 1032 bytes

C - 254 bytes

D - 1064 bytes

Answer : C

Explanation

Char data type maximum size is of 254 bytes.

Q 2 - Write the query to delete all the rows from a table TAB.

A - DELETE TAB;

B - DELETE * FROM TAB;

C - DELETE * FROM TABLE TAB;

D - DROP * FROM TAB;

Answer : B

Explanation

DELETE * FROM table-name is the syntax to delete all the rows from a table.

Q 3 - Write a query to delete a table TAB from database.

A - DELETE TABLE TAB

B - DELETE TAB

C - DROP TAB

D - DROP TABLE TAB;

Answer : D

Explanation

DROP TABLE table-name is the syntax to delete a table from database.

Q 4 - How many primary keys can be declared on a table?

A - No Limit

B - Only 1

C - 5

D - 10

Answer : B

Explanation

A table can have only one primary key.

Q 5 - In which statement you can define primary key?

A - CREATE TABLE

B - ALTER TABLE

C - UPDATE TABLE

D - Both A & B

Answer : D

Explanation

Primary keys are optional and we can define them in CRETAE TABLE & ALTER TABLE statements.

Q 6 - Which statement is used to authorize access on database tables?

A - ACCESS

B - PRIVILEGE

C - AUTHORIZE

D - GRANT

Answer : D

Explanation

GRANT keyword is used to grant privileges on DB2 tables.

Q 7 - Which statement is used to revoke the access from a database?

A - REJECT

B - REVERT

C - REVOKE

D - None of these

Answer : C

Explanation

REVOKE statement is used to take away the permissions from a Database.

Answer : B

Explanation

DCLGEN stands for Declaration Generator.

Q 9 - What does a negative SQL code indicates?

A - Exception

B - Failure

C - Success

D - None of these

Answer : B

Explanation

A negative SQL code indicates a failure while a positive one indicates an exception.

Q 10 - What does a positive SQL code indicates?

A - Exception

B - Failure

C - Success

D - None of these

Answer : A

Explanation

A negative SQL code indicates a failure while a positive one indicates an exception.

Answer : B

Explanation

DBRM stands for Database Request Module which contains SQL statements.

Answer : C

Explanation

Bind step converts all the SQL statements into executable form in COBOL-DB2 program.

Q 13 - Suppose a Plan contains 4 Packages & we modified one of the DBRM which is present in one of the Package. Then for normal functionality of application what should we do?

A - Bind complete plan

B - Bind all packages

C - Bind one package in which modified DBRM is present

D - None of these

Answer : C

Explanation

We will bind only that package which contains the modified DBRM. No need to bind all the packages.

Q 14 - What does application plan contains?

A - DBRM

B - Package

C - Both A & B

D - None of these

Answer : C

Explanation

Application plan consists of one or more DBRM & application package which is kept in buffer pool during program execution.

Answer : A

Explanation

When no rows are found or you reach the end of cursor, then you will get SQLCODE = 100

Answer : B

Explanation

When object is not defined and you are using it then you will see SQLCODE = -204

Answer : C

Explanation

You will face SQLCODE = -805 when program has not been binded to the plan.

Answer : D

Explanation

When you will try to insert or update a record with duplicate key then you will face SQLCODE = -803

Answer : A

Explanation

You will face -811 SQLCODE when the SELECT query returns more than one number of rows.

Answer : B

Explanation

At the time of deadlock or timeout you will face SQLCODE -911.

Answer : C

Explanation

If a user is not authorized to access DB2 objects, he will face SQLCODE -922.

Answer : D

Explanation

SQLCODE -818 is a timestamp mismatch of load module and bind timestamp built from DBRM.

Q 23 - Which operation is not associated with cursor?

A - Declare

B - Open

C - Read

D - Close

Answer : C

Explanation

We do not use read statement with cursor instead we use fetch statement.

Q 24 - Which command is used to start an instance on DB2?

A - STARTDB2

B - DB2START

C - DB2STOP

D - RUNDB2

Answer : B

Explanation

DB2START command is used to start an instance on DB2.

Q 25 - In a COBOL-DB2 program where can we declare a cursor?

A - Working Storage Section

B - Procedure Division

C - Linkage Section

D - Both A & B

Answer : D

Explanation

We can declare a cursor either i Working Storage Section or in Procedure Division also.

Answer Sheet

Question Number Answer Key
1 C
2 B
3 D
4 B
5 D
6 D
7 C
8 B
9 B
10 A
11 B
12 C
13 C
14 C
15 A
16 B
17 C
18 D
19 A
20 B
21 C
22 D
23 C
24 B
25 D
db2_questions_answers.htm
Advertisements