Test: Final Exam Semester 2 Review your answers, feedback, and

advertisement
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*) i
ndicates a correct answer.
Section 11
1. You have created several directory objects in the database, as pointe
rs to operating system directories which contain BFILEs. Which data diction
ary view would you query to see these directories? Mark for Review
(1) Points
USER_DIRECTORIES
USER_BFILES
ALL_DIRECTORIES (*)
USER_EXTERNAL_FILES
ALL_BFILES
Correct
2. Which of the following statements about BFILEs are NOT true? (Choos
e two.) Mark for Review
(1) Points
(Choose all correct answers)
They are stored outside the database.
We can read BFILE data using the DBMS_LOB package.
We can grant SELECT object privilege on them. (*)
We can read BFILE data in a SELECT statement. (*)
The database contains a locator which points to the external BFILE.
Correct
3. The database administrator has created a directory as follows:
CREATE DIRECTORY filesdir AS 'C:\BFILEDIR';
How would the DBA allow all database users to query the BFILEs in this di
rectory?
Mark for Review
(1) Points
GRANT READ ON filesdir TO PUBLIC;
GRANT READ ON DIRECTORY filesdir TO PUBLIC; (*)
GRANT SELECT ON filesdir TO PUBLIC;
GRANT QUERY ON DIRECTORY filesdir TO PUBLIC;
GRANT READ ON 'C:\BFILEDIR' TO PUBLIC;
Correct
4. Table NEWEMP contains a PHOTO_ID column of datatype LONG RAW. W
hich of the following will convert this column to a suitable new LOB
datatype? Mark for Review
(1) Points
ALTER TABLE newemp COLUMN (photo_id BLOB);
ALTER TABLE newemp MODIFY (photo_id BFILE);
ALTER TABLE newemp MODIFY (photo_id BLOB);
(*)
ALTER TABLE newemp DROP COLUMN (photo_id);
ALTER TABLE newemp ADD (photo_id BLOB);
ALTER TABLE newemp COLUMN (photo_id LONG RAW);
Correct
5. Which of the following methods can be used to query CLOB data valu
es? (Choose two.) Mark for Review
(1) Points
(Choose all correct answers)
SELECT (*)
DBMS_LOB.PUT
DBMS_LOB.GETLENGTH
DBMS_LOB.READ (*)
Correct
6. You need to store very large amounts of text data in a table column i
nside the database. Which datatype should you use for this column? Mark fo
r Review
(1) Points
CLOB (*)
BLOB
LONG
VARCHAR2(4000)
None of the above
Correct
7. BLOB, JPEG, BFILE and MP3 are all LOB column datatypes. True or
False? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 11.
8. CLOB and BLOB are internal LOB datatypes, while BFILE is an extern
al LOB datatype. True or False? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 11.
9. Which of the following successfully declares an INDEX BY table
named DEPT_NAMES_TAB, which could be used to store all the departme
nt names from the DEPARTMENTS table? Mark for Review
(1) Points
DECLARE
TYPE t_dnames IS TABLE OF
departments.department_name%TYPE
INDEX BY INTEGER;
dept_names_tab t_dnames;
DECLARE
TYPE t_dnames IS TABLE OF
departments.department_name%TYPE
INDEX BY BINARY_INTEGER;
dept_names_tab t_dnames;
(*)
DECLARE
TYPE t_dnames IS TABLE OF
departments.department_name%TYPE
INDEX BY PLS_INTEGER;
dept_names_tab t_dnames%TYPE;
DECLARE
TYPE t_dnames IS TABLE OF
department_name
INDEX BY BINARY_INTEGER;
dept_names_tab t_dnames;
Correct
10. The following code declares an INDEX BY table and populates it wi
th employees' salaries, using the employee_id as the BINARY_INTEGER inde
x of the table:
DECLARE
TYPE t_emp_sals IS TABLE OF employees.salary%TYPE
INDEX BY BINARY_INTEGER;
emp_sals_tab t_emp_sals;
BEGIN
FOR v_emprec IN (SELECT employee_id, salary FROM employees)
LOOP
-- Line A
END LOOP;
END;
What must be coded at Line A?
Mark for Review
(1) Points
emp_sals_tab(employee_id) := v_emprec.salary;
t_emp_sals(v_emprec.employee_id) := v_emprec.salary;
emp_sals_tab(v_emprec.employee_id) := v_emprec.salary; (*)
emp_sals_tab(i) := v_emprec.salary;
Correct
Page 1 of 2
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*) i
ndicates a correct answer.
Section 11
11. Examine the following code:
DECLARE
CURSOR emp_curs IS
SELECT employee_id, first_name, last_name FROM employees;
TYPE t_mytype IS TABLE OF -- Point A
INDEX BY BINARY_INTEGER;
v_mytab t_mytype;
Which of the following can be coded at Point A?
Mark for Review
(1) Points
employees%ROWTYPE
employees.salary%TYPE
emp_curs%ROWTYPE
Any one of the above (*)
None of the above
Correct
12. Package ED_PACK has declared a record type named ED_TYPE in the
package specification. Which of the following anonymous blocks successf
ully declares a variable whose datatype is ED_TYPE? Mark for Review
(1) Points
DECLARE
v_ed_rec IS RECORD ed_pack.ed_type;
BEGIN ...
DECLARE
v_ed_rec ed_pack.ed_type;
BEGIN ...
(*)
DECLARE
v_ed_rec ed_pack.ed_type%ROWTYPE;
BEGIN...
DECLARE
v_ed_rec ed_pack.ed_type%TYPE;
BEGIN ...
None of the above. Variables of datatype ED_TYPE can be declared on
ly within ED_PACK, not in separate subprograms or anonymous blocks.
Correct
13. Which of the following will declare a composite PL/SQL data ty
pe named COMPO_TYPE, containing two fields named FIELD1 and FIELD2?
Mark for Review
(1) Points
DECLARE
compo_type
(field1 NUMBER,
field2 VARCHAR2(30));
DECLARE
TYPE compo_type IS
(field1 NUMBER,
field2 VARCHAR2(30));
DECLARE
TYPE compo_type IS RECORD
(field1 NUMBER,
field2 VARCHAR2(30));
(*)
DECLARE
compo_type IS RECORD
(field1 NUMBER,
field2 VARCHAR2(30));
Correct
Section 12
14. Package EMPPACK contains a public procedure GET_EMP, which
contains a reference to the EMPLOYEES table. Procedure CALL_EMP in
vokes EMPPACK.GET_EMP. The following SQL statement is executed:
ALTER TABLE employees ADD (gender CHAR(1));
Which one of the following statements is true?
Mark for Review
(1) Points
The specification and body of EMPPACK are invalidated, but CALL_EMP
remains valid.
The body of EMPPACK is invalidated, but the specification remains valid.
(*)
EMPPACK.GET_EMP is invalidated, but other procedures in EMPPACK
remain valid.
Nothing is invalidated because the PL/SQL code does not reference th
e GENDER column.
Correct
15. Examine the following code:
CREATE VIEW ed_view AS
SELECT * FROM employees NATURAL JOIN departments;
CREATE PROCEDURE ed_proc IS
CURSOR ed_curs IS SELECT * FROM ed_view;
Which of the following statements about dependencies are true? (Choose two
.)
Mark for Review
(1) Points
(Choose all correct answers)
ED_PROC is indirectly dependent on DEPARTMENTS (*)
EMPLOYEES is referenced by ED_VIEW (*)
ED_CURS is directly dependent on ED_VIEW
ED_PROC is referenced by ED_VIEW
ED_PROC is directly dependent on EMPLOYEES
Correct
16. A SELECT from the DEPTREE table displays table LOCATIONS at ne
sted level 0 and procedure LOCPROC at nested level 2. This shows that
LOCPROC is directly dependent on LOCATIONS. True or False? Mark for
Review
(1) Points
True
False (*)
Incorrect. Refer to Section 12.
17. Which of the following will display dependency information which
has been generated by executing the DEPTREE_FILL procedure? (Choose tw
o.) Mark for Review
(1) Points
(Choose all correct answers)
The USER_DEPENDENCIES view
The DEPTREE view (*)
The UTLDTREE script
The DISPLAY_DEPTREE view
The IDEPTREE view (*)
Correct
18. A procedure includes the following code:
CURSOR loc_curs IS SELECT location_id, city, country_id FROM location
s;
Which of the following changes to the LOCATIONS table will allow the proc
edure to be recompiled successfully without editing its code? (Choose two
.)
Mark for Review
(1) Points
(Choose all correct answers)
RENAME locations TO new_locations;
ALTER TABLE locations ADD (climate VARCHAR2(30)); (*)
ALTER TABLE locations DROP COLUMN city;
ALTER TABLE locations DROP COLUMN postal_code; (*)
Correct
19. Which of the following is NOT created when the utldtree.sql script is
run? Mark for Review
(1) Points
The DEPTREE view
The DEPTREE_FILL procedure
The USER_DEPENDENCIES view (*)
The DEPTREE_TEMPTAB table
Correct
20. Examine the following code:
CREATE FUNCTION deptfunc
RETURN NUMBER IS
v_count NUMBER(6);
BEGIN
SELECT COUNT(*) INTO v_count FROM departments;
RETURN v_count;
END;
Which of the following will display the dependency between DEPTFU
NC and DEPARTMENTS?
Mark for Review
(1) Points
SELECT name, type
FROM user_dependencies
WHERE name IN ('DEPTFUNC','DEPARTMENTS');
SELECT name, type, referenced_name, referenced_type
FROM user_dependencies
WHERE referenced_name = 'DEPARTMENTS'
AND referenced_type = 'TABLE';
(*)
SELECT name, type, referenced_name, referenced_type
FROM user_dependencies
WHERE name = 'DEPARTMENTS'
AND type = 'TABLE';
SELECT object_name, object_type
FROM user_objects
WHERE object_name IN ('DEPARTMENTS','DEPTFUNC')
AND referenced = 'YES';
Correct
Page 2 of 2
Download