• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
DB2 703
 

DB2 703

on

  • 1,044 views

DB2 703

DB2 703

Statistics

Views

Total Views
1,044
Views on SlideShare
1,044
Embed Views
0

Actions

Likes
2
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    DB2 703 DB2 703 Document Transcript

    • Exam Code: 000-703DB2 UDB V8.1 Family Application Development1. Given the following code:EXEC SQL EXECUTE IMMEDIATE :sqlstmtWhich of the following values must sqlstmt contain so that all rows are deleted from the STAFF table?A. DROP TABLE staffB. DELETE FROM staffC. DROP * FROM staffD. DELETE * FROM staffAnswer: B2. Given the code:EXEC SQL DECLARE cursor1 CURSOR FORSELECT name, age, b_date FROM person;EXEC SQL OPEN cursor1;Under which of the following situations will the above cursor be implicitly closed?A. When a CLOSE statement is issuedB. When a COMMIT statement is issuedC. When there are no rows in the result setD. When all rows are FETCHed from the result setAnswer: B3. To prepare an embedded SQL program for use with a host-language compiler, which of the following database components isrequired?A. BinderB. PrecompilerC. Stored Procedure BuilderD. Application Development CenterAnswer: B4. An ODBC/CLI application has the following pseudocode:SQLAllocHandle( SQL_HANDLE_DBC, hEnv, &hDbc )SQLConnect( hDbc, "CERTDB", SQL_NTS, "user1", SQL_NTS, "passwd", SQL_NTS )SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt )SQLExecDirect( hStmt, "SET CURRENT SQLID db2cert", SQL_NTS )Assuming all of the above calls execute successfully, which of the following fully qualified SQL statements is equivalent to:SQLExecDirect( hStmt, "SELECT * FROM user1.table1 t1, table2 t2 WHERE t1.col1=t2.col2", SQL_NTS )A. SQLExecDirect( hStmt, "SELECT * FROM user1.table1 t1, table2 t2 WHERE t1.col1=t2.col2", SQL_NTS )B. SQLExecDirect( hStmt, "SELECT * FROM user1.table1 t1, user1.table2 t2 WHERE t1.col1=t2.col2", SQL_NTS )C. SQLExecDirect( hStmt, "SELECT * FROM user1.table1 t1, db2cert.table2 t2 WHERE t1.col1=t2.col2", SQL_NTS )D. SQLExecDirect( hStmt, "SELECT * FROM db2cert.table1 t1, db2cert.table2 t2 WHERE t1.col1=t2.col2", SQL_NTS )Answer: C5. Given the EMPLOYEE table definition:CREATE TABLE employee (workdept CHAR(30),salary INTEGER)Which of the following is a correct usage of parameter markers in a JDBC program?
    • A. String sql ="UPDATE employee SET salary = salary * ? WHERE workdept = ?";Statement stmt = con.createStatement(sql);B. String sql ="UPDATE employee SET salary = salary * ? WHERE workdept = ?";Statement stmt = con.createStatement(sql);C. String sql ="UPDATE employee SET salary = salary * ? WHERE workdept = ?";PreparedStatement ps = con.preparedStatement(sql);D. String sql ="UPDATE employee SET salary = salary * ? WHERE workdept = ?";PreparedStatement ps = con.preparedStatement(sql);Answer: C6. Given the following code:BEGIN ATOMICUPDATE country SET cities = :count WHERE CURRENT OF C1;INSERT INTO country VALUES (:col1, :col2, :col3);INSERT INTO country VALUES (:col4, :col5, :col6);INSERT INTO country VALUES (:col7, :col8, :col9);INSERT INTO country VALUES (:col10, :col11, :col12);COMMIT;ENDGiven that all statements succeed except the following:INSERT INTO country VALUES (:col7, :col8, :col9);How many rows will be affected in table COUNTRY?A. 0B. 3C. 4D. 5Answer: A7. The following commands are issued against a data source containing table user2.org:CREATE ALIAS user1.org FOR sample.orgCREATE TABLE org.sample ( c CHAR(1))CREATE ALIAS sample.org FOR user2.orgCREATE ALIAS user2.sample FOR sample.orgGiven the user SAMPLE issues the following statement:SELECT * FROM sampleFor which of the following database objects will access be attempted?A. user2.orgB. org.sampleC. sample.orgD. sample.sampleAnswer: D8. The following commands are issued against a data source:CREATE TABLE userid.org ( i INT)CREATE ALIAS user1.org FOR userid.orgCREATE TABLE org.sample ( c CHAR(1))CREATE ALIAS sample.org FOR userid.orgCREATE ALIAS userid.sample FOR sample.orgWhen issued by USER1, which of the following statements will have a different result set than this SELECT statement?SELECT * FROM orgA. SELECT * FROM org.sampleB. SELECT * FROM sample.orgC. SELECT * FROM userid.orgD. SELECT * FROM userid.sampleAnswer: A9. An application uses embedded dynamic SQL to connect to a remote DB2 server and inserts data into the CUST.ORDERS table on
    • that remote DB2 server. To enable access of the remote DB2 server, Administrator FOO needs to create a package with defaultoptions such that BAR is the only non-administrative user that can use this package on the remote DB2 server.Which statement describes the privileges that must be granted and/or revoked by FOO to accomplish this?A. BAR requires EXECUTE privilege on the package and UPDATE privilege on CUST.ORDERS, and the EXECUTE privilege forthe package must be revoked from PUBLIC.B. BAR requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS, and the EXECUTE privilege for thepackage must be revoked from PUBLIC.C. BAR requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS, and the REFERENCES privilegefor the package must be revoked from PUBLIC.D. BAR requires EXECUTE privilege on the package and UPDATE privilege on CUST.ORDERS, and the REFERENCES privilegefor the package must be revoked from PUBLIC.Answer: B10. User FOO must create and own an SQL stored procedure, CUST.CALC1, that returns a calculation using static SQL. Both userFOO and user BAR need to call this stored procedure from each of their applications.Assuming FOO has the necessary privileges to perform the calculation, which two of the following statements describe theMINIMUM privileges that must be explicitly granted for users BAR and FOO?A. BAR needs EXECUTE privilege on the CALC1 packageB. BAR needs EXECUTE privilege on the CALC1 procedureC. FOO needs EXECUTE privilege on the CALC1 procedureD. FOO and BAR need EXECUTE privilege on the CALL statementE. FOO needs the privilege to create the procedure in the CUST schemaAnswer: BE11. An application uses static SQL to connect to a remote DB2 server and inserts data into the CUST.ORDERS table on that remoteDB2 server. To enable access to the remote DB2 server, FOO needs to create a package with default options so that BAR is the onlynon-administrative user that can use this package on the remote DB2 server.Which statement describes the privileges that FOO requires to accomplish this?A. FOO requires EXECUTE privilege on the package.B. FOO requires the privilege to create the package on the remote DB2 server.C. FOO requires EXECUTE privilege on the package and INSERT privilege on CUST.ORDERS.D. FOO requires the privilege to create the package on the remote DB2 server and INSERT privilege on CUST.ORDERS.Answer: D12. Which of the following privileges is required to successfully execute a Java stored procedure that uses JDBC to update severaldifferent tables?A. The user must have UPDATE privilege on the referenced tables.B. The developer must have EXECUTE privilege on the stored procedure.C. The user must have UPDATE privilege on the referenced tables and EXECUTE privilege on the stored procedure.D. The developer must have UPDATE privilege on the referenced tables and EXECUTE privilege on the stored procedure.Answer: C13. Given the table T1, created using the following statement:CREATE TABLE t1(id INTEGER GENERATED BY DEFAULT AS IDENTITY,c1 CHAR(3))The following SQL statements are issued:INSERT INTO t1 VALUES (2, def)INSERT INTO t1 VALUES (DEFAULT, abc)INSERT INTO t1 VALUES (DEFAULT, ghi)Which of the following represents the order in which the values are returned from the following SELECTstatement? SELECT id FROM t1 ORDER BY idA. 1, 2, 2B. 1, 2, 3C. 2, 3, 4D. 0, 1, 2Answer: A
    • 14. Given the following table (C1 is INTEGER):T1C14321and the stored procedure definition:CREATE PROCEDURE proc(OUT o1 INT)READS SQL DATA LANGUAGE SQLBEGINDECLARE v1, v2, v3 INTEGER;DECLARE cur1 CURSOR FORSELECT c1 FROM t1 ORDER BY c1;DECLARE EXIT HANDLER FOR NOT FOUNDSET o1 = v1;OPEN cur1;FETCH cur1 INTO v2;FETCH cur1 INTO v3;SET v1 = v2*2 + v3;fetch_loop:LOOPSET v2 = v3;FETCH cur1 INTO v3;SET v1 = v1 + v2*2 + v3;END LOOP fetch_loop;ENDIf the CALL proc(:hv) statement is embedded in an application, what is the value of :hv after it executes?A. 20B. 21C. 24D. 25Answer: B15. Which two of the following can be used to retrieve the current date from the DB2 Command Line Processor?A. ? CURRENT DATEB. VALUES CURRENT DATEC. CREATE CURRENT DATED. SELECT CURRENT TIME FROM SYSIBM.DUALE. SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1Answer: BE16. Which of the following produces a sequentially increasing number, suitable for use as a primary key?A. ROWID data typeB. Generated IDENTITY columnC. GENERATE_UNIQUE built-in functionD. CURRENT SEQUENCE special registerAnswer: B17. Given the tables, the relationships and the statements:EMPLOYEE DEPTemp_num emp_name dept dept_id dept_name1 Adams 1 1 Planning2 Jones 1 2 Support3 Smith 24 Williams 1Relationship: employee.dept is a foreign key on dept.dept_id.stmt = "INSERT INTO employee VALUES (5,Jones,3)";EXEC SQL EXECUTE IMMEDIATE :stmt;stmt = "INSERT INTO employee VALUES (6,Johnson,2)";
    • EXEC SQL EXECUTE IMMEDIATE :stmt;How many rows are successfully inserted?A. One row is inserted in EMPLOYEEB. No rows are inserted in EMPLOYEEC. Two rows are inserted in EMPLOYEED. One row is inserted in DEPT and 2 rows are inserted in EMPLOYEEAnswer: A18. Given the tables:EMPLOYEE DEPTemp_num emp_name dept dept_id dept_name1 Adams 1 1 Planning2 Jones 1 2 Support3 Smith 24 Williams 1and the statement:ALTER TABLE employeeADD FOREIGN KEY (dept) REFERENCES dept (dept_id)ON DELETE CASCADEHow many rows will be deleted when the following statement is executed?DELETE FROM employee WHERE dept=1A. 0B. 1C. 3D. 4Answer: C19. Given the tables:COUNTRYid name1 Argentina3 Cuba4-NATIONid name2 Belgium4 USAand the code:EXEC SQL DECLARE C1 CURSOR FORSELECT * FROM country WHERE name IS NOT NULLUNIONSELECT * FROM nationEXEC SQL OPEN C1How many rows are in the result set?A. 1B. 2C. 3D. 4E. 5Answer: D20. Given the tables:COUNTRY STAFFid name person cities id name1 Argentina 1 10 1 Aaron2 Canada 2 20 2 Adams3 Cuba 2 10 3 Jones4 Germany 1 05 France 3 56 Italy 1 5the report:
    • id name number_of_countries1 Aaron 3and the SQL statement:SELECT B.id,B.name,COUNT(DISTINCT A.name) AS number_of_countriesFROM country A, staff BWHERE B.id=A.personGROUP BY B.id,B.nameHAVING COUNT(DISTINCT A.name)>:count_varWhich of the following values does :count_var require to print out the above report?A. 1B. 2C. 3D. 4Answer: B21. Given the tables T1 and T2, each containing an integer column COL1:T1COL11-1-22T2COL11-2-22and the following query that executes successfully:SELECT COUNT(*) FROM t1 RIGHT OUTER JOIN t2 ON t1.col1=t2.col1How many rows are returned?A. 1B. 6C. 8D. 36Answer: A22. Given the tables T1 and T2, each with an INTEGER column:T1COL11-1-22T2COL11-2
    • 22and the following query that executes successfully:SELECT * FROM T1 LEFT OUTER JOIN T2 ON T1.COL1=T2.COL1How many rows will the query return?A. 5B. 6C. 10D. 36Answer: C23. Given the following statements:EXEC SQL INSERT INTO employee VALUES(:new_emp, :new_name)EXEC SQL UPDATE company SET num_employees=num_employees+1WHERE company_id=1EXEC SQL COMMITWhich of the following can be added to the database so that the company table will still be updated without the need for the explicitUPDATE SQL statement?A. An INSERT trigger on COMPANYB. An UPDATE trigger on COMPANYC. An INSERT trigger on EMPLOYEED. An UPDATE trigger on EMPLOYEEAnswer: C24. Which of the following CLI/ODBC functions should be used to delete rows from a DB2 table?A. SQLDelete()B. SQLExecDirect()C. SQLBulkDelete()D. SQLExecuteUpdate()Answer: B25. Which of the following methods must be used for deleting a row using the Statement interface in JDBC?A. delete()B. execute()C. executeUpdate()D. executeDelete()Answer: C26. Given the tables T1 and T2 with INTEGER columns:T1COL11-1-22T2COL11-2-22and the following statement that executes successfully:DELETE FROM t1 WHERE col1 IN (SELECT * FROM t2)How many rows will be left in T1 after running this statement?A. 0
    • B. 2C. 3D. 6Answer: B27. An ODBC/CLI application performs an array insert into a table containing a primary key. If one of the values inserted generates aduplicate row error, which of the following APIs can be called to determine the failing row?A. SQLError()B. SQLNumRows()C. SQLRowCount()D. SQLGetDiagField()Answer: D28. Which of the following is a benefit of user-defined functions?A. Improves application concurrencyB. Improves blocking of result setsC. Simplifies application maintenanceD. Reduces memory requirements on the serverAnswer: C29. Given the table called NAME with the following column and data:lnameSmithSMITHSmiThsmithWhich of the following SQL statements will return all four rows in uppercase?A. SELECT CAPS(lname) FROM nameB. SELECT UCASE(lname) FROM nameC. SELECT STRUPR(lname) FROM nameD. SELECT TOUPPER(lname) FROM nameAnswer: B30. Given the following table:CREATE TABLE employee(name CHAR(10), salary DEC NOT NULL WITH DEFAULT)INSERT INTO employee (name, salary) VALUES (SMITH,30000) INSERT INTO employee (name) VALUES (JONES)INSERT INTO employee (name, salary) VALUES (ALI, 35000)Which of the following statements will retrieve more than one row?A. SELECT salary FROM employee WHERE salary IN (SELECT (salary/(SELECT SUM(salary) FROM employee)) FROMemployee)B. SELECT COALESCE(AVG(salary)) FROM employeeC. SELECT SUM(salary)/COUNT(*) FROM employeeD. SELECT salary/(SELECT SUM(salary) FROM employee) FROM employeeAnswer: D31. Which of the following will retrieve results that will only be in lower case?A. SELECT NAME FROM EMPLOYEE WHERE NAME=aliB. SELECT NAME FROM EMPLOYEE WHERE LCASE(NAME)=aliC. SELECT UCASE(NAME) FROM EMPLOYEE WHERE LCASE(NAME)=aliD. SELECT NAME FROM EMPLOYEE WHERE NAME IN (SELECT NAME FROM EMPLOYEE WHERELCASE(NAME)=LCASE(ALI))Answer: A32. Given the expression:WITH most_cities AS ( SELECT b.id,b.name,a.cities
    • FROM country a, staff bWHERE a.person = b.id ANDcities > :threshold)SELECT * FROM most_citiesIn which of the following does MOST_CITIES exist?A. user tablesB. server memoryC. user table spaceD. system catalog tablesAnswer: B33. Given the code:EXEC SQL WITH most_cities AS(SELECT b.id, b.name, a.citiesFROM country a, staff bWHERE a.person = b.id ANDcities > :threshold)SELECT id, name, cities FROM most_citiesINTO :id, :name, :citiesWHERE cities IN (SELECT MAX(cities) FROM most_cities)Which of the following can reference MOST_CITIES?A. The current statementB. Statements from any applicationC. All statements within this applicationD. All statements within the current unit of workAnswer: A34. If a stored procedure returns multiple rows, which of the following must the calling application use to access the result set?A. A cursorB. A select statementC. A declared temporary tableD. A table user-defined functionAnswer: A35. How many rows can be retrieved using a single SELECT INTO statement?A. Only one rowB. As many as are in the resultC. As many as are host variables used in the callD. As many as host variable array structures can holdAnswer: A36. A cursor is declared with the WITH HOLD option. Which of the following statements is always true?A. The cursor will remain open after a COMMIT.B. All rows retrieved are locked until a COMMIT.C. A COMMIT will not be allowed until the cursor is closed.D. Locks obtained by the cursor will be kept after a COMMIT.Answer: A37. Which of the following is TRUE for all cursors defined as FOR FETCH ONLY?A. The cursors are unambiguous.B. Only the first row is returned.C. Cursor stays open after a commit.D. A temporary table is created on the server.Answer: A38. Given the application code:EXEC SQL DECLARE cur CURSOR WITH HOLD FOR SELECT c1 FROM t1EXEC SQL OPEN cur
    • EXEC SQL FETCH cur INTO :hv /* Statement 1 */EXEC SQL COMMIT /* Statement 2 */EXEC SQL FETCH cur INTO :hv /* Statement 3 */EXEC SQL ROLLBACK /* Statement 4 */EXEC SQL CLOSE cur /* Statement 5 */If the table T1 has no rows in it, which statement will cause the cursor "cur" to be closed first?A. Statement 1B. Statement 2C. Statement 3D. Statement 4E. Statement 5Answer: D39. Given the table T1 with the following data:C1ABCDEand the application code:EXEC SQL DECLARE cur1 CURSOR WITH HOLD FORSELECT c1 FROM t1 ORDER BY c1EXEC SQL DECLARE cur2 CURSOR WITH HOLD FORSELECT c1 FROM t1 ORDER by c1EXEC SQL OPEN cur1EXEC SQL OPEN cur2EXEC SQL FETCH cur1 INTO :hvEXEC SQL FETCH cur1 INTO :hvEXEC SQL FETCH cur2 INTO :hvEXEC SQL COMMITEXEC SQL FETCH cur2 INTO :hvEXEC SQL FETCH cur2 INTO :hvEXEC SQL FETCH cur1 INTO :hvEXEC SQL CLOSE cur2EXEC SQL CLOSE cur1What is the final content of the host variable "hv"?A. AB. BC. CD. DAnswer: C40. Given the following table:TestTableC112345And if the following CLI calls are made:SQLAllocHandle( SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv ) ;SQLSetEnvAttr( henv,SQL_ATTR_ODBC_VERSION,( SQLPOINTER ) SQL_OV_ODBC3, 0 ) ;SQLAllocHandle( SQL_HANDLE_DBC, henv, &hdbc ) ;SQLConnect( hdbc,(SQLCHAR *)"db", SQL_NTS,
    • (SQLCHAR *)"userid", SQL_NTS,(SQLCHAR *)"password", SQL_NTS);SQLSetConnectAttr( hdbc,SQL_ATTR_AUTOCOMMIT,SQL_AUTOCOMMIT_OFF,0);SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt ) ;SQLPrepare( hstmt, (unsigned char*)"select * from Test order by C1", SQL_NTS);SQLBindCol( hstmt, 1, SQL_C_SHORT, &data,0, NULL);SQLExecute( hstmt );SQLFetch( hstmt );printf( "Data: %in", data);SQLFetch( hstmt );printf( "Data: %in", data);SQLFetch( hstmt );printf( "Data: %in", data);SQLEndTran(SQL_HANDLE_ENV, henv, SQL_COMMIT);SQLFetch( hstmt );printf( "Data: %in", data);Which of the following will be returned by the program?A. Data: 1Data: 2Data: 3Data: 3B. Data: 1Data: 2Data: 3Data: 4C. Data: 1Data: 2Data: 3Data: 1D. Data: 1Data: 2Data: 3Data: 5Answer: B41. Given the table COUNTRY with the following data:ID NAME PERSON CITIES1 Argentina 1 -and the code:EXEC SQL DECLARE c1 CURSOR FOR SELECT id, name FROM country;EXEC SQL OPEN c1;EXEC SQL FETCH c1 INTO :id, :name;EXEC SQL FETCH c1 INTO :id, :name;Which of the following SQLCODE/SQLSTATEs will be contained in the SQLCA after the last fetch?A. SQLCODE 0, SQLSTATE 00000B. SQLCODE 100, SQLSTATE 02000C. SQLCODE -100, SQLSTATE 00100D. SQLCODE -501, SQLSTATE 24501Answer: B42. Which of the following cursor definitions will define a cursor called c2 that will fetch rows from table t2, and for every rowfetched will update column c1 in table t2?A. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF t2B. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF c2C. DECLARE c2 CURSOR FOR SELECT * FROM t2 FOR UPDATE OF c1D. DECLARE c2 CURSOR WITH HOLD FOR SELECT * FROM t2 FOR UPDATE OF t2Answer: C
    • 43. Given the table T1 with the following data:C1 C21122An application issues the following SQL statements with AUTOCOMMIT disabled:UPDATE t1 SET c1 = 10 WHERE c2 = 1UPDATE t1 SET c1 = 20 WHERE c2 = 2SAVEPOINT sp1UPDATE t1 SET c1 = 30 WHERE c2 = 1UPDATE t1 SET c1 = 40, c2 = 3 WHERE c2 = 2SAVEPOINT sp1UPDATE t1 SET c1 = 50 WHERE c2 = 1UPDATE t1 SET c1 = 60 WHERE c2 = 2ROLLBACK TO SAVEPOINT sp1UPDATE t1 SET c1 = 50 WHERE c2 = 3COMMITWhat is the result of the following query?SELECT c1, c2 FROM t1 ORDER BY c2A. 10 120 2B. 30 150 3C. 30 140 3D. 10 150 3Answer: B44. Given the table T1 containing an INTEGER column:C11A multithreaded ODBC/CLI application successfully executes the following pseudocode in sequence:Thread 1: SQLConnect( hDbc1, "CERTDB", SQL_NTS, "", NULL, "", NULL );Thread 2: SQLConnect( hDbc2, "CERTDB", SQL_NTS, "", NULL, "", NULL );Thread 1: SQLSetConnectAttr( hDbc1, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_ON );Thread 2: SQLSetConnectAttr( hDbc2, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF );Thread 1: SQLAllocHandle( SQL_HANDLE_STMT, hDbc1, &hStmt1 );Thread 2: SQLAllocHandle( SQL_HANDLE_STMT, hDbc2, &hStmt2 );Thread 1: SQLExecDirect( hStmt1, "SAVEPOINT sp1 ON ROLLBACK RETAIN CURSORS", SQL_NTS );Thread 1: SQLExecDirect( hStmt1, "INSERT INTO T1 VALUES (2)", SQL_NTS );Thread 2: SQLExecDirect( hStmt2, "SAVEPOINT sp1 ON ROLLBACK RETAIN CURSORS", SQL_NTS );Thread 2: SQLExecDirect( hStmt2, "INSERT INTO T1 VALUES (3)", SQL_NTS );Thread 1: SQLExecDirect( hStmt1, "INSERT INTO T1 VALUES (4)", SQL_NTS );Thread 2: SQLExecDirect( hStmt2, "ROLLBACK TO SAVEPOINT sp1", SQL_NTS );Thread 2: SQLExecDirect( hStmt2, "INSERT INTO T1 VALUES (5)", SQL_NTS );Thread 1: SQLEndTran( SQL_HANDLE_DBC, hDbc1, SQL_ROLLBACK );Which result set would be returned by:Thread 2: SQLExecDirect( hStmt2, "SELECT c1 FROM t1 ORDER BY C1", SQL_NTS );A. 1,5B. 1,2,5C. 1,2,4,5D. 1,2,3,4Answer: C45. Given an ODBC/CLI program with a single connection, two threads and the following actions which complete successfully:Thread 1: INSERT INTO mytab VALUES (1)Thread 2: INSERT INTO mytab VALUES (2)Thread 1: COMMITThread 2: INSERT INTO mytab VALUES (3)
    • Thread 1: ROLLBACKThread 2: COMMITHow many records will be inserted and retained in the table MYTAB?A. 0B. 1C. 2D. 3Answer: C46. Which of the following database resources can be freed when a unit of work is committed?A. row locksB. cursor namesC. buffer poolsD. cursors WITH HOLDAnswer: A47. Given the table T1 with the following data:COL1 IDX-1-2A single-threaded CLI application executes the following pseudocode in sequence:SQLAllocHandle( SQL_HANDLE_ENV, NULL, &hEnv )SQLAllocHandle( SQL_HANDLE_DBC, hEnv, &hDbc )SQLConnect( hDbc, "SAMPLE", SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS )SQLSetConnectAttr( hDbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_ON )SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt )SQLExecDirect( hStmt, "UPDATE table1 SET col1=10 WHERE idx=1", SQL_NTS )SQLExecDirect( hStmt, "UPDATE table1 SET col1=20 WHERE idx=2", SQL_NTS )SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_COMMIT )SQLExecDirect( hStmt, "UPDATE table1 SET col1=30 WHERE idx=1", SQL_NTS )SQLExecDirect( hStmt, "UPDATE table1 SET col1=40 WHERE idx=1", SQL_NTS )SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_ROLLBACK )SQLExecDirect( hStmt, "SELECT col1 FROM table1 WHERE idx=1", SQL_NTS )Which of the following values for COL1 will be fetched when the sequence for the pseudocode listed above is successfully executed?A. 10B. 20C. 30D. 40Answer: D48. Given the table T1 with two INTEGER columns and the following data:col1 idx-1-2A single-threaded CLI application executes the following pseudocode in sequence:SQLConnect( hDbc, "CERTDB", SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS )SQLSetConnectAttr( hDbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_ON )SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt )SQLExecDirect( hStmt, "UPDATE table1 SET col1=10 WHERE idx=1", SQL_NTS )SQLExecDirect( hStmt, "UPDATE table1 SET col1=20 WHERE idx=2", SQL_NTS )SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_ROLLBACK )SQLExecDirect( hStmt, "SAVEPOINT sp1 ON ROLLBACK RETAIN CURSORS", SQL_NTS )SQLExecDirect( hStmt, "UPDATE table1 SET col1=30 WHERE idx=1", SQL_NTS )SQLExecDirect( hStmt, "ROLLBACK TO SAVEPOINT sp1", SQL_NTS )SQLEndTran( SQL_HANDLE_DBC, hDbc, SQL_COMMIT )SQLExecDirect( hStmt, "SELECT col1 FROM table1 WHERE idx=1", SQL_NTS )Which of the following values for COL1 will be fetched when the sequence for the pseudocode listed above is successfullyexecuted?A. -B. 10
    • C. 20D. 30Answer: D49. Under which of the following situations must dynamic SQL be used?A. When temporary table references exist at compile timeB. When the host variables values are unknown at compile timeC. When the columns in the SELECT clause are unknown at compile timeD. When the number of rows being returned are unknown at compile timeAnswer: C50. Which of the following is used to run an embedded dynamic SQL UPDATE statement?A. UPDATEB. PREPAREC. DECLARED. EXECUTEAnswer: D51. Which of the following indicates when ODBC must be used instead of embedded SQL?A. When a precompiler is unavailableB. When a TYPE 2 connection is requiredC. When multiple data sources are accessedD. When DB2 UDB for OS/390 or iSeries is accessedAnswer: A52. Which of the following programming interfaces minimizes client-server communication traffic by chaining PREPARE andEXECUTE requests together by default?A. ODBC/CLIB. SQL RoutinesC. Static Embedded SQLD. Dynamic Embedded SQLAnswer: A53. A programmer wants to create an applet that connects to a DB2 UDB database from the web browser. Which two of the followingcan be used?A. CLIB. SQLJC. JDBCD. ODBCE. OLEDBAnswer: BC54. Which programming language must be used to code SQLJ stored procedures?A. JavaB. COBOLC. C/C++D. SQL/PSMAnswer: A55. Which of the following components is required to convert an embedded SQL source file into a valid host language source file?A. BinderB. PrecompilerC. Host language linkerD. Host language compilerAnswer: B56. Which two of the following embedded SQL statements contain host variables?A. CONNECT TO sample USER :userid USING :passwdB. SELECT tabschema, tabname FROM syscat.tables WHERE tabname=?C. DECLARE c1 CURSOR FOR SELECT dept FROM staff WHERE job=MGRD. DECLARE c1 CURSOR FOR SELECT * FROM employee WHERE lastname=?
    • E. SELECT workdept INTO :wd :wdind FROM employee WHERE lastname = SMITHAnswer: AE57. Host variables must be defined inside which of the following in order to be used in an embedded SQL program?A. DECLARE sectionB. SQL INCLUDE fileC. EXEC SQL sectionD. Function declarationAnswer: A58. A column is defined as INTEGER and contains the following values in no particular order:-1, 0, 1, NULLHow many host variables must be included in a DECLARE section in order to select all the values into the program one row at a time?A. 1B. 2C. 3D. 4Answer: B59. When declaring an indicator host variable, which of the following data types must be used?A. Small integerB. Fixed characterC. Float (double precision)D. Variable length characterAnswer: A60. Which of the following can modify the contents of host variables within a program?A. Only SQL statementsB. Only using the DECLARE sectionC. Program statements and SQL statementsD. Program statements but not SQL statementsAnswer: C61. Given the declaration in an SQLJ program:String var1=null;String var2=null;Which of the following statements illustrates the correct usage of host variables?A. #sql {UPDATE mytable SET col1=var1 WHERE col2=?}B. #sql {SELECT col1 INTO ? FROM mytable WHERE col2=?}C. #sql {UPDATE mytable SET col1=var1 WHERE col2=var2}D. #sql {SELECT col1 INTO :var1 FROM mytable WHERE col2=:var2}Answer: D62. Which of the following SQLCA elements contains platform independent values?A. sqlcodeB. sqlerrpC. sqlwarnD. sqlstateAnswer: D63. Which of the following SQLCA elements can contain text strings which are used to send messages to an application?A. sqlerrpB. sqlerrdC. sqlerrmlD. sqlerrmcAnswer: D64. Given the following embedded SQL code:EXEC SQL SET CONNECTION sampleWhat is the expected result upon successful execution?A. The previous connection is closed.
    • B. The CURRENT SERVER special register is cleared.C. A new connection to the alias "sample" is established.D. The existing connection state for alias "sample" is changed from dormant to current.Answer: D65. Which two of the following are correct embedded SQL syntax for connecting to a database?A. EXEC SQL CONNECT TO sample;B. EXEC SQL CONNECT TO :dbalias :uid :passwd;C. EXEC SQL CONNECT TO sample USER ? USING ?;D. EXEC SQL CONNECT TO :dbalias USER :uid USING :passwd;E. EXEC SQL CONNECT TYPE 2 TO sample USER :uid USING :passwd;Answer: AD66. Which two of the following embedded SQL statements can be used to specify which database server is being operated on whenperforming multi-site updates?A. CONNECT TOB. SET CONTEXTC. SET CONNECTIOND. UPDATE CONTEXTE. SET CONNECT TYPE 2Answer: AC67. Which of the following special registers can be queried to determine the database name of the active connection?A. CURRENT NODEB. CURRENT SQLIDC. CURRENT SERVERD. CURRENT CONNECTIONAnswer: C68. Which of the following is the correct order to allocate ODBC/CLI handles?A. 1. Environment1 Connection2 StatementB. 1. Connection1 Environment2 StatementC. 1. Environment1 Statement2 ConnectionD. 1. Statement1 Connection2 EnvironmentAnswer: A69. Which two of the following are valid ODBC/CLI handle definitions?A. SQL_HANDLE_ERRB. SQL_HANDLE_DRVC. SQL_HANDLE_DBCD. SQL_HANDLE_CONE. SQL_HANDLE_DESCAnswer: CE70. Prior to executing a query with a forward-only cursor, which of the following ODBC statement handle attributes can be used tospecify that the results of the query are to be read-only?A. SQL_ATTR_CONCURRENCYB. SQL_ATTR_CURSOR_TYPEC. SQL_ATTR_RETRIEVE_DATAD. SQL_ATTR_CURSOR_SENSITIVITY
    • Answer: A71. Which two of the following ODBC/CLI API function calls can be used to retrieve diagnostic information?A. SQLGetMsgB. SQLGetErrorC. SQLGetDiagRecD. SQLGetErrorRecE. SQLGetDiagFieldAnswer: CE72. Given the following ODBC/CLI Code:SQLHANDLE henv, hdbc, hstmt1, hstmt2 ;SQLRETURN rc;hstmt1=NULL;hstmt2=NULL;rc = SQLAllocHandle( SQL_HANDLE_ENV, SQL_NULL_HANDLE, &henv ) ;rc = SQLAllocHandle( SQL_HANDLE_DBC, henv, &hdbc );rc = SQLConnect( hdbc, "SAMPLE", SQL_NTS, "DB2CERT", SQL_NTS,"DB2CERT", SQL_NTS );rc = SQLAllocHandle( SQL_HANDLE_STMT, hdbc, &hstmt1 ) ;Assuming all of the above calls return SQL_SUCCESS, which is the expected value of variable rc if the following function call ismade immediately after the above?rc = SQLExecDirect(hstmt2, "SELECT * FROM SYSIBM.SYSTABLES", SQL_NTS);A. SQL_ERRORB. SQL_SUCCESSC. SQL_INVALID_HANDLED. SQL_SUCCESS_WITH_INFOAnswer: C73. Under which of the following conditions has an application conclusively retrieved all diagnostic records associated with a givenhandle?A. SQLError() returns SQL_NO_DATA_FOUNDB. SQLGetDiagField() returns SQL_SUCCESSC. SQLGetDiagRec() returns SQL_NO_DATA_FOUNDD. SQLGetDiagRec() does not return SQL_ERRORAnswer: A74. Which of the following ODBC/CLI APIs can be used to retrieve multiple error messages associated with a single handle in anyorder?A. SQLError()B. SQLGetSQLCA()C. SQLGetErrorMsg()D. SQLGetDiagField()Answer: D75. Given the following table T1 containing an INTEGER column:C1NULL123An ODBC/CLI application executes the following pseudocode on an allocated statement handle:SQLPrepare( hStmt, "SELECT * FROM t1 WHERE c1 IS NULL", SQL_NTS );SQLBindParameter( hStmt, 1, 1, SQL_C_LONG, SQL_CHAR, &piData, 0, NULL);SQLExecute( hStmt );SQLSetStmtAttr( hStmt, SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_STATIC );SQLFetch( hStmt );Which API is expected to return SQL_ERROR?A. SQLFetch()B. SQLPrepare()
    • C. SQLExecute()D. SQLSetStmtAttr()E. SQLBindParameter()Answer: D76. Given the following table definition:CREATE TABLE t1 ( c1 CHAR(100) NOT NULL )An ODBC/CLI application successfully executes the following pseudocode:SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt );SQLPrepare( hStmt, "INSERT INTO t1 (c1) VALUES (?)", SQL_NTS );SQLBindParameter( hStmt, 1, 1, SQL_C_CHAR, SQL_VARCHAR, 101, 0, &pszData, 10, pcbValue);What value of pcbValue would cause the following to return SQL_NEED_DATA?SQLExecute(hStmt);A. 0B. SQL_NTSC. SQL_NULL_DATAD. SQL_DATA_AT_EXECAnswer: D77. Given the following ODBC/CLI code that executes successfully:SQLRETURN rc;SQLHANDLE hEnv, hDbc, hStmt;rc = SQLAllocHandle( SQL_HANDLE_ENV, NULL, &hEnv );rc = SQLAllocHandle( SQL_HANDLE_DBC, hEnv, &hDbc );rc = SQLConnect( hDbc, "CERTDB", SQL_NTS, NULL, NULL, NULL, NULL );Which of the following calls is expected to return SQL_SUCCESS?A. rc = SQLExecute( hStmt );B. rc = SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt );C. rc = SQLPrepare( hStmt, "SELECT * FROM SYSIBM.SYSTABLES", SQL_NTS );D. rc = SQLSetStmtAttr( hStmt, SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_STATIC, NULL );Answer: B78. Given the following ODBC/CLI pseudocode executes without error:SQLAllocHandle( SQL_HANDLE_DBC, hEnv, &hDbc )SQLConnect( hDbc, "DB2CERT", SQL_NTS, NULL, SQL_NTS, NULL, SQL_NTS )SQLSetConnectAttr( hDbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, NULL )SQLAllocHandle( SQL_HANDLE_STMT, hDbc, &hStmt )SQLPrepare( hStmt, "SELECT col1, col2 FROM tab1", SQL_NTS )SQLExecute( hStmt )SQLFetch( hStmt )Which two of the following psuedocode pieces may be successfully executed immediately after the above?A. SQLFetch( hStmt )B. SQLDisconnect( hDbc )C. SQLBindCol( hStmt, 1, SQL_C_LONG, &buff, 4, NULL )D. SQLExecDirect( hStmt, "SELECT col1, col2 FROM tab2", SQL_NTS )E. SQLSetStmtAttr( hStmt, SQL_ATTR_CURSOR_TYPE, SQL_CURSOR_STATIC, NULL )Answer: AC79. Which two of the following ODBC/CLI APIs can result in the opening of a cursor?A. SQLFetch()B. SQLPrepare()C. SQLGetData()D. SQLProcedures()E. SQLExecDirect()Answer: DE80. Which of the following pseudocode ODBC/CLI API calls can be made to determine if an open cursor isscrollable?A. SQLFetchScroll( SQL_FETCH_MODE )B. SQLGetInfo( SQL_SCROLL_OPTIONS )C. SQLGetStmtAttr( SQL_ATTR_CURSOR_TYPE )D. SQLGetConnectAttr( SQL_ATTR_CONCURRENCY )
    • Answer: C81. Which of the following CLI/ODBC APIs can be used to establish a new connection to a remote database?A. SQLOpenConnectB. SQLAllocConnectC. SQLSetConnectionD. SQLDriverConnectAnswer: D82. The ODBC/CLI SQLDriverConnect() API is being called through an ODBC Driver Manager.To successfully establish a database connection, which of the following attributes is a required part of the InConnectionStringparameter?A. DSNB. DBNAMEC. DATASOURCED. DB2INSTANCEAnswer: A83. Which of the following JDBC objects is used to execute a stored procedure?A. ResultSetB. ConnectionC. StoredProcedureD. DatabaseMetaDataE. CallableStatementAnswer: E84. Which of the following JDBC objects has methods to retrieve the number of columns returned from the query?SELECT * FROM employeeA. RowSetB. ResultSetC. RowSetMetaDataD. ResultSetMetaDataAnswer: D85. Which two of the following JDBC objects can be used to execute SQL that contains parameter markers?A. StatementB. ResultSetC. CallableStatementD. PreparedStatementE. ResultSetMetaDataAnswer: CD86. Which two of the following JDBC objects can be used to execute the followingquery? SELECT * FROM EMPLOYEEA. StatementB. ResultSetC. ConnectionD. PreparedStatementE. ResultSetMetaDataAnswer: AD87. Given the INTEGER table T1:C112A JDBC application successfully executes the following:int canBeNull;Statement stmt = con.createStatement();ResultSet rs = stmt.Execute( "SELECT c1 FROM t1" ); rs.next();Which of the following demonstrates updating canBeNull to reflect whether column C1 can contain NULL data for any row?
    • A. int val = rs.getInt("C1");canBeNull = rs.wasNull();B. ResultSetMetaData rsmd = rs.getMetaData();canBeNull = rsmd.isNullable(1);C. ColumnMetaData cmd = rs.getColMetaData("C1");canBeNull = cmd.isNullable();D. ResultSetMetaData rsmd = rs.getMetaData();canBeNull = rsmd.getColumnNullable("C1");Answer: B88. Which of the following Java-based open standards can be used to issue static queries with DB2?A. JREB. JDKC. SQLJD. JDBCAnswer: C89. Which of the following Java-based open standards use iterator objects to scroll through the results of a query?A. JTAB. JREC. JDBCD. SQLJAnswer: D90. A JDBC connection is established as follows:Connection con = DriverManager.getConnection("jdbc:db2:sample");If the connection does not throw any exceptions, which of the following code pieces determine if there are any warnings?A. SQLWarning warn = con.getWarnings();if (warn != null ) { /* There were warnings */ };B. SQLWarning warn = con.getExceptions();if (warn != null ) { /* There were warnings */ };C. SQLException warn = DriverManager.getWarnings();if (warn != null ) { /* There were warnings */ };D. SQLException warn = con.getExceptions();if (warn != null ) { /* There were warnings */ };Answer: A91. Which of the following methods of the SQLException class can be queried to retrieve DB2 specific error values?A. getSQLCA()B. getSQLState()C. getErrorCode()D. getErrorState()Answer: C92. Which of the following commands is used to customize an SQLJ profile?A. sqljB. db2 prepC. db2 bindD. db2profcAnswer: D93. When building an SQLJ application, which of the following steps is required to generate the SQL package?A. prepB. javacC. db2profpD. db2profcAnswer: D94. Given the following Java code fragment:public void completeTransaction(Xid txToComplete, boolean commit)throws Exception {
    • if (commit) {resource.prepare(txToComplete);resource.commit(txToComplete, false);}else {resource.rollback(txToComplete);}}Which of the following data source classes are required for the successful execution of the complete Transaction method?A. DB2DataSourceB. DB2XADataSourceC. DB2JTADataSourceD. DB2ConnectionPoolDataSourceAnswer: B95. Given the following Java code fragment:XADataSource ds;XAConnection conn;XAResource resource;...InitialContext ctx = new InitialContext() ;ds = (XADataSource)ctx.lookup("jdbc/db2cert") ;conn = ds.getXAConnection();resource = conn.getXAResource();What is the maximum number of global transactions that can be associated with the conn object at any given time?A. 0B. 1C. no limitD. as defined by the MAX_TRANS attribute of the conn objectAnswer: B96. Which of the following javax.sql.DataSource properties must be set to establish a DB2 JDBC connection to a remote database?A. portNumberB. serverNameC. networkProtocolD. userid and passwordAnswer: B97. Which of the following is a valid sequence for the URL string for connecting to data source using a DB2 JDBC driver?A. jdbc:db2:<data_source>B. jdbc:<data_source>:db2C. db2:<data_source>:jdbcD. db2:jdbc:<data_source>Answer: A98. An embedded SQL application performs a static SELECT statement of column C1 from table T1. Which of the following codefragments correctly demonstrates retrieval of the first row of the result set into host variable "hv"?A. EXEC SQL SELECT c1 FROM t1 USING curEXEC SQL FETCH cur INTO :hvEXEC SQL CLOSE curB. EXEC SQL OPEN cur FOR SELECT c1 FROM t1EXEC SQL FETCH cur INTO :hvEXEC SQL CLOSE curC. EXEC SQL DECLARE cur CURSOR FOR SELECT c1 FROM t1EXEC SQL OPEN curEXEC SQL FETCH cur INTO :hvEXEC SQL CLOSE curD. EXEC SQL PREPARE stmt FOR SELECT c1 FROM t1EXEC SQL DECLARE cur CURSOR FOR stmtEXEC SQL OPEN curEXEC SQL FETCH cur INTO :hv
    • EXEC SQL CLOSE curAnswer: C99. Given the following information:CREATE TABLE t1(c1 VARCHAR(30) NOT NULL, c2 SMALLINT)and host variables containing the following data:hv1 = "User1"hv2 = 24hv3 = -1hv4 = 0Which of the following pseudocode statements will successfully insert a row where C1 is User1 and C2 is 24?A. text_stmt = "INSERT INTO t1 VALUES (?, ?)";EXEC SQL PREPARE stmt FROM :text_stmt;EXEC SQL EXECUTE stmt USING :hv1, :hv2 :hv3;B. text_stmt = "INSERT INTO t1 VALUES (?, ?)";EXEC SQL PREPARE stmt FROM :text_stmt;EXEC SQL EXECUTE stmt USING :hv1, :hv2 :hv4;C. text_stmt = "INSERT INTO t1 VALUES (?, ??)";EXEC SQL PREPARE stmt FROM :text_stmt;EXEC SQL EXECUTE stmt USING :hv1, :hv2 :hv3;D. text_stmt = "INSERT INTO t1 VALUES (?, ??)";EXEC SQL PREPARE stmt FROM :text_stmt;EXEC SQL EXECUTE stmt USING :hv1, :hv2 :hv4;Answer: B100. Which of the following code fragments is considered Dynamic SQL?A. EXEC SQL EXECUTE IMMEDIATE :hv1B. EXEC SQL INSERT INTO t1 VALUES :hv1C. EXEC SQL SELECT c1 FROM t1 INTO :hv1D. EXEC SQL DECLARE CURSOR cur1 FOR SELECT c1 FROM t1Answer: A101. Which of the following pseudocode fragments correctly performs a dynamic SELECT statement from TEST_TABLE when thecolumns are not known?A. text_stmt = "DECLARE cur CURSOR FOR SELECT * FROM my.test_table"EXEC SQL PREPARE stmt FROM :text_stmtEXEC SQL OPEN curEXEC SQL FETCH cur USING DESCRIPTOR :my_sqldaEXEC SQL CLOSE curB. text_stmt = "SELECT * FROM my.test_table"EXEC SQL PREPARE stmt FROM :text_stmtEXEC SQL DECLARE cur CURSOR FOR stmtEXEC SQL OPEN curEXEC SQL FETCH cur USING DESCRIPTOR :my_sqldaEXEC SQL CLOSE curC. text_stmt = "DECLARE cur CURSOR FOR SELECT * FROM my.test_table"EXEC SQL PREPARE stmt FROM :text_stmtEXEC SQL DESCRIBE stmt INTO :my_sqldaEXEC SQL OPEN curEXEC SQL FETCH cur USING DESCRIPTOR :my_sqldaEXEC SQL CLOSE curD. text_stmt = "SELECT * FROM my.test_table"EXEC SQL PREPARE stmt FROM :text_stmtEXEC SQL DESCRIBE stmt INTO :my_sqldaEXEC SQL DECLARE cur CURSOR FOR stmtEXEC SQL OPEN curEXEC SQL FETCH cur USING DESCRIPTOR :my_sqldaEXEC SQL CLOSE curAnswer: D
    • 102. Which of the following applies for Compound Not Atomic SQL?A. Can contain host language statements.B. Is not supported against DRDA servers.C. Statements can succeed or fail regardless of the success or failure of preceding SQL statements in the same block of CompoundSQL.D. Is the DB2 term for complex SQL statements that include subselects, CASE statements, declared temporary tables, common tableexpressions and recursive SQL.Answer: C103. Given the table declaration:CREATE TABLE x.org (deptnumb SMALLINT, deptname VARCHAR(14), manager SMALLINT )DEPTNUMB DEPTNAME MANAGER15 New England 5020 Mid Atlantic 1038 South Atlantic 30Users a and b are using CLP with CURSOR STABILITY isolation level and AUTOCOMMIT turned OFF. They execute thefollowing in sequence:1. User a:db2 "DECLARE c1 CURSOR FOR SELECT manager FROM x.org ORDER BY manager"db2 "OPEN c1" 2. User b: db2 "UPDATE x.org SET manager=60 WHERE manager=10"2 User a:db2 "FETCH c1"What will each user see in their windows?A. User a: 10; User b: session hangs;B. User a: 60; User b: complete successfully;C. User a: 30; User b: complete successfully;D. User a: 10; User b: complete successfully;Answer: D104. Which of the following can be locked explicitly?A. IndexesB. Catalog tablesC. Base user tablesD. Declared temporary tablesAnswer: C105. Using Read Stability isolation level, Application A updates row X and does NOT issue a COMMIT.Using Uncommitted Read isolation level, Application B attempts to read row X.What is the result of Application Bs attempt to read row X?A. Application B will receive a lock timeout error.B. Application B will wait until Application A completes its unit of work.C. Application B will receive the version of row X that exists after Application As update.D. Application B will receive the version of row X that existed prior to Application As update.Answer: C106. Application A updates row R in table T using a cursor with an isolation level of Read Stability. Application B intends to read rowR from table T after application A updates the row and application A still has an outstanding unit of work.Which of the following isolation levels would application B require to successfuly complete this task?A. Read StabilityB. Repeatable ReadC. Uncommitted ReadD. Cursor StabilityAnswer: C107. Using Uncommitted Read isolation level, Application A updates row X and does NOT issue a COMMIT.Using Read Stability isolation level, Application B attempts to read row X.What is the result of Application Bs attempt to read row X?A. Application B will receive a deadlock error.
    • B. Application B will wait until Application A completes its unit of work.C. Application B will receive the version of row X that exists after Application As update.D. Application B will receive the version of row X that existed prior to Application As update.Answer: B108. Which of the following connection handle attributes affects concurrency by changing the isolation level of ODBC/CLIapplications?A. SQL_ATTR_CONNECTTYPEB. SQL_ATTR_CONCURRENCYC. SQL_ATTR_CURSOR_TYPED. SQL_ATTR_TXN_ISOLATIONAnswer: D109. The following statements were successfully executed in sequence in a distributed unit of work with AUTOCOMMIT set to off:CONNECT TO con1CONNECT TO con2INSERT INTO t1 VALUES(1)SET CONNECTION con1INSERT INTO t1 VALUES(2)ROLLBACKSET CONNECTION con2RELEASE con1COMMITWhich of the following describes the client state?A. No records were inserted. Connection CON1 is closed.B. No records were inserted. Both connections are closed.C. Connection CON2 inserted a record. Both connections are open.D. Connection CON2 inserted a record. Connection CON1 is closed.Answer: A110. Which of the following is TRUE for a remote unit of work (RUOW)?A. A Type 2 connection must be used to establish the connection.B. A unit of work contains operations against a single data source.C. A unit of work contains operations against multiple data sources.D. A syncpoint manager must be used to coordinate COMMITs and ROLLBACKs.Answer: B111. Which of the following SQL statements correctly demonstrates parameter marker usage?A. SELECT c1 FROM t1 WHERE c2 = ?B. SELECT ? FROM t1 WHERE c2 = c3C. SELECT c1 FROM t1 WHERE c2 = :?D. SELECT c1 FROM t1 WHERE c2 = ?Answer: A112. Which of the following SQL statements, if issued dynamically, correctly uses parameter markers?A. SELECT c1, ? FROM t1B. SELECT c1, INTEGER(?) FROM t1C. SELECT c1, ? AS INTEGER FROM t1D. SELECT c1, CAST(? AS INTEGER) FROM t1Answer: D113. Which of the following JDBC interfaces has methods that permit the use of parameter markers?A. ResultSetB. StatementC. ConnectionD. CallableStatementAnswer: D114. Which of the following ODBC/CLI APIs can be used to retrieve the expected SQL type associated with a parameter marker aftera successful SQLPrepare() call?A. SQLGetInfo()B. SQLGetParam()
    • C. SQLGetDescRec()D. SQLBindParameter()Answer: C115. An ODBC/CLI application executes the following batch SQL:SQLExecDirect( hStmt, "SELECT c1 FROM t1; SELECT c2 FROM t2;" SQL_NTS );Which API is used to discard the first result set and make the second available for processing?A. SQLFetch()B. SQLRowCount()C. SQLMoreResults()D. SQLCloseCursor()Answer: C116. Which of the following ODBC/CLI statement handle attributes can be set to permit retrieval of multiple rows with a singleSQLFetch() call?A. SQL_ATTR_MAX_ROWSB. SQL_ATTR_ROWSET_SIZEC. SQL_ATTR_PARAMSET_SIZED. SQL_ATTR_ROW_ARRAY_SIZEAnswer: D117. Which two of the following parameter styles are valid for registering a Java UDF?A. SQLB. JAVAC. DB2SQLD. GENERALE. DB2GENERALF. GENERAL WITH NULLSAnswer: BE118. Given the following type definition:CREATE DISTINCT TYPE money AS DECIMAL(11,2) WITH COMPARISONS;Which of the following is the best choice for the implementation of the subtraction operation for two values of money data type?A. Stored ProcedureB. Check ConstraintC. Table User Defined FunctionD. Sourced User Defined FunctionAnswer: D119. Which two of the following features are the specific benefits of stored procedures in the client server environment?A. Ability to return user defined messagesB. Ability to commit changes on the serverC. Ability to use SQL/PSM for implementationD. Ability to reduce data flow over the networkE. Ability to separate and reuse business logicF. Ability to return result sets over the networkAnswer: DE120. All of the following are benefits of stored procedures in a client server environment, EXCEPT:A. Application code reuseB. Reduced network trafficC. Decreased server workloadD. Improved application securityAnswer: C121. An application needs to retrieve a large number of rows from a database across the network and compute a single value from theretrieved data.Which of the following methods will reduce the network traffic between the client and server?A. Use a triggerB. Use a stored procedureC. Combine all rows into a LOB
    • D. Combine all rows into a User-Defined TypeAnswer: B122. DB2 stored procedures can be used for all of the following tasks EXCEPT:A. Opening a cursor declared FOR UPDATE.B. Issuing a COMMIT to end the unit of work.C. Preparing and executing dynamic SQL statements.D. Returning output parameters to an UPDATE statement.Answer: D123. Given the following SQL Stored Procedure:CREATE PROCEDURE Proc2 ( )LANGUAGE SQLP1: BEGINDECLARE CONTINUE HANDLER FOR SQLSTATE 38S01ErrHandler: BEGININSERT INTO result VALUES(Handler Fired);RESIGNAL SQLSTATE 38S01 SET MESSAGE_TEXT = Error occurred in SP.;INSERT INTO result VALUES(After Resignal);END ErrHandler;INSERT INTO result VALUES(Start);SIGNAL SQLSTATE 38S01;INSERT INTO result VALUES(End);END P1If the procedure is executed with AUTOCOMMIT set to OFF, which of the following messages will be inserted into the result table?A. StartHandler FiredB. StartHandler FiredEndC. StartHandler FiredAfter ResignalD. StartHandler FiredAfter ResignalEndAnswer: A124. Given the following procedure:CREATE PROCEDURE Proc1 ( )RESULT SETS 1LANGUAGE SQLP1: BEGINDECLARE C1 CURSOR WITH RETURN FORSELECT * FROM T1;OPEN C1;END P1Which statement most accurately describes the result when the procedure is called?A. A cursor is returned to the procedure caller for all rows of table T1.B. All rows of table T1 are returned to the procedure caller in an array structure.C. A cursor is returned to the procedure caller with an empty result set because the TO CALLER clause is missing on the DECLAREstatement.D. All rows of table T1 are returned to the procedure caller in an array structure and a warning is returned by the procedure becausethe cursor is not closed.Answer: A125. DB2 Development Center can be used to develop which of the following?A. SQL triggersB. External UDFsC. SQL stored procedures
    • D. External stored proceduresAnswer: C126. Which statement describes the process of creating an SQL stored procedure through DB2 Development Center?A. The procedure is precompiled, compiled, and registered on the database server system.B. The procedure is precompiled and compiled on the development workstation and then bound to the database server system.C. The procedure is precompiled and compiled on the development workstation and then registered on the database server system.D. The procedure is precompiled on the development workstation and then compiled and registered on the database server system.Answer: A