DB2 Self Test
DB2 Self Test
DB2 Self Test
Document: e1067test.fm
22/01/2013
22/01/2013
2.
O (a)
UPDATE TU00001.COURSES
SET CDUR = 5
O (b)
UPDATE TU00001.COURSES
SET CDUR = 5
WHERE CURRENT OF COURSEUPDATE
O (c)
O (d)
UPDATE TU00001.COURSES C
SET C.CSTITLE = 'New Title'
WHERE CURRENT OF COURSEUPDATE
The following commands are issued against a database containing a table named
TBACCAD.TUTCOURSES:
CREATE ALIAS TBACCAD.COUR
FOR TBACCAD.TUTCOURSES;
CREATE ALIAS USR.COUR
FOR TEMP.COUR;
CREATE ALIAS TU00001.COURSES FOR USR.COUR
if user TU00001 issues the following statement:
SELECT * FROM COUR
which of the following objects will be accessed?
O (a)
TBACCAD.COUR
O (b)
USR.COUR
O (c)
TEMP.COUR
O (d)
TU00001.COUR
22/01/2013
3.
4.
5.
6.
7.
All the volumes in a storage group must be of the same device type (e.g. tape, disk, ...).
O (b)
O (c)
O (d)
Storage groups may overlap. The same volume may belong to more than one storage
group.
When using DCLGEN to generate a table declaration, which information concerning this table
is NOT available in the generated output?
O (a)
O (b)
O (c)
O (d)
... while a DB2 utility has control of any part of the database.
O (b)
O (c)
... if there is a referential constraint pointing to a table of this database from a table of
another database.
O (d)
... before all indexes connected to tables of this database are dropped.
Assume that the database TRAINING exists, that it contains a tablespace TSDEFAULT, and that
you have the authority to create tables in it. Suppose there is a table called PERSONS in an other
database. Which of the following SQL statements is NOT correct?
O (a)
O (b)
O (c)
O (d)
When declaring a foreign key on a table, referencing an existing primary key with complete definition, what might differ between foreign key and primary key?
O (a)
O (b)
O (c)
O (d)
22/01/2013
8.
When a column has an extension of WITH DEFAULT NULL, and a unique index is created on this
column, what will be the effects on the possible null values in that column?
O (a)
O (b)
O (c)
It has no influence on the possible null values; DB2 doesnt consider nulls when it comes
to an index.
O (d)
9.
O (b)
O (c)
O (d)
The name of an index can be mentioned in a Select statement, to improve the performance of the query.
10.
There are three types of authorization associated with a user in DB2. Which of the following is
NOT one of them?
O (a)
Primary Authorization ID
O (b)
Secondary Authorization ID
O (c)
SQL Authorization ID
O (d)
Current SQLID
11.
Complete correctly:
When a user has a SELECT authorization on a certain base table, and he creates a view on that
table alone, then he/she ...
O (a)
O (b)
... also has DELETE authorization on that view because he/she is the creator of the view.
O (c)
... will notice that he cannot create the view (authorization error).
O (d)
... can only execute an UPDATE as long as the definition of the view is not exceeded.
22/01/2013
12.
O (a)
A tablespace is divided in units called pages, which hold one or more rows of a table. If
a row of 6000 bytes is placed in a 4K page, the page will automatically be resized to 8K.
O (b)
A tablespace is divided in units called pages, which hold one or more rows of a table. If
a row of 6000 bytes is placed in a 4K page, the row will automatically be split over two
pages.
O (c)
Dropping a tablespace will not only remove all tables of the tablespace itself, but also all
indexes created on these tables, even though they are stored separately in their own
indexspace.
O (d)
When creating a tablespace, one must indicate either the storage group or the bufferpool
to be used by this tablespace. If neither is defined, the creation of the tablespace will fail.
13.
[_] [a]
A subquery was used in the embedded SQL statement. Rewrite the statement without
subquery, i.e., use a join instead.
[_] [b]
The SQL statement was not a singleton select. A cursor will be needed
[_] [c]
The SQL statement was correct. Check the consistency of the data in the tables; check
especially for duplicates in a column where one does not expect it.
[_] [d]
A UNION was used in the embedded SQL statement. Rewrite the SQL statement as two
separate statements, or use a UNION ALL.
14.
When granting and revoking authorizations, which of the following aspects will NOT be taken
into consideration by DB2?
O (a)
O (b)
O (c)
O (d)
22/01/2013
15.
O (a)
The row will be inserted in the table TU00001.COMPANIES, but it will never show up in a
SELECT on this view.
O (b)
The row will be inserted only if the user has an authority to insert on table
TU00001.COMPANIES, but it will never show up in a SELECT on this view.
O (c)
The row wont be inserted because the field COCOUNTRY doesnt have the value BE.
O (d)
You cant insert into a view, because views dont contain actual data; theyre just virtual
windows on base tables.
16.
What happens when the execution of a utility is terminated by the TERM command?
O (a)
The execution ends abnormally, the corresponding row in the SYSUTIL table is not
removed, all resources are freed.
O (b)
The execution ends normally, the corresponding row in the SYSUTIL table is not removed,
all resources are freed.
O (c)
The execution ends normally, the corresponding row in the SYSUTIL table is removed, all
resources are freed.
O (d)
The execution ends abnormally, the corresponding row in the SYSUTIL table is removed,
all resources are freed.
O (e)
The execution ends abnormally, the corresponding row in the SYSUTIL table is not
removed, all resources remain blocked.
O (f)
The execution ends normally, the corresponding row in the SYSUTIL table is not removed,
resources remain blocked.
17.
O (a)
When a TABLESPACE is S-locked (Shared use) by another user, a U lock (Update use)
can be placed. However, an X lock (eXclusive use) on this level will force the S lock to
be dropped, its transaction to be rolled-back to be able to place the X lock.
O (b)
O (c)
O (d)
When a TABLESPACE is S-locked by another user, neither a U lock or an X lock is compatible on this level. In both cases an I lock (IU lock, IX lock) will be placed to indicate that
a U lock or X lock is waiting to be placed.
22/01/2013
18.
Besides on TABLE and TABLESPACE level, on what level can implicit locks be placed by DB2?
O (a)
O (b)
O (c)
O (d)
19.
If the SQLCA is included in the program, which of the following host-variables is NOT known and
as such unavailable for the program?
O (a)
SQLWARN
O (b)
SQLCODE
O (c)
SQLNUM
O (d)
SQLSTATE
22/01/2013
20.
PIC
PIC
S9(9) COMP.
X(40).
PIC
PIC
PIC
S9(4) COMP.
X(20).
9(9).
PIC
BIN FIXED(31),
CHAR(40),
CHAR(20) VAR;
BIN FIXED(31);
BIN FIXED(15);
The column PNUMBER is the primary key. Which of the following embedded SQL statements is
correct?
O (a)
SELECT
FROM
INTO
WHERE
PLASTNAME
PERSONS
:PLASTNAME:IND(2)
PNUMBER = :NUM
O (b)
SELECT
INTO
FROM
WHERE
PLASTNAME
:PLASTNAME:IND(2)
PERSONS
PNUMBER = :NUM
O (c)
SELECT
FROM
INTO
WHERE
*
PERSONS
:PERSONS:IND
PNUMBER = :NUM
O (d)
SELECT
INTO
FROM
WHERE
*
:PERSONS:IND
PERSONS
PNUMBER = :NUM
22/01/2013
21.
Which of the following statements concerning the use of indicator variables in embedded SQL
statements is the MOST correct one?
O (a)
For every single column that can be NULL, we should add an indicator variable to the
host variable. Columns that cant be NULL dont need an indicator variable added to their
host variables, but if they have such an indicator variable, this will not generate an error.
O (b)
For every single column that can be NULL, we should add an indicator variable to the
host variable. Columns that cant be NULL, mustnt have an indicator variable added to
their host variables, otherwise an error would be generated.
O (c)
For every single NULL value returned to the programs host variables, we should add an
indicator variable to the receiving host variable. If we dont, an error will be generated.
O (d)
For every single NULL value returned to the programs host variables, we should add an
indicator variable to the receiving host variable. If we dont, this might generate an error,
viz. when the host variable hasnt been used before this instance.
22.
CURS CURSOR
*
TAB1
COL1 > :NUM
Which of the following embedded SQL statements will NOT generate an error?
O (a) FETCH
INTO
FROM
*
:HOSTTAB1:IND
TAB1
O (b)
FETCH
INTO
O (c)
SELECT
INTO
FROM
*
:HOSTTAB1:IND
CURS
O (d)
SELECT
INTO
CURS
:HOSTTAB1:IND
23.
CURS
:HOSTTAB1:IND
PFNAME
:PFNAME:IND
TUTPERSONS
PLNAME = :PLNAME
In which order should the following program variables be evaluated by the part of the program
just after this SQL statement?
O (a)
O (b)
O (c)
O (d)
22/01/2013
10
24.
The following is the CREATE statement for a table in DB2, executed by user TU00001:
CREATE TABLE COURSES
( CID
CHAR(4)
CSTITLE CHAR(45)
CLTITLE VARCHAR(60)
CDUR
SMALLINT
CAPRICE DECIMAL(9,2)
IN TRAINING.TSDEFAULT
NOT NULL,
NOT NULL,
,
NOT NULL,
NOT NULL)
O (b)
O (c)
O (d)
25.
[_] [a]
[_] [b]
When an index is added to one of the tables used by the embedded SQL.
[_] [c]
When a new user is executing an application in which unqualified tables are used in the
embedded SQL.
[_] [d]
22/01/2013
11
EVALUATION.
Here are the correct answers to all questions:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10. c
11. a
12. c
13. b c
14. d
15. a
16. c
17. b
18. d
19. c
20. d
21. a
22. b
23. a
24. d
25. b d
Give 1 point per correctly answered question. A question is correctly answered if all indicated answers are given.
If your score is more than 80%, you do not have to follow the course. You have now mastered the necessary knowledge to follow the DB2 for z/OS advanced programming
course, the DB2 for z/OS SQL performance course, and/or the DB2 for z/OS administration course.
When you have a score between 50% and 80%, following the course DB2 for z/OS fundamentals can improve your knowledge.
When your score is less than 50%, we strongly suggest you to follow this course DB2 for
z/OS fundamentals. Be sure your basic SQL knowledge is sufficient: fill out the corresponding self-test (see PDF file) to verify this.
22/01/2013
12