問題1
A PHP Web application uses the ibm_db2 extension to establish a persistent connection to a remote database. What must be true of the connections to make full use of the db2_pconnect() API?
A PHP Web application uses the ibm_db2 extension to establish a persistent connection to a remote database. What must be true of the connections to make full use of the db2_pconnect() API?
正確答案: C
問題2
The table shown below exists within a database:
CREATE TABLE s1.t1 ( c1 INTEGER NOT NULL PRIMARY KEY, c2 CLOB( 2G ) )
A CLI/ODBC application uses the SQLGetSubString() API to retrieve the first 1024 and last 1024
bytes of data from column C2.
Which mechanism is used to minimize the amount of data sent to the client for this operation?
The table shown below exists within a database:
CREATE TABLE s1.t1 ( c1 INTEGER NOT NULL PRIMARY KEY, c2 CLOB( 2G ) )
A CLI/ODBC application uses the SQLGetSubString() API to retrieve the first 1024 and last 1024
bytes of data from column C2.
Which mechanism is used to minimize the amount of data sent to the client for this operation?
正確答案: C
問題3
While developing a Java JDBC application, you use the set of statements shown below:
Connection con;
PreparedStatementpstmt;
intnumUpd;
pstmt= con.prepareStatement("UPDATE EMPLOYEE SET PHONENO='4657' WHERE
EMPNO=?");
pstmt.setString(0, "000010");
numUpd= pstmt.executeUpdate();
pstmt.close();
Assuming a connection has already been established, which statement is true?
While developing a Java JDBC application, you use the set of statements shown below:
Connection con;
PreparedStatementpstmt;
intnumUpd;
pstmt= con.prepareStatement("UPDATE EMPLOYEE SET PHONENO='4657' WHERE
EMPNO=?");
pstmt.setString(0, "000010");
numUpd= pstmt.executeUpdate();
pstmt.close();
Assuming a connection has already been established, which statement is true?
正確答案: D
問題4
Click the Exhibit button. CREATE TABLE s1.mytab (col1 INTEGER GENERATED ALWAYS AS IDENTITY, col2 INTEGER, col3 INTEGER, CHECK (col1+col3 < 500) CREATE VARIABLE s1.var1 INTEGER DEFAULT (99) CREATE FUNCTION s1.add100 (p1 INT, p2 INT) RETURNS INTEGER LANGUAGE SQL DETERMINISTIC NOT FENCED BEGIN SET p1= p2+100; RETURN p1;END Given the table, variable, and function definitions shown in the exhibit, which two statements contain a valid invocation of the add100 function? (Choose two.)
Click the Exhibit button. CREATE TABLE s1.mytab (col1 INTEGER GENERATED ALWAYS AS IDENTITY, col2 INTEGER, col3 INTEGER, CHECK (col1+col3 < 500) CREATE VARIABLE s1.var1 INTEGER DEFAULT (99) CREATE FUNCTION s1.add100 (p1 INT, p2 INT) RETURNS INTEGER LANGUAGE SQL DETERMINISTIC NOT FENCED BEGIN SET p1= p2+100; RETURN p1;END Given the table, variable, and function definitions shown in the exhibit, which two statements contain a valid invocation of the add100 function? (Choose two.)
正確答案: A,D
問題5
Given the table shown below:
COURSES
ID CODE NAME
1 ECE100 Operating Systems
2 ECE101 Programming Languages
User USER1 executes the following statements:
DECLARE GLOBAL TEMPORARY TABLE tempcourses
LIKE db2user.courses
ON COMMIT PRESERVE ROWS;
INSERT INTO session.tempcourses SELECT * FROM db2user.courses;
INSERT INTO session.tempcourses VALUES (3, 'ECE102', 'Databases');
SELECT max(ID) FROM db2user.courses;
User USER2 executes the following statements:
DECLARE GLOBAL TEMPORARY TABLE tempcourses
LIKE db2user.courses;
ON COMMIT PRESERVE ROWS;
INSERT INTO session.tempcourses SELECT * FROM db2user.courses;
INSERT INTO session.tempcourses VALUES (4, 'ECE103', 'Algorithms');
SELECT max(ID) FROM session.tempcourses;
Which results do USER1 and USER2 obtain?
Given the table shown below:
COURSES
ID CODE NAME
1 ECE100 Operating Systems
2 ECE101 Programming Languages
User USER1 executes the following statements:
DECLARE GLOBAL TEMPORARY TABLE tempcourses
LIKE db2user.courses
ON COMMIT PRESERVE ROWS;
INSERT INTO session.tempcourses SELECT * FROM db2user.courses;
INSERT INTO session.tempcourses VALUES (3, 'ECE102', 'Databases');
SELECT max(ID) FROM db2user.courses;
User USER2 executes the following statements:
DECLARE GLOBAL TEMPORARY TABLE tempcourses
LIKE db2user.courses;
ON COMMIT PRESERVE ROWS;
INSERT INTO session.tempcourses SELECT * FROM db2user.courses;
INSERT INTO session.tempcourses VALUES (4, 'ECE103', 'Algorithms');
SELECT max(ID) FROM session.tempcourses;
Which results do USER1 and USER2 obtain?
正確答案: B
問題6
Click the Exhibit button. CREATE FUNCTION deptemployees (idept VARCHAR(3)) RETURNS TABLE (empno CHAR(6), firstnameVARCHAR(12), lastnameVARCHAR(15)) LANGUAGE SQL READS SQL DATA NO EXTERNAL ACTION DETERMINISTIC RETURN SELECT empno, firstnme, lastname FROM employee WHERE workdept = deptemployees.idept; Referring to the exhibit, what contains the proper way to invoke the DEPTEMPLOYEES() user-defined function to return all of the employees that work in department D11?
Click the Exhibit button. CREATE FUNCTION deptemployees (idept VARCHAR(3)) RETURNS TABLE (empno CHAR(6), firstnameVARCHAR(12), lastnameVARCHAR(15)) LANGUAGE SQL READS SQL DATA NO EXTERNAL ACTION DETERMINISTIC RETURN SELECT empno, firstnme, lastname FROM employee WHERE workdept = deptemployees.idept; Referring to the exhibit, what contains the proper way to invoke the DEPTEMPLOYEES() user-defined function to return all of the employees that work in department D11?
正確答案: B
問題7
.While developing a CLI application, you use the code shown below:
SQLCHAR *stmt = (SQLCHAR *)"DELETE FROM org WHERE deptnumb = ? ";
cliRC= SQLSetStmtAttr(hstmt, SQL_ATTR_DEFERRED_PREPARE,
SQL_DEFERRED_PREPARE_ON )
cliRC= SQLPrepare(hstmt, stmt, SQL_NTS);
Now, the ORG table does not exist in the database.
What will be the value of "cliRC" after executing the SQLPrepare command?
.While developing a CLI application, you use the code shown below:
SQLCHAR *stmt = (SQLCHAR *)"DELETE FROM org WHERE deptnumb = ? ";
cliRC= SQLSetStmtAttr(hstmt, SQL_ATTR_DEFERRED_PREPARE,
SQL_DEFERRED_PREPARE_ON )
cliRC= SQLPrepare(hstmt, stmt, SQL_NTS);
Now, the ORG table does not exist in the database.
What will be the value of "cliRC" after executing the SQLPrepare command?
正確答案: C
問題8
Which SQL procedure will retrieve all the rows from table T1 and make those rows available to the invoker as a result set?
Which SQL procedure will retrieve all the rows from table T1 and make those rows available to the invoker as a result set?
正確答案: A
問題9
Which CLI/ODBC function would be used to update multiple rows in a table?
Which CLI/ODBC function would be used to update multiple rows in a table?
正確答案: A
問題10
Given the SQL statement shown below:
UPDATE address SET number_street =
(SELECT address FROM employee
WHERE address.empid = employee.empid)
WHERE number_street IS NULL
Which comment is true?
Given the SQL statement shown below:
UPDATE address SET number_street =
(SELECT address FROM employee
WHERE address.empid = employee.empid)
WHERE number_street IS NULL
Which comment is true?
正確答案: B