Test: Final Exam Semester 2

advertisement
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
1.
We want to store a complete copy of the DEPARTMENTS
table (all the rows and all the columns) in a single PL/SQL variable. Which
of the following kinds of variable could we use?
Mark for Review
(1) Points
An INDEX BY table
A record
An INDEX BY table of records (*)
A CLOB
An explicit cursor
Correct
2.
Which of the following successfully declares an
INDEX BY table named DEPT_NAMES_TAB, which could be used to store all the
department 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
3.
An INDEX BY table of records can store a maximum of
255 records. True or False?
Mark for Review
(1) Points
True
False (*)
Correct
4.
You have created several directory objects in the
database, as pointers to operating system directories which contain BFILEs.
Which data dictionary view would you query to see these directories?
Mark for Rev
(1) Points
USER_DIRECTORIES
USER_BFILES
ALL_DIRECTORIES (*)
USER_EXTERNAL_FILES
ALL_BFILES
Correct
5.
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
directory?
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
Page 1 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
6.
The BIGEMP table contains a RESUME column of
datatype BFILE, which has been populated with locator values. The following
code reads a BFILE locator value into a variable, then checks whether the
BFILE itself exists in the operating system directory. If the file is
present, the code opens the file and reads its contents. What should be
coded at Point A?
DECLARE
v_locator BFILE;
BEGIN
SELECT resume INTO v_locator FROM bigemp
WHERE employee_id = 100;
-- Point A
DBMS_LOB.FILEOPEN(v_locator);
DBMS_LOB.READ(v_locator, ....); ....
DBMS_LOB.FILECLOSE(v_locator);
END IF;
END;
Mark for Review
(1) Points
IF BFILENAME(v_locator) EXISTS THEN
IF DBMS_LOB.FILEEXISTS(v_locator) = 1
THEN (*)
IF DBMS_LOB.FILEEXISTS(v_locator)
THEN
IF DBMS_LOB.FILEEXISTS THEN
IF BFILEEXISTS(v_locator) THEN
Correct
7.
Which of the following best describes the difference
between BLOB and BFILE data?
Mark for Review
(1) Points
A BLOB can contain text data while a
BFILE cannot.
BLOB data is stored inside the
database, while BFILE data is outside the database in separate operating
system files. (*)
The maximum size of a BLOB is 2GB; a
BFILE can be up to 128TB if needed.
A table can contain several BLOB
columns but only one BFILE column.
There is no difference between a BLOB
and a BFILE.
Correct
8.
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.
9.
CLOB and BLOB are internal LOB datatypes, while
BFILE is an external LOB datatype. True or False?
Mark for Review
(1) Points
True (*)
False
Correct
10.
A LONG column can be converted to CLOB using a
single ALTER TABLE command. True or False?
Mark for Review
(1) Points
True (*)
False
Correct
Page 2 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
11.
You need to add a new column to the EMPLOYEES table.
This column will store each employee's favourite movie. A movie can be up
to 4GB in size and the movies will be stored inside the database for better
security. Which datatype must you use for this column?
Mark for
Review
(1) Points
CLOB
BLOB (*)
LONG RAW
BFILE
LONG
Correct
12.
A procedure includes the following code:
CURSOR loc_curs IS SELECT location_id, city, country_id FROM locations;
Which of the following changes to the LOCATIONS table will allow the
procedure 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
13.
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
Incorrect. Refer to
Section 12.
14.
User BOB wants to know which objects reference his
DEPARTMENTS table. Which of the following must he execute to populate the
DEPTREE_TEMPTAB table?
Mark for Review
(1) Points
BEGIN
utldtree('DEPARTMENTS');
END;
BEGIN
deptree_fill('TABLE','BOB','DEPARTMENTS');
END;
(*)
BEGIN
deptree_fill('TABLE','DEPARTMENTS');
END;
BEGIN
ideptree('TABLE','BOB','DEPARTMENTS');
END;
Correct
15.
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
Page 3 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
16.
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 DEPTFUNC 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';
Incorrect. Refer to
Section 12.
17.
A single procedure can be both a referenced object
and a dependent object. True or False?
Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to
Section 12.
18.
When a table is dropped, all PL/SQL subprograms that
reference the table are automatically dropped. True or False?
Mark
for Review
(1) Points
True
False (*)
Correct
19.
Which of the following will declare a composite
PL/SQL data type 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
20.
A PL/SQL package named MYPACK declares a record type
named MYTYPE as a public variable in the package specification. Which of
the following anonymous blocks successfully declares a local variable of
datatype MYTYPE?
Mark for Review
(1) Points
DECLARE
v_myrec IS RECORD mypack.mytype;
BEGIN ...
DECLARE
v_myrec mypack.mytype;
BEGIN ...
(*)
DECLARE
v_myrec mytype;
BEGIN ...
DECLARE
v_myrec IS RECORD (mypack.mytype);
BEGIN ...
Correct
Page 4 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
1. The following code declares an INDEX BY table and populates it with
employees' salaries, using the employee_id as the BINARY_INTEGER index 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;
Incorrect. Refer to Section 11.
2. Which of the following successfully declares an INDEX BY table named
DEPT_NAMES_TAB, which could be used to store all the department 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
3. Which of the following PL/SQL data structures can store a collection?
(Choose two.) Mark for Review
(1) Points
(Choose all correct answers)
An INDEX BY table (*)
A record
%ROWTYPE
An INDEX BY table of records (*)
A BLOB
Incorrect. Refer to Section 11.
4. BFILEs are stored outside the database and can be queried and updated
by using procedures in DBMS_LOB. True or False? Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 11.
5. The BIGEMP table contains a RESUME column of datatype BFILE, which
has been populated with locator values. The following code reads a BFILE
locator value into a variable, then checks whether the BFILE itself exists
in the operating system directory. If the file is present, the code opens
the file and reads its contents. What should be coded at Point A?
DECLARE
v_locator BFILE;
BEGIN
SELECT resume INTO v_locator FROM bigemp
WHERE employee_id = 100;
-- Point A
DBMS_LOB.FILEOPEN(v_locator);
DBMS_LOB.READ(v_locator, ....); ....
DBMS_LOB.FILECLOSE(v_locator);
END IF;
END;
Mark for Review
(1) Points
IF BFILENAME(v_locator) EXISTS THEN
IF DBMS_LOB.FILEEXISTS(v_locator) = 1 THEN (*)
IF DBMS_LOB.FILEEXISTS(v_locator) THEN
IF DBMS_LOB.FILEEXISTS THEN
IF BFILEEXISTS(v_locator) THEN
Incorrect. Refer to Section 11.
Page 1 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
6. You have created several directory objects in the database, as
pointers to operating system directories which contain BFILEs. Which data
dictionary view would you query to see these directories? Mark for Review
(1) Points
USER_DIRECTORIES
USER_BFILES
ALL_DIRECTORIES (*)
USER_EXTERNAL_FILES
ALL_BFILES
Incorrect. Refer to Section 11.
7. When a table is dropped, all PL/SQL subprograms that reference the
table are automatically dropped. True or False? Mark for Review
(1) Points
True
False (*)
Correct
8. 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
Incorrect. Refer to Section 12.
9. Which of the following techniques will make it more likely that an
invalidated PL/SQL subprogram will recompile successfully? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
Declaring record structures using %ROWTYPE (*)
Using a cursor FOR loop instead of opening and closing the cursor
explicitly
SELECTing a list of column-names instead of using SELECT *
Including a column list with INSERT statements (*)
Incorrect. Refer to Section 12.
10. User BOB wants to know which objects reference his DEPARTMENTS
table. Which of the following must he execute to populate the
DEPTREE_TEMPTAB table? Mark for Review
(1) Points
BEGIN
utldtree('DEPARTMENTS');
END;
BEGIN
deptree_fill('TABLE','BOB','DEPARTMENTS');
END;
(*)
BEGIN
deptree_fill('TABLE','DEPARTMENTS');
END;
BEGIN
ideptree('TABLE','BOB','DEPARTMENTS');
END;
Correct
Page 2 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
11. A single procedure can be both a referenced object and a dependent
object. True or False? Mark for Review
(1) Points
True (*)
False
Correct
12. The PL/SQL variable V_LAST_NAME is used to store fetched values of
the LAST_NAME column of the EMPLOYEES table. To minimize dependency
failures, the variable should be declared as:
v_last_name VARCHAR2(25);
True or False?
Mark for Review
(1) Points
True
False (*)
Correct
13. Which of the following will display dependency information which has
been generated by executing the DEPTREE_FILL procedure? (Choose two.) 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 (*)
Incorrect. Refer to Section 12.
14. Which of the following best describes the difference between BLOB
and BFILE data? Mark for Review
(1) Points
A BLOB can contain text data while a BFILE cannot.
BLOB data is stored inside the database, while BFILE data is outside
the database in separate operating system files. (*)
The maximum size of a BLOB is 2GB; a BFILE can be up to 128TB if
needed.
A table can contain several BLOB columns but only one BFILE column.
There is no difference between a BLOB and a BFILE.
Incorrect. Refer to Section 11.
15. Table NEWEMP contains a PHOTO_ID column of datatype LONG RAW. Which
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);
Incorrect. Refer to Section 11.
Page 3 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
16. A LONG column can be converted to CLOB using a single ALTER TABLE
command. True or False? Mark for Review
(1) Points
True (*)
False
Correct
17. CLOB and BLOB are internal LOB datatypes, while BFILE is an external
LOB datatype. True or False? Mark for Review
(1) Points
True (*)
False
Incorrect. Refer to Section 11.
18. You need to store very large amounts of text data in a table column
inside the database. Which datatype should you use for this column? Mark
for Review
(1) Points
CLOB (*)
BLOB
LONG
VARCHAR2(4000)
None of the above
Incorrect. Refer to Section 11.
19. A PL/SQL package named MYPACK declares a record type named MYTYPE as
a public variable in the package specification. Which of the following
anonymous blocks successfully declares a local variable of datatype MYTYPE?
Mark for Review
(1) Points
DECLARE
v_myrec IS RECORD mypack.mytype;
BEGIN ...
DECLARE
v_myrec mypack.mytype;
BEGIN ...
(*)
DECLARE
v_myrec mytype;
BEGIN ...
DECLARE
v_myrec IS RECORD (mypack.mytype);
BEGIN ...
Incorrect. Refer to Section 11.
20. Which of the following will declare a composite PL/SQL data type
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
Page 4 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
1.
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
directory?
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
Correct
2.
You have created several directory objects in the
database, as pointers to operating system directories which contain BFILEs.
Which data dictionary view would you query to see these directories?
Mark for Rev
(1) Points
USER_DIRECTORIES
USER_BFILES
ALL_DIRECTORIES (*)
USER_EXTERNAL_FILES
ALL_BFILES
Correct
Correct
3.
The BIGEMP table contains a RESUME column of
datatype BFILE, which has been populated with locator values. The following
code reads a BFILE locator value into a variable, then checks whether the
BFILE itself exists in the operating system directory. If the file is
present, the code opens the file and reads its contents. What should be
coded at Point A?
DECLARE
v_locator BFILE;
BEGIN
SELECT resume INTO v_locator FROM bigemp
WHERE employee_id = 100;
-- Point A
DBMS_LOB.FILEOPEN(v_locator);
DBMS_LOB.READ(v_locator, ....); ....
DBMS_LOB.FILECLOSE(v_locator);
END IF;
END;
Mark for Review
(1) Points
IF BFILENAME(v_locator) EXISTS THEN
IF DBMS_LOB.FILEEXISTS(v_locator) = 1 THEN (*)
IF DBMS_LOB.FILEEXISTS(v_locator) THEN
IF DBMS_LOB.FILEEXISTS THEN
IF BFILEEXISTS(v_locator) THEN
Incorrect
Incorrect. Refer to Section 11.
4.
We want to store a complete copy of the DEPARTMENTS
table (all the rows and all the columns) in a single PL/SQL variable. Which
of the following kinds of variable could we use?
Mark for Review
(1) Points
An INDEX BY table
A record
An INDEX BY table of records (*)
A CLOB
An explicit cursor
Correct
Correct
5.
Which of the following PL/SQL data structures can
store a collection? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
An INDEX BY table (*)
A record
%ROWTYPE
An INDEX BY table of records (*)
A BLOB
Correct
Correct
6.
An INDEX BY table of records can store a maximum of 255 records.
True or False? Mark for Review
(1) Points
True
False (*)
Incorrect
Incorrect. Refer to Section 11.
7.
You need to add a new column to the EMPLOYEES table.
This column will store each employee's favourite movie. A movie can be up
to 4GB in size and the movies will be stored inside the database for better
security. Which datatype must you use for this column?
Mark for
Review
(1) Points
CLOB
BLOB (*)
LONG RAW
BFILE
LONG
Correct
Correct
8.
The JOB_APPLICANTS table contains two columns:
(applicant_id NUMBER PRIMARY KEY,
resume CLOB)
For applicant_id 100, we want to modify the value of the RESUME column
value from "I worked for Oracle" to "I worked for Oracle for five years".
Which of the following will do this successfully? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
UPDATE job_applicants
SET SUBSTR(resume, 21,14) = 'for five years'
WHERE candidate_id = 100;
UPDATE job_applicants
SET resume = 'I worked for Oracle for five years'
WHERE candidate_id = 100;
(*)
DECLARE
v_locator CLOB;
BEGIN
v_locator := 'I worked for Oracle for five years';
UPDATE job_applicants
SET resume = DBMS_LOB.WRITE(v_locator)
WHERE candidate_id = 100;
END;
DECLARE
v_lobloc CLOB;
BEGIN
SELECT resume INTO v_lobloc FROM job_applicants
WHERE applicant_id = 100;
DBMS_LOB.WRITE(v_lobloc,14,21,'for five years');
END;
(*)
Incorrect
Incorrect. Refer to Section 11.
9.
Which of the following best describes the difference
between BLOB and BFILE data?
Mark for Review
(1) Points
A BLOB can contain text data while a BFILE cannot.
BLOB data is stored inside the database, while BFILE data is
outside the database in separate operating system files. (*)
The maximum size of a BLOB is 2GB; a BFILE can be up to 128TB if
needed.
A table can contain several BLOB columns but only one BFILE column.
There is no difference between a BLOB and a BFILE.
Correct
Correct
10.
Which of the following methods can be used to query
CLOB data values? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
SELECT (*)
DBMS_LOB.PUT
DBMS_LOB.GETLENGTH
DBMS_LOB.READ (*)
Correct
Correct
11.
CLOB and BLOB are internal LOB datatypes, while BFILE is an
external LOB datatype. True or False? Mark for Review
(1) Points
True (*)
False
Correct
Correct
12.
A procedure includes the following code:
CURSOR loc_curs IS SELECT location_id, city, country_id FROM locations;
Which of the following changes to the LOCATIONS table will allow the
procedure 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; (*)
Incorrect
Incorrect. Refer to Section 12.
13.
Package EMPPACK contains a public procedure GET_EMP,
which contains a reference to the EMPLOYEES table. Procedure CALL_EMP
invokes 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
the GENDER column.
Incorrect
Incorrect. Refer to Section 12.
14.
Which of the following will display dependency
information which has been generated by executing the DEPTREE_FILL
procedure? (Choose two.)
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 (*)
Incorrect
Incorrect. Refer to Section 12.
15.
Which of the following will display the number of
invalid package bodies in your schema?
Mark for Review
(1) Points
SELECT COUNT(*) FROM user_objects
WHERE object_type = 'PACKAGE BODY'
AND status = 'INVALID';
(*)
SELECT COUNT(*) FROM user_dependencies
WHERE type = 'PACKAGE BODY'
AND status = 'INVALID';
SELECT COUNT(*) FROM user_packages
WHERE status = 'INVALID';
SELECT COUNT(*) FROM user_objects
WHERE object_type LIKE 'PACKAGE%'
AND status = 'INVALID';
Incorrect
Incorrect. Refer to Section 12.
16.
When a table is dropped, all PL/SQL subprograms that reference the
table are automatically dropped. True or False?
Mark for Review
(1) Points
True
False (*)
Correct
Correct
17.
A single procedure can be both a referenced object
and a dependent object. True or False?
Mark for Review
(1) Points
True (*)
False
Correct
Correct
18.
The PL/SQL variable V_LAST_NAME is used to store
fetched values of the LAST_NAME column of the EMPLOYEES table. To minimize
dependency failures, the variable should be declared as:
v_last_name VARCHAR2(25);
True or False?
Mark for Review
(1) Points
True
False (*)
Incorrect
Incorrect. Refer to Section 12.
19.
Which of the following will declare a composite
PL/SQL data type 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
Correct
20.
A PL/SQL package named MYPACK declares a record type
named MYTYPE as a public variable in the package specification. Which of
the following anonymous blocks successfully declares a local variable of
datatype MYTYPE?
Mark for Review
(1) Points
DECLARE
v_myrec IS RECORD mypack.mytype;
BEGIN ...
DECLARE
v_myrec mypack.mytype;
BEGIN ...
(*)
DECLARE
v_myrec mytype;
BEGIN ...
DECLARE
v_myrec IS RECORD (mypack.mytype);
BEGIN ...
Incorrect
Incorrect. Refer to Section 11.
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
1. Which of the following statements about BFILEs are NOT true? (Choose
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
2. The BIGEMP table contains a RESUME column of datatype BFILE, which
has been populated with locator values. The following code reads a BFILE
locator value into a variable, then checks whether the BFILE itself exists
in the operating system directory. If the file is present, the code opens
the file and reads its contents. What should be coded at Point A?
DECLARE
v_locator BFILE;
BEGIN
SELECT resume INTO v_locator FROM bigemp
WHERE employee_id = 100;
-- Point A
DBMS_LOB.FILEOPEN(v_locator);
DBMS_LOB.READ(v_locator, ....); ....
DBMS_LOB.FILECLOSE(v_locator);
END IF;
END;
Mark for Review
(1) Points
IF BFILENAME(v_locator) EXISTS THEN
IF DBMS_LOB.FILEEXISTS(v_locator) = 1 THEN (*)
IF DBMS_LOB.FILEEXISTS(v_locator) THEN
IF DBMS_LOB.FILEEXISTS THEN
IF BFILEEXISTS(v_locator) THEN
Correct
3. BFILEs are stored outside the database and can be queried and updated
by using procedures in DBMS_LOB. True or False? Mark for Review
(1) Points
True
False (*)
Correct
4. Package ED_PACK has declared a record type named ED_TYPE in the
package specification. Which of the following anonymous blocks successfully
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 only
within ED_PACK, not in separate subprograms or anonymous blocks.
Incorrect. Refer to Section 11.
5. A PL/SQL package named MYPACK declares a record type named MYTYPE as
a public variable in the package specification. Which of the following
anonymous blocks successfully declares a local variable of datatype MYTYPE?
Mark for Review
(1) Points
DECLARE
v_myrec IS RECORD mypack.mytype;
BEGIN ...
DECLARE
v_myrec mypack.mytype;
BEGIN ...
(*)
DECLARE
v_myrec mytype;
BEGIN ...
DECLARE
v_myrec IS RECORD (mypack.mytype);
BEGIN ...
Correct
Page 1 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
6. Function FETCH_EMP references the EMPLOYEES table. The table is
modified by:
ALTER TABLE employees ADD (resume CLOB);
When will the ORACLE server try to recompile FETCH_EMP automatically?
Mark for Review
(1) Points
When the command ALTER FUNCTION fetch_emp COMPILE; is executed
The next time a user session invokes FETCH_EMP (*)
When the RESUME column is dropped from the EMPLOYEES table
When FETCH_EMP is dropped and recreated
Incorrect. Refer to Section 12.
7. Which of the following techniques will make it more likely that an
invalidated PL/SQL subprogram will recompile successfully? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
Declaring record structures using %ROWTYPE (*)
Using a cursor FOR loop instead of opening and closing the cursor
explicitly
SELECTing a list of column-names instead of using SELECT *
Including a column list with INSERT statements (*)
Correct
8. Which of the following will display dependency information which has
been generated by executing the DEPTREE_FILL procedure? (Choose two.) 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
9. Package EMPPACK contains a public procedure GET_EMP, which contains a
reference to the EMPLOYEES table. Procedure CALL_EMP invokes
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 the
GENDER column.
Incorrect. Refer to Section 12.
10. A procedure includes the following code:
CURSOR loc_curs IS SELECT location_id, city, country_id FROM locations;
Which of the following changes to the LOCATIONS table will allow the
procedure 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
Page 2 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
11. 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
12. 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
13. Which of the following methods can be used to query CLOB data
values? (Choose two.) Mark for Review
(1) Points
(Choose all correct answers)
SELECT (*)
DBMS_LOB.PUT
DBMS_LOB.GETLENGTH
DBMS_LOB.READ (*)
Correct
14. CLOB and BLOB are internal LOB datatypes, while BFILE is an external
LOB datatype. True or False? Mark for Review
(1) Points
True (*)
False
Correct
15. A LONG column can be converted to CLOB using a single ALTER TABLE
command. True or False? Mark for Review
(1) Points
True (*)
False
Correct
Page 3 of 4
Test: Final Exam Semester 2
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Final Exam Semester 2
16. BLOB, JPEG, BFILE and MP3 are all LOB column datatypes. True or
False? Mark for Review
(1) Points
True
False (*)
Correct
17. You need to add a new column to the EMPLOYEES table. This column
will store each employee's favourite movie. A movie can be up to 4GB in
size and the movies will be stored inside the database for better security.
Which datatype must you use for this column? Mark for Review
(1) Points
CLOB
BLOB (*)
LONG RAW
BFILE
LONG
Correct
18. We want to store a complete copy of the DEPARTMENTS table (all the
rows and all the columns) in a single PL/SQL variable. Which of the
following kinds of variable could we use? Mark for Review
(1) Points
An INDEX BY table
A record
An INDEX BY table of records (*)
A CLOB
An explicit cursor
Correct
19. The following code declares an INDEX BY table and populates it with
employees' salaries, using the employee_id as the BINARY_INTEGER index 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
20. An INDEX BY table of records can store a maximum of 255 records.
True or False? Mark for Review
(1) Points
True
False (*)
Correct
Page 4 of 4
Download