Beruflich Dokumente
Kultur Dokumente
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
1. A function-based index may be made using your own functions, but only if
the function is created using the DETERMINISTIC clause. True or False? Mark for Review
(1) Points
True (*)
False
DECLARE
emp_info EmpRec;
UPDATE employees SET salary = salary * 1.1 WHERE employee_id = emp_id -- Position A
dbms_output.put_line('Just gave a raise to ' || emp_info.last_name || ', who now makes ' ||
emp_info.salary);
END;
(1) Points
3. In the following example, where do you place the phrase BULK COLLECT?
...
BEGIN
SELECT -- Position A
salary -- Position B
-- Position D
...
(1) Points
Position A
Position B (*)
Position C
Position D
DECLARE
emp_info EmpRec;
BEGIN
END;
(1) Points
True (*)
False
Correct Correct
employees.department_id%TYPE)
IS v_total_sal NUMBER;
BEGIN
END total_sal;
(1) Points
Position A
Position B (*)
Position C
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
6. Deterministic means the function will always return the same output return
value for any given set of input argument values. True or False? Mark for Review
(1) Points
True (*)
False
7. You want to take make a copy of all the cities in the world listed in the cities
table, which contains millions of rows. The following procedure accomplishes this efficiently. True or
False?
CREATE OR REPLACE PROCEDURE copy_cities IS
v_citiestab t_emp;
BEGIN
FORALL i IN v_citiestab.FIRST..v_citiestab.LAST
END copy_cities;
(1) Points
True (*)
False
8. Which of the following are NOT benefits of using the NOCOPY hint? (Choose
two) Mark for Review
(1) Points
(1) Points
True
False (*)
10. You want to create a function which drops a table. You write the following
code:
(p_tab_name IN VARCHAR2)
RETURN BOOLEAN IS
BEGIN
RETURN TRUE;
EXCEPTION
END;
(1) Points
Because the PL/SQL compiler cannot check if the argument of p_tab_name is a valid table-
name (*)
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
11. Examine the following procedure, which drops a table whose name is passed
as an IN parameter:
(p_table_name IN VARCHAR2) IS
v_sql_statement VARCHAR2(100);
BEGIN
...
END;
Which of the following will work correctly when coded in the procedure's executable section?
(Choose two.)
(1) Points
(*)
UPDATE employees
(1) Points
13. For which of the following is it necessary to use Dynamic SQL? (Choose
three.) Mark for Review
(1) Points
GRANT (*)
ALTER (*)
SAVEPOINT
UPDATE
DROP (*)
BEGIN
END LOOP;
END;
(1) Points
The procedure will raise an exception because Dynamic SQL can drop tables but cannot drop
views.
The procedure will not compile successfully because the syntax of EXECUTE IMMEDIATE is
incorrect.
Correct Correct
15. The easiest way to include DDL statements in a PL/SQL block is to use the
DBMS_SQL package. True or False? Mark for Review
(1) Points
True
False (*)
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
1. To create a list movies from a catalog of millions of titles, you could use the
following code statement to create a collection. True or False?
...
Title_tab nametab;
...
SELECT title BULK COLLECT INTO title_tab FROM movies ORDER BY rental_count DESC;
...
(1) Points
True (*)
False
Correct Correct
2. What is the main purpose for using the RETURNING clause? Mark for
Review
(1) Points
Return more readily any exceptions that are raised by the statement
DECLARE
TYPE EmpRec IS RECORD (last_name employees.last_name%TYPE, salary employees.salary%TYPE);
emp_info EmpRec;
BEGIN
UPDATE employees SET salary = salary * 1.1 WHERE employee_id = emp_id -- Position A
dbms_output.put_line('Just gave a raise to ' || emp_info.last_name || ', who now makes ' ||
emp_info.salary);
END;
(1) Points
DECLARE
emp_info EmpRec;
BEGIN
END;
(1) Points
True (*)
False
Correct Correct
5. In the following example, where do you place the phrase BULK COLLECT?
...
BEGIN
SELECT -- Position A
salary -- Position B
-- Position D
...
(1) Points
Position A
Position B (*)
Position C
Position D
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
6. Which of the following are NOT benefits of using the NOCOPY hint? (Choose
two) Mark for Review
(1) Points
7. You want to take make a copy of all the cities in the world listed in the cities
table, which contains millions of rows. The following procedure accomplishes this efficiently. True or
False?
v_citiestab t_emp;
BEGIN
FORALL i IN v_citiestab.FIRST..v_citiestab.LAST
END copy_cities;
(1) Points
True (*)
False
Correct Correct
8. A function-based index may be made using your own functions, but only if
the function is created using the DETERMINISTIC clause. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
9. Only one call to DBMS_SQL is needed in order to drop a table. True or False?
Mark for Review
(1) Points
True
False (*)
Correct Correct
BEGIN
END LOOP;
END;
(1) Points
The procedure will raise an exception because Dynamic SQL can drop tables but cannot drop
views.
The procedure will raise an exception because one of the views is a complex view.
The procedure will not compile successfully because the syntax of EXECUTE IMMEDIATE is
incorrect.
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
11. When SQL statements are included within a procedure, the statements are
parsed when the procedure is compiled. True or False? Mark for Review
(1) Points
True (*)
False
Correct Correct
12. Which is the correct order for the execution flow of SQL? Mark for
Review
(1) Points
Execute
Parse
Fetch
Bind
Bind
Parse
Execute
Fetch
Parse
Fetch
Bind
Execute
Parse
Bind
Execute
Fetch
(*)
BEGIN
END LOOP;
END;
Mark for Review
(1) Points
The first three functions in the user's schema will be recompiled. (*)
The procedure will not compile successfully because the syntax of the ALTER FUNCTION
statement is incorrect.
The procedure will not compile successfully because you cannot ALTER functions using
Dynamic SQL.
Correct Correct
14. Name two reasons for using Dynamic SQL. Mark for Review
(1) Points
(Choose all correct answers)
Provides the ability to handle mutating rows when executing a statement involving the same
table.
Provides the ability to execute SQL statements whose structure is unknown until execution
time. (*)
15. Name two reasons for using Dynamic SQL. Mark for Review
(1) Points
Creates a SQL statement with varying column data, or different conditions (*)
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
1. Which is the correct order for the execution flow of SQL? Mark for
Review
(1) Points
Parse
Fetch
Bind
Execute
Execute
Parse
Fetch
Bind
Bind
Parse
Execute
Fetch
Parse
Bind
Execute
Fetch
(*)
Correct Correct
2. Name two reasons for using Dynamic SQL. Mark for Review
(1) Points
Provides the ability to execute SQL statements whose structure is unknown until execution
time. (*)
Provides the ability to handle mutating rows when executing a statement involving the same
table.
Correct Correct
(1) Points
(Choose all correct answers)
SAVEPOINT
UPDATE
DROP (*)
ALTER (*)
GRANT (*)
Correct Correct
BEGIN
END LOOP;
END;
(1) Points
The procedure will raise an exception because one of the views is a complex view.
The procedure will raise an exception because Dynamic SQL can drop tables but cannot drop
views.
The procedure will not compile successfully because the syntax of EXECUTE IMMEDIATE is
incorrect.
Correct Correct
5. A programmer wants to code a procedure which will create a table with a
single column. The datatype of the column will be chosen by the user who invokes the procedure.
The programmer writes the following code:
(p_col_datatype IN VARCHAR2) IS
BEGIN
END;
(1) Points
Because the invoking user may not have CREATE TABLE privilege
Because when the procedure is compiled, Oracle cannot check if the parameter value passed
into the procedure is a valid column datatype (*)
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
(1) Points
SAVEPOINT
DELETE
ALTER (*)
GRANT (*)
Correct Correct
7. A SQL statement can pass through several stages. Which of the following is
NOT one of these stages? Mark for Review
(1) Points
PARSE
FETCH
BIND
RETURN (*)
EXECUTE
Correct Correct
8. Where would you place the BULK COLLECT statement in the following
example?
DECLARE
dept_recs DeptRecTab;
CURSOR c1 IS
-- Position A
FROM departments
BEGIN
OPEN c1
-- Position B;
FETCH c1
-- Position C
INTO dept_recs;
END;
Mark for Review
(1) Points
Position A
Position B
Position C (*)
Correct Correct
9. FORALL can be used with any DML statement. True or False? Mark for
Review
(1) Points
True (*)
False
Correct Correct
10. What is the correct syntax to use the RETURNING phrase at Position A?
DECLARE
emp_info EmpRec;
BEGIN
UPDATE employees SET salary = salary * 1.1 WHERE employee_id = emp_id -- Position A
dbms_output.put_line('Just gave a raise to ' || emp_info.last_name || ', who now makes ' ||
emp_info.salary);
END;
(1) Points
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct
answer.
Section 12 Quiz
11. What are benefits of using the NOCOPY hint? (Choose two) Mark for
Review
(1) Points
Correct Correct
12. The following example code will compile successfully. True or False?
BEGIN
-- remaining code
END dept_proc;
(1) Points
True (*)
False
Incorrect Incorrect. Refer to Section 12 Lesson 2.
13. FORALL can only be used with the INSERT statement. True or False?
Mark for Review
(1) Points
True
False (*)
v_emptab t_emp;
BEGIN
FORALL i IN v_emptab.FIRST..v_emptab.LAST
END insert_emps;
(1) Points
15. The following statement is a valid example of using the RETURNING clause.
True or False?
DECLARE
emp_info EmpRec;
END;
(1) Points
True (*)
False
Correct Correct