db2 - 703 - dumps

49
Exam : 000-703 Title : DB2 UDB V8.1 Family Application Development Ver : 06-12-07

Upload: mukesh

Post on 02-Apr-2015

111 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: DB2 - 703 - dumps

Exam : 000-703Title : DB2 UDB V8.1 Family Application DevelopmentVer: 06-12-07

Page 2: DB2 - 703 - dumps

000-703QUESTION 1:Given the following code:EXEC SQL EXECUTE IMMEDIATE :sqlstmtWhich of the following values must sqlstmt contain so that all rows are deleted fromthe STAFF table?A. DROP TABLE staffB. DELETE FROM staffC. DROP * FROM staffD. DELETE * FROM staffAnswer: BQUESTION 2: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: BQUESTION 3:To prepare an embedded SQL program for use with a host-language compiler,which of the following database components is required?A. BinderB. PrecompilerC. Stored Procedure BuilderD. Application Development CenterAnswer: BQUESTION 4:An ODBC/CLI application has the following pseudocode:SQLAllocHandle( SQL_HANDLE_DBC, hEnv, &hDbc )Actualtests.com - The Power of Knowing

Page 3: DB2 - 703 - dumps

000-703SQLConnect( 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 fullyqualified SQL statements is equivalent to:SQLExecDirect( hStmt, "SELECT * FROM user1.table1 t1, table2 t2 WHEREt1.col1=t2.col2", SQL_NTS )A. SQLExecDirect( hStmt, "SELECT * FROM user1.table1 t1, table2 t2 WHEREt1.col1=t2.col2", SQL_NTS )B. SQLExecDirect( hStmt, "SELECT * FROM user1.table1 t1, user1.table2 t2 WHEREt1.col1=t2.col2", SQL_NTS )C. SQLExecDirect( hStmt, "SELECT * FROM user1.table1 t1, db2cert.table2 t2WHERE t1.col1=t2.col2", SQL_NTS )D. SQLExecDirect( hStmt, "SELECT * FROM db2cert.table1 t1, db2cert.table2 t2WHERE t1.col1=t2.col2", SQL_NTS )Answer: CQUESTION 5: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 JDBCprogram?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=?";statement stmt=con.createStatement(sql);D. String sql ="UPDATE employee SET salary=salary*?WHERE workdept=?";statement stmt=con.createStatement(sql);Answer: CQUESTION 6:Given the following code:Actualtests.com - The Power of Knowing

Page 4: DB2 - 703 - dumps

000-703BEGIN ATOMICUPDATE country SET cities=:count WHERE CURRENT OF C1;INSERT INTO country VALUES(:co11,:co12,:co13);INSERT INTO country VALUES(:co14,:co15,:co16);INSERT INTO country VALUES(:co17,:co18,:co19);INSERT INTO country VALUES(:co110,:co111,:co112);COMMIT;ENDGiven that all statements succeed except the following:INSERT INTO country VALUES(:co17,:co18,:co19);How many rows will be affected in table COUNTRY?A. 0B. 3C. 4D. 5Answer: AQUESTION 7:The following commands are issued against a data source containing tableuser2.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: DQUESTION 8: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.orgActualtests.com - The Power of Knowing

Page 5: DB2 - 703 - dumps

000-703When issued by USER1, which of the following statements will have a differentresult set than this SELECT statement?SELECT * FROM orgA. SELECT * FROM org.sampleB. SELECT * FROM sample.orgC. SELECT * FROM userid.orgD. SELECT * FROM userid.sampleAnswer: AQUESTION 9:An application uses embedded dynamic SQL to connect to a remote DB2 server andinserts data into the CUST.ORDERS table on that remote DB2 server. To enableaccess of the remote DB2 server, Administrator FOO needs to create a package withdefault options such that BAR is the only non-administrative user that can use thispackage on the remote DB2 server.Which statement describes the privileges that must be granted and/or revoked byFOO to accomplish this?A. BAR requires EXECUTE privilege on the package and UPDATE privilege onCUST.ORDERS, and the EXECUTE privilege for the package must be revoked fromPUBLIC.B. BAR requires EXECUTE privilege on the package and INSERT privilege onCUST.ORDERS, and the EXECUTE privilege for the package must be revoked fromPUBLIC.C. BAR requires EXECUTE privilege on the package and INSERT privilege onCUST.ORDERS, and the REFERENCES privilege for the package must be revoked fromPUBLIC.D. BAR requires EXECUTE privilege on the package and UPDATE privilege onCUST.ORDERS, and the REFERENCES privilege for the package must be revoked fromPUBLIC.Answer: BQUESTION 10:User FOO must create and own an SQL stored procedure, CUST.CALC1, thatreturns a calculation using static SQL. Both user FOO and user BAR need to callthis stored procedure from each of their applications.Assuming FOO has the necessary privileges to perform the calculation, which two ofthe following statements describe the MINIMUM privileges that must be explicitlygranted for users BAR and FOO?A. BAR needs EXECUTE privilege on the CALC1 packageActualtests.com - The Power of Knowing

Page 6: DB2 - 703 - dumps

000-703B. 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: BEQUESTION 11:An application uses static SQL to connect to a remote DB2 server and inserts datainto the CUST.ORDERS table on that remote DB2 server. To enable access to theremote DB2 server, FOO needs to create a package with default options so thatBAR is the only non-administrative user that can use this package on the remoteDB2 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 onCUST.ORDERS.D. FOO requires the privilege to create the package on the remote DB2 server andINSERT privilege on CUST.ORDERS.Answer: DQUESTION 12:Which of the following privileges is required to successfully execute a Java storedprocedure that uses JDBC to update several different 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 EXECUTEprivilege on the stored procedure.D. The developer must have UPDATE privilege on the referenced tables and EXECUTEprivilege on the stored procedure.Answer: CQUESTION 13:Given the table T1, created using the following statement:CREATE TABLE t1(id INTEGER GENERATED BY DEFAULT AS IDENTITY,c1 CHAR(3)Actualtests.com - The Power of Knowing

Page 7: DB2 - 703 - dumps

000-703)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 fromthe following SELECT statement?SELECT id FROM t1 ORDER BY idA. 1, 2, 2B. 1, 2, 3C. 2, 3, 4D. 0, 1, 2Answer: AQUESTION 14:Given the following table (C1 is INTEGER):T1C1--4321and 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=v1OPEN 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?Actualtests.com - The Power of Knowing

Page 8: DB2 - 703 - dumps

000-703A. 20B. 21C. 24D. 25Answer: BQUESTION 15:Which two of the following can be used to retrieve the current date from the DB2Command Line Processor?A. ? CURRENT DATEB. VALUES CURRENT DATEC. CREATE CURRENT DATED. SELECT CURRENT TIME FROM SYSIBM.DUALE. SELECT CURRENT DATE FROM SYSIBM.SYSDUMMY1Answer: BEQUESTION 16:Which of the following produces a sequentially increasing number, suitable for useas a primary key?A. ROWID data typeB. Generated IDENTITY columnC. GENERATE_UNIQUE built-in functionD. CURRENT SEQUENCE special registerAnswer: BQUESTION 17: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,'jhonson',2)';Actualtests.com - The Power of Knowing

Page 9: DB2 - 703 - dumps

000-703EXEC 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: AQUESTION 18: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: CQUESTION 19:Given the tables:COUNTRYid name1 Argentina3 Cuba4-NATIONid name2 Belgium4 USAand the code:Actualtests.com - The Power of Knowing

Page 10: DB2 - 703 - dumps

000-703EXEC 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: DQUESTION 20: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_countries---------- ---------- -------------------1 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 abovereport?A. 1B. 2C. 3D. 4Answer: BActualtests.com - The Power of Knowing

Page 11: DB2 - 703 - dumps

000-703QUESTION 21:Given the tables T1 and T2, each containing an integer column COL1:T1COL1-----------1-1-22T2COL1-----------1-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: AQUESTION 22:Given the tables T1 and T2, each with an INTEGER column:T1COL1-----------1-1-22T2COL1-----------1-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. 5Actualtests.com - The Power of Knowing

Page 12: DB2 - 703 - dumps

000-703B. 6C. 10D. 36Answer: CQUESTION 23: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 willstill be updated without the need for the explicit UPDATE SQL statement?A. An INSERT trigger on COMPANYB. An UPDATE trigger on COMPANYC. An INSERT trigger on EMPLOYEED. An UPDATE trigger on EMPLOYEEAnswer: CQUESTION 24:Which of the following CLI/ODBC functions should be used to delete rows from aDB2 table?A. SQLDelete()B. SQLExecDirect()C. SQLBulkDelete()D. SQLExecuteUpdate()Answer: BQUESTION 25:Which of the following methods must be used for deleting a row using the Statementinterface in JDBC?A. delete()B. execute()C. executeUpdate()D. executeDelete()Answer: CActualtests.com - The Power of Knowing

Page 13: DB2 - 703 - dumps

000-703QUESTION 26:Given the tables T1 and T2 with INTEGER columns:T1COL1-----------1-1-22T2COL1-----------1-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. 0B. 2C. 3D. 6Answer: BQUESTION 27:An ODBC/CLI application performs an array insert into a table containing aprimary key. If one of the values inserted generates a duplicate row error, which ofthe following APIs can be called to determine the failing row?A. SQLError()B. SQLNumRows()C. SQLRowCount()D. SQLGetDiagField()Answer: DQUESTION 28:Which of the following is a benefit of user-defined functions?A. Improves application concurrencyB. Improves blocking of result setsActualtests.com - The Power of Knowing

Page 14: DB2 - 703 - dumps

000-703C. Simplifies application maintenanceD. Reduces memory requirements on the serverAnswer: CQUESTION 29:Given the table called NAME with the following column and data:lname------SmithSMITHSmiThsmithWhich of the following SQL statements will return all four rows in upper case?A. SELECT CAPS(lname) FROM nameB. SELECT UCASE(lname) FROM nameC. SELECT STRUPR(lname) FROM nameD. SELECT TOUPPER(lname) FROM nameAnswer: BQUESTION 30: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/(SELECTSUM(salary) FROM employee)) FROM employee)B. SELECT COALESCE(AVG(salary)) FROM employeeC. SELECT SUM(salary)/COUNT(*) FROM employeeD. SELECT salary/(SELECT SUM(salary) FROM employee) FROM employeeAnswer: DQUESTION 31:Which of the following will retrieve results that will only be in lower case?A. SELECT NAME FROM EMPLOYEE WHERE NAME='ali'Actualtests.com - The Power of Knowing

Page 15: DB2 - 703 - dumps

000-703B. SELECT NAME FROM EMPLOYEE WHERE LCASE(NAME)='ali'C. SELECT UCASE(NAME) FROM EMPLOYEE WHERE LCASE(NAME)='ali'D. SELECT NAME FROM EMPLOYEE WHERE NAME IN (SELECT NAME FROMEMPLOYEE WHERE LCASE(NAME)=LCASE('ALI'))Answer: AQUESTION 32:Given the expression:WITH most_cities AS(SELECT b.id,b.name,a.citiesFROM 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: BQUESTION 33: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 workActualtests.com - The Power of Knowing

Page 16: DB2 - 703 - dumps

000-703Answer: AQUESTION 34:If a stored procedure returns multiple rows, which of the following must the callingapplication use to access the result set?A. A cursorB. A select statementC. A declared temporary tableD. A table user-defined functionAnswer: AQUESTION 35: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: AQUESTION 36:A cursor is declared with the WITH HOLD option. Which of the followingstatements 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: AQUESTION 37: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.Actualtests.com - The Power of Knowing

Page 17: DB2 - 703 - dumps

000-703Answer: AQUESTION 38:Given the application code:EXEC SQL DECLARE cur CURSOR WITH HOLD FOR SELECT c1 FROM t1EXEC SQL OPEN curEXEC 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 beclosed first?A. Statement 1B. Statement 2C. Statement 3D. Statement 4E. Statement 5Answer: DQUESTION 39:Given the table T1 with the following data:C1---ABCDEand 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 cur2Actualtests.com - The Power of Knowing

Page 18: DB2 - 703 - dumps

000-703EXEC SQL CLOSE cur1What is the final content of the host variable "hv"?A. AB. BC. CD. DAnswer: CQUESTION 40:Given the following table:TestTableC1-----------12345And 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);SQL AllocHandle(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:%i\n",data);SQLFetch(hstmt);printf(Data:%i\n",data);SQLFetch(hstmt);printf(Data:%i\n",data);SQLEndTran(SQL_HANDLE_ENV,henv,SQL_COMMIT);SQLFetch(hstmt);printf(Data:%i\n",data);Actualtests.com - The Power of Knowing

Page 19: DB2 - 703 - dumps

000-703Which 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: BQUESTION 41:Given the table COUNTRY with the following data:ID NAME PERSON CITIES-- ---- ------ ------1 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 SQLCAafter the last fetch?A. SQLCODE 0, SQLSTATE 00000B. SQLCODE 100, SQLSTATE 02000C. SQLCODE -100, SQLSTATE 00100D. SQLCODE -501, SQLSTATE 24501Answer: BQUESTION 42:Actualtests.com - The Power of Knowing

Page 20: DB2 - 703 - dumps

000-703Which of the following cursor definitions will define a cursor called c2 that willfetch rows from table t2, and for every row fetched will update column c1 in tablet2?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 UPDATEOF t2Answer: CQUESTION 43:Given the table T1 with the following data:C1 C2-- --1122An 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: BActualtests.com - The Power of Knowing

Page 21: DB2 - 703 - dumps

000-703QUESTION 44:Given the table T1 containing an INTEGER column:C1---1A multithreaded ODBC/CLI application successfully executes the followingpseudocode 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_ON);Thread1:SQLA11ocHandle(SQL_HANDLE_STMT,hDbc1,&hStmt1);Thread2:SQLA11ocHandle(SQL_HANDLE_STMT,hDbc2,&hStmt2);Thread 1: SQLExecDirect( hStmt1, "SAVEPOINT sp1 ON ROLLBACK RETAINCURSORS",SQL_NTS);Thread 1:SQLExecDirect(hStmt,"INSERT INTO T1 VALUES(2)",SQL_NTS);Thread 2: SQLExecDirect( hStmt2, "SAVEPOINT sp1 ON ROLLBACK RETAINCURSORS",SQL_NTS);Thread2:SQLExecDirect(hStmt2,"INSERT INTO T1 VALUES(3)",SQL_NTS);Thread1:SQLExecDirect(hStmt1,"INSERT INTO T1 VALUES(4)",SQL_NTS);Thread2:SQLExecDirect(hStmt2,"ROLLARBACK TO SAVEPOINT spl",SQL_NTS);Thread2:SQLExecDirect(hStmt2,"INSERT INTO T1 VALUES(4)",SQL_NTS);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: CQUESTION 45:Given an ODBC/CLI program with a single connection, two threads and thefollowing 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: ROLLBACKActualtests.com - The Power of Knowing

Page 22: DB2 - 703 - dumps

000-703Thread 2: COMMITHow many records will be inserted and retained in the table MYTAB?A. 0B. 1C. 2D. 3Answer: CQUESTION 46:Which of the following database resources can be freed when a unit of work iscommitted?A. row locksB. cursor namesC. buffer poolsD. cursors WITH HOLDAnswer: AQUESTION 47:Given the table T1 with the following data:COL1 IDX---- ----A 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 thepseudocode listed above is successfully executed?A. 10B. 20Actualtests.com - The Power of Knowing

Page 23: DB2 - 703 - dumps

000-703C. 30D. 40Answer: DQUESTION 48:Given the table T1 with two INTEGER columns and the following data:col1 idx---- ----A 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 thepseudocode listed above is successfully executed?A. -B. 10C. 20D. 30Answer: DQUESTION 49: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: CActualtests.com - The Power of Knowing

Page 24: DB2 - 703 - dumps

000-703QUESTION 50:Which of the following is used to run an embedded dynamic SQL UPDATEstatement?A. UPDATEB. PREPAREC. DECLARED. EXECUTEAnswer: DQUESTION 51:Which of the following indicates when ODBC must be used instead of embeddedSQL?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: AQUESTION 52:Which of the following programming interfaces minimizes client-servercommunication traffic by chaining PREPARE and EXECUTE requests together bydefault?A. ODBC/CLIB. SQL RoutinesC. Static Embedded SQLD. Dynamic Embedded SQLAnswer: AQUESTION 53:A programmer wants to create an applet that connects to a DB2 UDB databasefrom the web browser. Which two of the following can be used?A. CLIB. SQLJC. JDBCD. ODBCActualtests.com - The Power of Knowing

Page 25: DB2 - 703 - dumps

000-703E. OLEDBAnswer: BCQUESTION 54:Which programming language must be used to code SQLJ stored procedures?A. JavaB. COBOLC. C/C++D. SQL/PSMAnswer: AQUESTION 55:Which of the following components is required to convert an embedded SQL sourcefile into a valid host language source file?A. BinderB. PrecompilerC. Host language linkerD. Host language compilerAnswer: BQUESTION 56: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='MGR'D. DECLARE c1 CURSOR FOR SELECT * FROM employee WHERE lastname=?E. SELECT workdept INTO :wd :wdind FROM employee WHERE lastname = 'SMITH'Answer: AEQUESTION 57:Host variables must be defined inside which of the following in order to be used inan embedded SQL program?A. DECLARE sectionB. SQL INCLUDE fileActualtests.com - The Power of Knowing

Page 26: DB2 - 703 - dumps

000-703C. EXEC SQL sectionD. Function declarationAnswer: AQUESTION 58:A column is defined as INTEGER and contains the following values in no particularorder:-1, 0, 1, NULLHow many host variables must be included in a DECLARE section in order to selectall the values into the program one row at a time?A. 1B. 2C. 3D. 4Answer: BQUESTION 59:When declaring an indicator host variable, which of the following data types mustbe used?A. Small integerB. Fixed characterC. Float (double precision)D. Variable length characterAnswer: AQUESTION 60: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: CQUESTION 61:Given the declaration in an SQLJ program:Actualtests.com - The Power of Knowing

Page 27: DB2 - 703 - dumps

000-703String 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: DQUESTION 62:Which of the following SQLCA elements contains platform independent values?A. sqlcodeB. sqlerrpC. sqlwarnD. sqlstateAnswer: DQUESTION 63:Which of the following SQLCA elements can contain text strings which are used tosend messages to an application?A. sqlerrpB. sqlerrdC. sqlerrmlD. sqlerrmcAnswer: DQUESTION 64: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: DActualtests.com - The Power of Knowing

Page 28: DB2 - 703 - dumps

000-703QUESTION 65:Which two of the following are correct embedded SQL syntax for connecting to adatabase?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:uidUSING:passwd;E.EXEC SQL CONNECT TYPE 2 TO sample USER:uidUSING:passwd;Answer: ADQUESTION 66:Which two of the following embedded SQL statements can be used to specify whichdatabase server is being operated on when performing multi-site updates?A. CONNECT TOB. SET CONTEXTC. SET CONNECTIOND. UPDATE CONTEXTE. SET CONNECT TYPE 2Answer: ACQUESTION 67:Which of the following special registers can be queried to determine the databasename of the active connection?A. CURRENT NODEB. CURRENT SQLIDC. CURRENT SERVERD. CURRENT CONNECTIONAnswer: CQUESTION 68:Which of the following is the correct order to allocate ODBC/CLI handles?A. 1. Environment2. Connection3. StatementActualtests.com - The Power of Knowing

Page 29: DB2 - 703 - dumps

000-703B. 1. Connection2. Environment3. StatementC. 1. Environment2. Statement3. ConnectionD. 1. Statement2. Connection3. EnvironmentAnswer: AQUESTION 69: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: CEQUESTION 70:Prior to executing a query with a forward-only cursor, which of the followingODBC statement handle attributes can be used to specify that the results of thequery are to be read-only?A. SQL_ATTR_CONCURRENCYB. SQL_ATTR_CURSOR_TYPEC. SQL_ATTR_RETRIEVE_DATAD. SQL_ATTR_CURSOR_SENSITIVITYAnswer: AQUESTION 71:Which two of the following ODBC/CLI API function calls can be used to retrievediagnostic information?A. SQLGetMsgB. SQLGetErrorC. SQLGetDiagRecD. SQLGetErrorRecActualtests.com - The Power of Knowing

Page 30: DB2 - 703 - dumps

000-703E. SQLGetDiagFieldAnswer: CEQUESTION 72:Given the following ODBC/CLI Code:SQLHANDLE henv.hdbc,hstmt1,hstmt2;SQLRETURN rv;hstmt1=NULL;hstmt2=NULL;rc=SQLA11ocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv);rc=SQLA11ocHandle(SQL_HANDLE_DBC,henv,&hdbc);rc = SQLConnect( hdbc, "SAMPLE", SQL_NTS, "DB2CERT", SQL_NTS,DB2CERT",SQL_NTS);rc=SQLA11ocHandle(SQL_HANDLE_STMT,hdbc,&hstmt1);Assuming all of the above calls return SQL_SUCCESS, which is the expected valueof variable rc if the following function call is made 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: CQUESTION 73:Under which of the following conditions has an application conclusively retrieved alldiagnostic records associated with a given handle?A. SQLError() returns SQL_NO_DATA_FOUNDB. SQLGetDiagField() returns SQL_SUCCESSC. SQLGetDiagRec() returns SQL_NO_DATA_FOUNDD. SQLGetDiagRec() does not return SQL_ERRORAnswer: AQUESTION 74:Which of the following ODBC/CLI APIs can be used to retrieve multiple errormessages associated with a single handle in any order?A. SQLError()B. SQLGetSQLCA()Actualtests.com - The Power of Knowing

Page 31: DB2 - 703 - dumps

000-703C. SQLGetErrorMsg()D. SQLGetDiagField()Answer: DQUESTION 75:Given the following table T1 containing an INTEGER column:C1---NULL123An ODBC/CLI application executes the following pseudocode on an allocatedstatement 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: DQUESTION 76:Given the following table definition:CREATE TABLE t1 ( c1 CHAR(100) NOT NULL )An ODBC/CLI application successfully executes the following pseudocode:SQLA11ocHandle(SQL_HANDLE_SMT,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_EXECActualtests.com - The Power of Knowing

Page 32: DB2 - 703 - dumps

000-703Answer: DQUESTION 77:Given the following ODBC/CLI code that executes successfully:SQLRETURN rc;SQLHANDLE hEnv,hDbc,hStmt;rc=SQLA11ocHandle(SQL_HANDLE_ENV,NULL,&hEnv);rc=SQLA11ocHandle(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=SQLA11ocHandle(SQL_HANDLE_STMT,hDbc,&hStmt);C.rc=SQLPrepare(hStmt,"SELRCT*FROM SYSIBM.SYSTABLES",SQL_NTS);D. rc = SQLSetStmtAttr( hStmt, SQL_ATTR_CURSOR_TYPE,SQL_CURSOR_STATIC,NULL);Answer: BQUESTION 78: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 executedimmediately 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: ACQUESTION 79:Which two of the following ODBC/CLI APIs can result in the opening of a cursor?Actualtests.com - The Power of Knowing

Page 33: DB2 - 703 - dumps

000-703A. SQLFetch()B. SQLPrepare()C. SQLGetData()D. SQLProcedures()E. SQLExecDirect()Answer: DEQUESTION 80:Which of the following pseudocode ODBC/CLI API calls can be made to determineif an open cursor is scrollable?A. SQLFetchScroll( SQL_FETCH_MODE )B. SQLGetInfo( SQL_SCROLL_OPTIONS )C. SQLGetStmtAttr( SQL_ATTR_CURSOR_TYPE )D. SQLGetConnectAttr( SQL_ATTR_CONCURRENCY )Answer: CQUESTION 81:Which of the following CLI/ODBC APIs can be used to establish a new connectionto a remote database?A. SQLOpenConnectB. SQLAllocConnectC. SQLSetConnectionD. SQLDriverConnectAnswer: DQUESTION 82:The ODBC/CLI SQLDriverConnect() API is being called through an ODBC DriverManager.To successfully establish a database connection, which of the following attributes isa required part of the InConnectionString parameter?A. DSNB. DBNAMEC. DATASOURCED. DB2INSTANCEAnswer: AActualtests.com - The Power of Knowing

Page 34: DB2 - 703 - dumps

000-703QUESTION 83:Which of the following JDBC objects is used to execute a stored procedure?A. ResultSetB. ConnectionC. StoredProcedureD. DatabaseMetaDataE. CallableStatementAnswer: EQUESTION 84:Which of the following JDBC objects has methods to retrieve the number ofcolumns returned from the query?SELECT * FROM employeeA. RowSetB. ResultSetC. RowSetMetaDataD. ResultSetMetaDataAnswer: DQUESTION 85:Which two of the following JDBC objects can be used to execute SQL that containsparameter markers?A. StatementB. ResultSetC. CallableStatementD. PreparedStatementE. ResultSetMetaDataAnswer: CDQUESTION 86:Which two of the following JDBC objects can be used to execute the followingquery?SELECT * FROM EMPLOYEEA. StatementActualtests.com - The Power of Knowing

Page 35: DB2 - 703 - dumps

000-703B. ResultSetC. ConnectionD. PreparedStatementE. ResultSetMetaDataAnswer: ADQUESTION 87:Given the INTEGER table T1:C1--12A JDBC application successfully executes the following:int cabBeNull;Statement stmt=con.createStatement();ResultSet rs = stmt.Execute(SELECT c1 FROM t1");rs.next();Which of the following demonstrates updating canBeNull to reflect whether columnC1 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.getCo1MetaData("C1");canBeNull=cmd.isNullable();D.ResultSetMetaData rsmd=rs.getMetaData();canBeNull=rsmd.getColumnNullable("C1");Answer: BQUESTION 88:Which of the following Java-based open standards can be used to issue static querieswith DB2?A. JREB. JDKC. SQLJD. JDBCAnswer: CQUESTION 89:Which of the following Java-based open standards use iterator objects to scrollActualtests.com - The Power of Knowing

Page 36: DB2 - 703 - dumps

000-703through the results of a query?A. JTAB. JREC. JDBCD. SQLJAnswer: DQUESTION 90: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 piecesdetermine if there are any warnings?A.SQL Warning warn=con.getWarnings();if(warn !=null) {/*There were warnings*/};B.SQL warning warn=con.getExceptions();if(warn !=null) {/*There were warnings*/};C.SQLExceptions warn=DriverManager.getWarnings();if(warn !=null) {/*There were warnings*/};D.SQLExceptions warn=con.getExceptions();if(warn !=null) {/*There were warnings*/}Answer: AQUESTION 91:Which of the following methods of the SQLException class can be queried toretrieve DB2 specific error values?A. getSQLCA()B. getSQLState()C. getErrorCode()D. getErrorState()Answer: CQUESTION 92:Which of the following commands is used to customize an SQLJ profile?A. sqljB. db2 prepC. db2 bindD. db2profcActualtests.com - The Power of Knowing

Page 37: DB2 - 703 - dumps

000-703Answer: DQUESTION 93:When building an SQLJ application, which of the following steps is required togenerate the SQL package?A. prepB. javacC. db2profpD. db2profcAnswer: DQUESTION 94: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 executionof the complete Transaction method?A. DB2DataSourceB. DB2XADataSourceC. DB2JTADataSourceD. DB2ConnectionPoolDataSourceAnswer: BQUESTION 95:Given the following Java code fragment:XADataSource ds;XAConnection conn;XAResource resource;...Actualtests.com - The Power of Knowing

Page 38: DB2 - 703 - dumps

000-703InitialContext 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 theconn object at any given time?A. 0B. 1C. no limitD. as defined by the MAX_TRANS attribute of the conn objectAnswer: BQUESTION 96:Which of the following javax.sql.DataSource properties must be set to establish aDB2 JDBC connection to a remote database?A. portNumberB. serverNameC. networkProtocolD. userid and passwordAnswer: BQUESTION 97:Which of the following is a valid sequence for the URL string for connecting to datasource using a DB2 JDBC driver?A. jdbc:db2:<data_source>B. jdbc:<data_source>:db2C. db2:<data_source>:jdbcD. db2:jdbc:<data_source>Answer: AQUESTION 98:An embedded SQL application performs a static SELECT statement of column C1from table T1. Which of the following code fragments correctly demonstratesretrieval 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 :hvActualtests.com - The Power of Knowing

Page 39: DB2 - 703 - dumps

000-703EXEC 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 :hvEXEC SQL CLOSE curAnswer: CQUESTION 99: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 whereC1 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_stmtEXEC 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: BQUESTION 100:Which of the following code fragments is considered Dynamic SQL?Actualtests.com - The Power of Knowing

Page 40: DB2 - 703 - dumps

000-703A. 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: AQUESTION 101:Which of the following pseudocode fragments correctly performs a dynamicSELECT statement from TEST_TABLE when the columns 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: DQUESTION 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 SQLActualtests.com - The Power of Knowing

Page 41: DB2 - 703 - dumps

000-703statements in the same block of Compound SQL.D. Is the DB2 term for complex SQL statements that include subselects, CASEstatements, declared temporary tables, common table expressions and recursive SQL.Answer: CQUESTION 103:Given the table declaration:CREATE TABLE x.org (deptnumb SMALLINT, deptname VARCHAR(14), managerSMALLINT )DEPTNUMB DEPTNAME MANAGER-------- -------------- -------15 New England 5020 Mid Atlantic 1038 South Atlantic 30Users a and b are using CLP with CURSOR STABILITY isolation level andAUTOCOMMIT turned OFF. They execute the following in sequence:1. User a:db2 "DECLARE c1 CURSOR FOR SELECT manager FROM x.org ORDER BYmanager"db2 "OPEN c1"2. User b:db2 "UPDATE x.org SET manager=60 WHERE manager=10"3. 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: DQUESTION 104:Which of the following can be locked explicitly?A. IndexesB. Catalog tablesC. Base user tablesD. Declared temporary tablesAnswer: CActualtests.com - The Power of Knowing

Page 42: DB2 - 703 - dumps

000-703QUESTION 105:Using Read Stability isolation level, Application A updates row X and does NOTissue a COMMIT.Using Uncommitted Read isolation level, Application B attempts to read row X.What is the result of Application B's 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 A'supdate.D. Application B will receive the version of row X that existed prior to Application A'supdate.Answer: CQUESTION 106:Application A updates row R in table T using a cursor with an isolation level ofRead Stability. Application B intends to read row R from table T after application Aupdates the row and application A still has an outstanding unit of work.Which of the following isolation levels would application B require to successfullycomplete this task?A. Read StabilityB. Repeatable ReadC. Uncommitted ReadD. Cursor StabilityAnswer: CQUESTION 107:Using Uncommitted Read isolation level, Application A updates row X and doesNOT issue a COMMIT.Using Read Stability isolation level, Application B attempts to read row X.What is the result of Application B's 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 A'supdate.D. Application B will receive the version of row X that existed prior to Application A'supdate.Answer: BActualtests.com - The Power of Knowing

Page 43: DB2 - 703 - dumps

000-703QUESTION 108:Which of the following connection handle attributes affects concurrency bychanging the isolation level of ODBC/CLI applications?A. SQL_ATTR_CONNECTTYPEB. SQL_ATTR_CONCURRENCYC. SQL_ATTR_CURSOR_TYPED. SQL_ATTR_TXN_ISOLATIONAnswer: DQUESTION 109:The following statements were successfully executed in sequence in a distributedunit 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: AQUESTION 110: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: BActualtests.com - The Power of Knowing

Page 44: DB2 - 703 - dumps

000-703QUESTION 111:Which of the following SQL statements correctly demonstrates parameter markerusage?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: AQUESTION 112:Which of the following SQL statements, if issued dynamically, correctly usesparameter markers?A. SELECT c1, ? FROM t1B. SELECT c1, INTEGER(?) FROM t1C. SELECT c1, ? AS INTEGER FROM t1D. SELECT c1, CAST(? AS INTEGER) FROM t1Answer: DQUESTION 113:Which of the following JDBC interfaces has methods that permit the use ofparameter markers?A. ResultSetB. StatementC. ConnectionD. CallableStatementAnswer: DQUESTION 114:Which of the following ODBC/CLI APIs can be used to retrieve the expected SQLtype associated with a parameter marker after a successful SQLPrepare() call?A. SQLGetInfo()B. SQLGetParam()C. SQLGetDescRec()D. SQLBindParameter()Actualtests.com - The Power of Knowing

Page 45: DB2 - 703 - dumps

000-703Answer: CQUESTION 115: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 forprocessing?A. SQLFetch()B. SQLRowCount()C. SQLMoreResults()D. SQLCloseCursor()Answer: CQUESTION 116:Which of the following ODBC/CLI statement handle attributes can be set to permitretrieval of multiple rows with a single SQLFetch() call?A. SQL_ATTR_MAX_ROWSB. SQL_ATTR_ROWSET_SIZEC. SQL_ATTR_PARAMSET_SIZED. SQL_ATTR_ROW_ARRAY_SIZEAnswer: DQUESTION 117:Which two of the following parameter styles are valid for registering a Java UDF?A. SQLB. JAVAC. DB2SQLD. GENERALE. DB2GENERALF. GENERAL WITH NULLSAnswer: BEQUESTION 118:Given the following type definition:CREATE DISTINCT TYPE money AS DECIMAL(11,2)WITH COMPARISONS;Actualtests.com - The Power of Knowing

Page 46: DB2 - 703 - dumps

000-703Which of the following is the best choice for the implementation of the subtractionoperation for two values of money data type?A. Stored ProcedureB. Check ConstraintC. Table User Defined FunctionD. Sourced User Defined FunctionAnswer: DQUESTION 119:Which two of the following features are the specific benefits of stored procedures inthe 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: DEQUESTION 120: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: CQUESTION 121:An application needs to retrieve a large number of rows from a database across thenetwork and compute a single value from the retrieved data.Which of the following methods will reduce the network traffic between the clientand server?A. Use a triggerB. Use a stored procedureC. Combine all rows into a LOBActualtests.com - The Power of Knowing

Page 47: DB2 - 703 - dumps

000-703D. Combine all rows into a User-Defined TypeAnswer: BQUESTION 122: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: DQUESTION 123:Given the following SQL Stored Procedure:CREATE PROCEDURE Proc2 ( )LANGUAGE SQLP1: BEGINDECLARE CONTINUE HANDLER FOR SQLSTATE '38S01'ErrHandler: BEGININSERT INTO result VALUES(Handler Fired');RESIGNAL SQLSTATE '38S01'SET MESSAGE_TEXT='Error occured 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 thefollowing messages will be inserted into the result table?A. 'Start''Handler Fired'B. 'Start''Handler Fired''End'C. 'Start''Handler Fired''After Resignal'D. 'Start''Handler Fired''After Resignal'Actualtests.com - The Power of Knowing

Page 48: DB2 - 703 - dumps

000-703'End'Answer: AQUESTION 124: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 TOCALLER clause is missing on the DECLARE statement.D. All rows of table T1 are returned to the procedure caller in an array structure and awarning is returned by the procedure because the cursor is not closed.Answer: AQUESTION 125:DB2 Development Center can be used to develop which of the following?A. SQL triggersB. External UDFsC. SQL stored proceduresD. External stored proceduresAnswer: CQUESTION 126:Which statement describes the process of creating an SQL stored procedurethrough 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 thenbound to the database server system.Actualtests.com - The Power of Knowing

Page 49: DB2 - 703 - dumps

000-703C. The procedure is precompiled and compiled on the development workstation and thenregistered on the database server system.D. The procedure is precompiled on the development workstation and then compiled andregistered on the database server system.Answer: AActualtests.com - The Power of Knowing