DB2 700 Complete QA - 3

12
1.A developer is building an embedded SQL application on AIX that will access DB2 UDB for OS/390 or OS/400 servers. Which of the following products is required to be installed on the AIX system in order to build the application? a. DB2 Connect Personal Edition b. DB2 Personal Developer's Edition c. DB2 UDB Workgroup Server Edition d. DB2 Universal Developer's Edition 2. Which of the following tools can be used to catalog a database? a. Journal b. Task Center c. License Center d. Configuration Assistant 3. Which of the following DB2 components allows references to Oracle and DB2 databases in a single query? a. DB2 Query Patroller b. DB2 Warehouse Manager c. DB2 Relational Connect d. DB2 Connect Enterprise Edition 4. Given the following statements: CREATE TABLE tab1 (c1 CHAR(3) WITH DEFAULT '123',c2 INTEGER); INSERT INTO tab1(c2) VALUES (123); Which will be the result of the following statement when issued from the Command Line Processor? SELECT * FROM tab1; a. C1 C2 --- ----------- 0 record(s) selected. b. C1 C2 --- -----------123 123 1 record(s) selected. c. C1 C2 --- ----------- 123 1 record(s) selected. d. C1 C2 --- ----------- - 123 1 record(s) selected. 5. A client application on OS/390 or OS/400 must access a DB2 server on Linux. At a minimum, which of the following products is required to be on the DB2 server? a. DB2 Connect Enterprise Edition b. DB2 UDB Enterprise Server Edition c. DB2 Connect Enterprise Edition and DB2 UDB Workgroup Server Edition d. DB2 Connect Enterprise Edition and DB2 UDB Enterprise Server Edition Page 1 of 12

description

third in series of db2 700 exam QA

Transcript of DB2 700 Complete QA - 3

Page 1: DB2 700 Complete QA - 3

1.A developer is building an embedded SQL application on AIX that will access DB2 UDB for OS/390 or OS/400 servers. Which of the following products is required to be installed on the AIX system in order to build the application? a. DB2 Connect Personal Edition b. DB2 Personal Developer's Edition c. DB2 UDB Workgroup Server Edition d. DB2 Universal Developer's Edition

2. Which of the following tools can be used to catalog a database? a. Journal b. Task Center c. License Center d. Configuration Assistant

3. Which of the following DB2 components allows references to Oracle and DB2 databases in a single query? a. DB2 Query Patroller b. DB2 Warehouse Manager c. DB2 Relational Connect d. DB2 Connect Enterprise Edition

4. Given the following statements: CREATE TABLE tab1 (c1 CHAR(3) WITH DEFAULT '123',c2 INTEGER); INSERT INTO tab1(c2) VALUES (123); Which will be the result of the following statement when issued from the Command Line Processor? SELECT * FROM tab1; a. C1 C2 --- ----------- 0 record(s) selected. b. C1 C2 --- -----------123 123 1 record(s) selected. c. C1 C2 --- ----------- 123

1 record(s) selected. d. C1 C2 --- ----------- - 123

1 record(s) selected.

5. A client application on OS/390 or OS/400 must access a DB2 server on Linux. At a minimum, which of the following products is required to be on the DB2 server? a. DB2 Connect Enterprise Edition b. DB2 UDB Enterprise Server Edition c. DB2 Connect Enterprise Edition and DB2 UDB Workgroup Server Edition d. DB2 Connect Enterprise Edition and DB2 UDB Enterprise Server Edition

6. Given the tables: COUNTRY ID NAME PERSON CITIES 1 Argentina 1 10 2 Canada 2 20 3 Cuba 2 10 4 Germany 1 0 5 France 7 5

STAFF

Page 1 of 10

Page 2: DB2 700 Complete QA - 3

ID LASTNAME 1 Jones 2 Smith How many rows would be returned using the following statement? SELECT * FROM staff, country a. 0 b. 2 c. 5 d. 7 e. 10 7. Given the following statements: CREATE TABLE t1 (id INTEGER, CONSTRAINT chkid CHECK (id<100)) INSERT INTO t1 VALUES(100) COMMIT Which of the following occurs as a result of issuing the statements? a. The row is inserted with ID having a NULL value b. The row is inserted with ID having a value of 100 c. The row insertion with a value of 100 for ID is rejected d. The trigger called chkid is activated to validate the data

8. Cataloging a remote database server from a Linux, UNIX, or Windows gateway is: a. performed to identify the location of the clients b. performed to identify the server the DB2 database manager is on c. Never performed in DB2, as only one database per node is allowed, so cataloging a node automatically catalogs the database at that node. d. performed on a Linux, UNIX, or Windows machine to open the catalogs in the DB2 database server and present a user with a list of all accessible tables in that database

9. When using DB2 Connect, which of the following commands specifies the protocol information on how to connect to the host or to the server? a. CATALOG DCS b. CATALOG NODE c. CATALOG DATABASE d. CATALOG ODBC DATA SOURCE

10. An application using the Repeatable Read isolation level acquires an update lock. When does the update lock get released? a. When the cursor accessing the row is closed b. When the transaction issues a ROLLBACK statement c. When the cursor accessing the row is moved to the next row d. the transaction changes are made via an UPDATE statement

11. A unit of work is using an isolation level of Uncommitted Read, and allows scanning through the table more than once within the unit of work. Which of the following can occur during processing of this unit of work? a. It can access uncommitted changes made by other transactions It can update uncommitted changes made by other transactions b. It can update rows and have those updated rows be changed by other transactions from one scan to the next c. It can update rows and have those updated rows be committed by other transactions from one scan to the next

12. Given the tables: COUNTRY ID NAME PERSON_ID CITIES 1 Argentina 1 10 2 Canada 2 20 3 Cuba 2 10 4 Germany 1 0 5 France 7 5 STAFF

Page 2 of 10

Page 3: DB2 700 Complete QA - 3

ID LASTNAME 1 Jones 2 Smith COUNTRY(PERSON_ID) is the foreign key for STAFF(ID). Which of the following statements removes from the COUNTRY table those rows that do not have a STAFF person assigned? a. DELETE FROM country WHERE id IN (SELECT id FROM staff) b. DELETE FROM country WHERE id NOT IN (SELECT person_id FROM staff) c. DELETE FROM country WHERE person_id NOT IN (SELECT id FROM staff) d. DELETE FROM country WHERE person_id IN (SELECT person_id FROM staff)

13. Given the following statements: CREATE TABLE t4 (c1 INTEGER NOT NULL, c2 INTEGER, c3 DECIMAL(7,2) NOT NULL, c4 CHAR(20) NOT NULL); CREATE UNIQUE INDEX i4 ON t4(c1,c3); ALTER TABLE t4 ADD PRIMARY KEY (c1,c3); Which of the following statements is TRUE? a. The ALTER TABLE statement will fail b. The primary key will use the I4 unique index c. A primary index will need to be created on the composite key (C1,C3). d. An additional unique index will automatically be created on the composite key (C1,C3).

14. Which of the following can duplicate the structure and related objects of a database table? a. Copy table b. Alter table c. Export table d. Generate DDL

15. The table STOCK has the following column definitions: type CHAR(1) status CHAR(1) quantity INTEGER price DEC (7,2) items are indicated to be out of stock by setting STATUS to NULL and QUANTITY and PRICE to zero. Which of the following statements updates the STOCK table to indicate that all the items except for those with TYPE of "S" are temporarily out of stock? a. UPDATE stock SET status='NULL', quantity=0, price=0 WHERE type <> 'S' b. UPDATE stock SET (status, quantity, price) = (NULL, 0, 0) WHERE type <> 'S' c. UPDATE stock SET (status, quantity, price) = ('NULL', 0, 0) WHERE type <>'S' d. UPDATE stock SET status = NULL, SET quantity=0, SET price = 0 WHERE type <>'S'

16. Given the table: STAFF ID LASTNAME 1 Jones 2 Smith 3 <null> Which of the following statements removes all rows from the table where there is a NULL value for LASTNAME? a. DELETE FROM staff WHERE lastname IS NULL b. DELETE FROM staff WHERE lastname = 'NULL' c. DELETE ALL FROM staff WHERE lastname IS NULL d. DELETE ALL FROM staff WHERE lastname = 'NULL'

17. Given a read-only application that requires consistent data for every query, which of the following isolation levels should it use to provide the most concurrency with other applications doing updates?

Page 3 of 10

Page 4: DB2 700 Complete QA - 3

a. Read Stability b. Repeatable Read c. Cursor Stability d. Uncommitted Read

18. Which of the following is a valid wildcard character in a LIKE clause of a SELECT statement?

a. * b. _ c. @ d. ?

19. Given a large table with the following sample data: STAFF ID LASTNAME 1 Jones 2 Smith ... ... When issuing the query "SELECT * FROM staff", which of the following will always describe the order of the rows in the result set? a. An undetermined order b. Sorted by primary key c. The order in which rows were inserted into the table d. Sorted by the ID column, then by the LASTNAME column 20. Which two of the following SQL data types should be used to store double byte character data? a. CLOB b. CHAR c. DBCLOB d. GRAPHIC e. VARCHAR

21. Which of the following will give USER6 the ability to give SELECT privilege on table T.T1 to other users? a. GRANT SELECT ON TABLE t.t1 TO user6 b. GRANT ALL PRIVILEGES ON TABLE t.t1 TO user6 c. GRANT USE ON TABLE t.t1 TO user6 WITH GRANT OPTION d. GRANT ALL PRIVILEGES ON TABLE t.t1 TO user6 WITH GRANT OPTION

22.For which of the following database objects can locks NOT be obtained? a. A row b. A table c. A column d. An index key 23. Given that table T1 needs to hold specific numeric values up to 99999.99 in column C1. Which of the following would be the most exact definition for C1? a. REAL b. INTEGER c. NUMERIC(7,2) d. DECIMAL(5,2)

24. Which of the following has an object tree from which you can perform administrative tasks against database objects? a. Control Center b. Command Center c. Command Line Processor d. DB2 Administration Client

25. Given the following table definitions: DEPARTMENT deptno CHAR(3) deptname CHAR(30) mgrno INTEGER admrdept CHAR(3)

Page 4 of 10

Page 5: DB2 700 Complete QA - 3

EMPLOYEE empno INTEGER firstname CHAR(30) midinit CHAR lastname CHAR(30) workdept CHAR(3) Which of the following statements will produce a result set satisfying these criteria? The empno and lastname of every employee. For each employee, include the empno and lastname of their manager. Includes employees both with and without a manager a. SELECT e.empno, e.lastname FROM employee e LEFT OUTER JOIN (department INNER JOIN employee m ON mgrno = m.empno) ON e.workdept = deptno b. SELECT e.empno, e.lastname, m.empno, m.lastname FROM employee e LEFT INNER JOIN (department INNER JOIN employee m ON mgrno = m.empno) ON e.workdept = deptno c. SELECT e.empno, e.lastname, m.empno, m.lastname FROM employee e LEFT OUTER JOIN (department INNER JOIN employee m ON mgrno = m.empno) ON e.workdept = deptno d. SELECT e.empno, e.lastname, m.empno, m.lastname FROM employee e RIGHT OUTER JOIN (department INNER JOIN employee m ON mgrno = m.empno) ON e.workdept = deptno

26. Given the two table definitions: ORG deptnumb INTEGER deptname CHAR(30) manager INTEGER division CHAR(30) location CHAR(30) STAFF id INTEGER name CHAR(30) dept INTEGER job CHAR(20) years INTEGER salary DECIMAL(10,2) comm DECIMAL(10,2) Which of the following statements will display all departments, alphabetically by department name, and the name of the manager of each department? a. SELECT a.deptname, b.name FROM org a, staff b WHERE b.manager=a.id b. SELECT a.deptname, b.name FROM org a, staff b WHERE b.manager=a.id GROUP BY a.deptname, b.name c. SELECT a.deptname, b.name FROM org a, staff b WHERE a.manager=b.id ORDER BY a.deptname, b.name d. SELECT a.deptname, b.name FROM org a, staff b WHERE a.manager=b.id ORDER BY a.deptname, b.name e. SELECT a.deptname, b.name FROM org a, staff b WHERE a.manager=b.id GROUP BY b.name ORDER BY a.deptname

27. A stored procedure has been built and deployed on the DB2 UDB server machine. What is the minimum software that must be installed to allow an application on the client to execute the stored procedure? a. DB2 Runtime Client b. DB2 Personal Edition c. DB2 Administration Client d. DB2 Application Development Client

Page 5 of 10

Page 6: DB2 700 Complete QA - 3

28. Which of the following isolation levels will hold locks only on the rows in the answer set at the end of the query? a. Read Stability b. Repeatable Read c. Cursor Stability d. Uncommitted Read

29. Given the following tables: NAMES Name Number Wayne Gretzky 99 Jaromir Jagr 68 Bobby Orr 4 Bobby Hull 23 Brett Hull 16 Mario Lemieux 66 Steve Yzerman 19 Claude Lemieux 19 Mark Messier 11 Mats Sundin 13 POINTS Name Points Wayne Gretzky 244 Jaromir Jagr 168 Bobby Orr 129 Bobby Hull 93 Brett Hull 121 Mario Lemieux 189 PIM Name PIM Mats Sundin 14 Jaromir Jagr 18 Bobby Orr 12 Mark Messier 32 Brett Hull 66 Mario Lemieux 23 Joe Sakic 94 Which of the following statements will display the name, number, points and PIM for players with an entry in all three tables? a. SELECT names.name, names.number, points.points, pim.pim FROM names INNER JOIN points ON names.name=points.name INNER JOIN pim ON pim.name=names.name b. SELECT names.name, names.number, points.points, pim.pim FROM names OUTER JOIN points ON names.name=points.name OUTER JOIN pim ON pim.name=names.name c. SELECT names.name, names.number, points.points, pim.pim FROM names LEFT OUTER JOIN points ON names.name=points.name LEFT OUTER JOIN pim ON pim.name=names.name d. SELECT names.name, names.number, points.points, pim.pim FROM names RIGHT OUTER JOIN points ON names.name=points.name RIGHT OUTER JOIN pim ON pim.name=names.name

30. Given the following statements: CREATE TABLE tab1 (c1 CHAR(1)) INSERT INTO tab1 VALUES ('b') CREATE VIEW v1 AS SELECT c1 FROM tab1 WHERE c1='a' WITH CHECK OPTION INSERT INTO v1 VALUES ('a') INSERT INTO v1 VALUES ('b') How many rows would be returned from the statement, SELECT c1 FROM tab1? a. 0 b. 1

Page 6 of 10

Page 7: DB2 700 Complete QA - 3

c. 2 d. 3 e. 4

31. SQL source statements for which two of the following are stored in the system catalog? a. Views b. Tables c. Indexes d. Triggers e. Constraints

32. Given the following transaction in an embedded SQL application: CREATE TABLE dwaine.mytab (col1 INT, col2 INT) INSERT INTO dwaine.mytab VALUES (1,2) INSERT INTO dwaine.mytab VALUES (4,3) ROLLBACK What is the result of issuing the following statement? SELECT * FROM dwaine.mytab a. SQLCODE -204 indicating that "DWAINE.MYTAB" is an undefined name b. COL1 COL2 ------------ ----------- 0 record(s) selected. c. COL1 COL2 ------------ ----------- 1 2 1 record(s) selected. d. COL1 COL2 ------------ ----------- 1 2 4 3 2 record(s) selected.

33. A table called EMPLOYEE has the following columns: name, department, and phone_number. Which of the following can limit read access to the phone_number column? a. Using a view to access the table b. Using a referential constraint on the table c. Revoking access from the phone_number column d. Defining a table check constraint on the table

34. An application is using the Cursor Stability isolation level. Which of the following releases a row lock acquired by this application? a. When the cursor accessing the row is moved to the next row b. When the cursor accessing the row is used to update the row c. When the application's current row is deleted by the application d. When the application's current row needs to be updated by another application

35. Given a SELECT statement that has a GROUP BY clause. The HAVING clause uses the same syntax as which other clause? a. WHERE b. UNION c. SUBQUERY d. ORDER BY

36. A table has had check constraint enforcement turned off, and additional data has been inserted. Which of the following will perform data validation to ensure that column values are valid? a. Add a trigger b. Collect statistics c. Reorganize the table d. Enable check constraints

37. Given the table COUNTRY and the statements below: COUNTRY

Page 7 of 10

Page 8: DB2 700 Complete QA - 3

ID NAME PERSON_ID CITIE 1 Argentina 1 10 2 Canada 2 20 3 Cuba 2 10 4 Germany 1 0 5 France 7 5 DECLARE c1 CURSOR WITH HOLD FOR SELECT * FROM country ORDER BY person_id, name OPEN c1 FETCH c1 FETCH c1 COMMIT FETCH c1 Which of the following is the last name obtained from the table? a. Cuba b. France c. Canada d. Germany e. Argentina

38. A stored procedure has been created with the following statement: CREATE PROCEDURE P1(IN VAR1 INTEGER, OUT VAR2 VARCHAR(10))... From the command line processor (CLP), which is the correct way to invoke this procedure? a. RUN P1 (10, ?) b. CALL P1 (10, ?) c. SELECT P1 (10, ?) d. EXECUTE P1 (10, ?)

39. USER2 has SELECT WITH GRANT OPTION on APPL.TAB1. Which of the following statements is USER2 authorized to execute? a. GRANT INSERT ON TABLE appl.tab1 TO user8 b. GRANT SELECT ON TABLE appl.tab1 TO user8 c. GRANT REFERENCES ON TABLE appl.tab1 user8 d. GRANT ALL PRIVILEGES on TABLE appl.tab1 TO user8

40. USER3 is running a program A.APP1 that calls stored procedure P.PROC1. As an administrator, which of the following statements should be executed to give USER3 the appropriate privilege to be able to execute the code found in stored procedure P.PROC1? a. GRANT EXECUTE ON PACKAGE a.app1 TO user3 b. GRANT EXECUTE ON PROCEDURE a.app1 TO user3 c. GRANT EXECUTE ON FUNCTION p.proc1 TO user3 d. GRANT EXECUTE ON PROCEDURE p.proc1 TO user3

41. Given the following statement: CREATE TABLE t1 (c1 CHAR(4) NOT NULL) Which of the following can be inserted into this table? a. 4 b. NULL c. 'abc' d. 'abcde' 42. Which of the following processes is NOT performed by DB2 Warehouse Manager? a. Query b. Loading c. Extraction d. Transformation

43. Given the tables: COUNTRY ID NAME PERSON CITIES 1 Argentina 1 10 2 Canada 2 20 3 Cuba 2 10 4 Germany 1 0 5 France 7 5

Page 8 of 10

Page 9: DB2 700 Complete QA - 3

STAFF ID LASTNAME 1 Jones 2 Smith How many rows would be inserted into the STAFF table using the following statement? INSERT INTO staff SELECT person, 'Greyson' FROM country WHERE person > 1 a. 0 b. 1 c. 2 d. 3 d. 5

44. Which of the following statements will create an index and prevent table T1 from containing two or more rows with the same values for column C1? a. CREATE UNIQUE INDEX ix1 ON t1 (c1) b. CREATE DISTINCT INDEX ix1 ON t1 (c1) c. CREATE UNIQUE INDEX ix1 ON t1 (c1,c2) d. CREATE DISTINCT INDEX ix1 ON t1 (c1,c2)

45. Which of the following can be used to store images in a DB2 database? a. DB2 AVI Extender b. DB2 XML Extender c. DB2 Test Extender d. DB2 Spatial Extender

46. Given the following table definition and SQL statements: CREATE TABLE table1 (col1 INT, col2 CHAR(40), col3 INT) GRANT INSERT, UPDATE, SELECT, REFERENCES ON TABLE table1 TO USER usera Which of the following SQL statements will revoke the privileges granted to user USERA on COL1 and COL2? a. REVOKE UPDATE ON TABLE table1 FROM USER usera b. REVOKE ALL PRIVILEGES ON TABLE table1 FROM USER usera c. REVOKE ALL PRIVILEGES ON TABLE table1 COLUMNS (col1, col2) FROM usera d. REVOKE REFERENCES ON TABLE table1 COLUMNS (col1, col2) FROM USER usera

47. A user creates the table TABLE1 with a referential constraint defined over column COL1. Which of the following statements would explicitly give USER1 the ability to read rows from the table? a. GRANT SELECT ON TABLE table1 TO user1 b. GRANT ACCESS ON TABLE table1 TO user1 c. GRANT REFERENCES TO user1 ON TABLE table1 d. GRANT UPDATE (col1) TO user1 ON TABLE table1

48. A business has a requirement that a row not be deleted from the parent table if a row with the corresponding key value still exists in the child table. Which of the following delete rules would enforce this requirement? a. DELETE b. CASCADE c. RESTRICT d. SET NULL

49. Given the following SQL statement: GRANT EXECUTE ON PACKAGE proc1 TO usera WITH GRANT OPTION Which two of the following describe what USERA is allowed to do? a. Execute SQL statements in package PROC1 b. Grant any privilege on package PROC1 to other users c. Grant bind privilege on package PROC1 to other users d. Grant execute privilege on package PROC1 to other users e. Access all of the tables referenced in package PROC1 from any program

50. What is the difference between a unique index and a primary key? a. They are different terms for the same concept. b. Unique indexes can be defined over multiple columns. Primary keys must have only one

Page 9 of 10

Page 10: DB2 700 Complete QA - 3

column. c. Unique indexes can be defined in ascending or descending order. Primary keys must be ascending. d. Unique indexes can be defined over a column or columns that allow nulls.Primary keys cannot contain nulls.

51. When constraint checking is suspended or disabled, a table or table space (depending on platform) is placed in which of the following states? a. Paused b. Check pending c. Intent locked d. Constraint waiting

52. Given the following statements: CREATE TABLE tab1 (a INT, b INT, c INT, CHECK (a > 200)) CREATE VIEW v1 AS SELECT a, b, c FROM tab1 WHERE a > 250 Which of the following statements will fail? a. INSERT INTO v1 VALUES (250, 2, 3) b. INSERT INTO v1 VALUES (300, 2, 3) c. INSERT INTO tab1 VALUES (200, 2, 3) d. INSERT INTO tab1 VALUES (250, 2, 3)

53. Which of the following statements eliminates all but one of each set of repeated rows in the final result table? a. SELECT UNIQUE * FROM t1 b. SELECT DISTINCT * FROM t1 c. SELECT * FROM DISTINCT T1 d. SELECT UNIQUE (*) FROM t1 e. SELECT DISTINCT (*) FROM t1

54. Which of the following DDL statements creates a table where employee IDs are unique? a. CREATE TABLE t1 (employid INTEGER) b. CREATE TABLE t1 (employid INTEGER GENERATED BY DEFAULT AS IDENTITY) c. CREATE TABLE t1 (employid INTEGER NOT NULL) d. CREATE TABLE t1 (employid INTEGER NOT NULL PRIMARY KEY)

55. A declared temporary table is used for which of the following purposes? a. To store intermediate results b. To share result sets between applications c. To provide an area for database manager sorts d. To create a backup copy of a database or table space_________________

Page 10 of 10