Sie sind auf Seite 1von 3

3 6 2014 final_I_1.

htm
file:///C:/Users/Administrator/Desktop/CATAY/final_I_1.htm 1/3
Test: Semester 1 Final Exam
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 9
(Answer all questions in this section)
1. You want to see the names, modes and data types of the formal parameters of
function MY_FUNC in your schema. How can you do this? (Choose two)
Mark for Review
(1) Points
(Choose all correct answers)
Query USER_PARAMETERS
Query USER_SOURCE (*)
Query USER_FUNCTIONS
SHOW PARAMETER my_func;
DESCRIBE my_func; (*)
Correct
2. You want to remove the procedure NO_NEED from your schema. You execute:
DROP PROCEDURE no_need;
Which Data Dictionary views are updated automatically?
Mark for Review
(1) Points
USER_PROCEDURES
USER_OBJECTS
USER_SOURCE
All of the above. (*)
None of the above.
Correct
3. Which Data Dictionary view can be used to display the detailed code of a procedure in
your schema?
Mark for Review
(1) Points
USER_PROCEDURES
USER_OBJECTS
USER_SOURCE (*)
USER_SUBPROGRAMS
None of the above.
Correct
4. What will happen when the following procedure is executed?
PROCEDURE log_usage (p_card_id NUMBER, p_loc NUMBER)
IS
PRAGMA AUTONOMOUS_TRANSACTION
BEGIN
INSERT INTO log_table (card_id, location, tran_date)
VALUES (p_card_id, p_loc, SYSDATE);
COMMIT;
END log_usage;
Mark for Review
(1) Points
The subprogram will fail because the PRAGMA statement must be before IS.
The subprogram will fail because it is missing AUTHID CURRENT_USER before IS.
The compilation will fail because a semicolon after AUTONOMOUS_TRANSACTION is
required. (*)
The program will compile successfully.
Correct
5. User REYHAN creates the following procedure:
CREATE PROCEDURE proc1 AUTHID CURRENT_USER
IS
v_count NUMBER;
BEGIN
SELECT COUNT(*) INTO v_count
FROM tom.employees;
Mark for Review
(1) Points
3 6 2014 final_I_1.htm
file:///C:/Users/Administrator/Desktop/CATAY/final_I_1.htm 2/3
END;
User BILL wants to execute this procedure. What privileges will BILL need?
EXECUTE on REYHAN.PROC1 and SELECT on TOM.EMPLOYEES (*)
EXECUTE on REYHAN.PROC1
SELECT on TOM.EMPLOYEES
BILL needs no privileges
None of the above. The procedure will fail to compile because REYHAN does not
have SELECT privilege on TOM.EMPLOYEES.
Correct
6. How do you specify that you want a procedure MYPROCA to use "Definer's Rights"?
Mark for Review
(1) Points
CREATE OR REPLACE PROCEDURE myproca
AUTHID CURRENT_USER IS...
CREATE OR REPLACE PROCEDURE myproca
AUTHID OWNER IS...
GRANT DEFINER TO myprocA;
ALTER PROCEDURE myproca TO DEFINER;
Definer's Rights are the default, therefore no extra code or commands are needed.
(*)
Correct
7. The function avg_ann_sal returns the average annual salary for a particular department.
The example below is a valid use of of this function. True or False?
SELECT first_name, last_name
FROM employees
WHERE avg_ann_sal(20) > 15000;
Mark for Review
(1) Points
True (*)
False
Correct
8. Why will the following statement fail?
SELECT employee_id, tax(p_value => salary)
FROM employees;
Mark for Review
(1) Points
User-defined functions are not allowed in the SELECT clause
Name notation is not allowed (*)
The data type for the tax variable does not match the data type for salary
The statement will execute and not fail
Correct
9. When creating a user-defined function, the size of the returned values may be up to
the size of any PL/SQL data type. True or False?
Mark for Review
(1) Points
True
False (*)
Correct
10. A function named MYFUNC has been created. This function accepts one IN parameter
of datatype VARCHAR2 and returns a NUMBER. You want to invoke the function within
the following anonymous block:
DECLARE
v_var1 NUMBER(6,2);
BEGIN
-- Line A
END;
Mark for Review
(1) Points
3 6 2014 final_I_1.htm
file:///C:/Users/Administrator/Desktop/CATAY/final_I_1.htm 3/3
What could be coded at Line A?
myfunc('Crocodile') := v_var1;
myfunc(v_var1) := 'Crocodile';
myfunc(v_var1, 'Crocodile');
v_var1 := myfunc('Crocodile'); (*)
myfunc('Crocodile', v_var1);
Correct
Page 1 of 5 Next Summary

Das könnte Ihnen auch gefallen