You are on page 1of 13

FS2

Test: Final Exam Semester 2
Section 11 1. CLOB and BLOB are internal LOB datatypes, while BFILE is an external LOB datatype. True or False? Mark for Review (1) Points True (*) False 2. 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. 3. A LONG column can be converted to CLOB using a single ALTER TABLE command. True or False? Mark for Review (1) Points True (*) False 4. Which of the following statements about LOB column datatypes is NOT true? Mark for Review (1) Points BFILE data is stored outside the database. One table can contain only one LONG or LONG RAW column. CLOB is a deprecated datatype; LONG should be used instead. (*) Binary (non-text) data can be stored in a BLOB column but not in a CLOB column. A LONG RAW column can store up to 2GB of data. 5. 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

1

. BEGIN . DECLARE TYPE compo_type IS RECORD (field1 NUMBER. (*) DECLARE v_myrec mytype. field2 VARCHAR2(30)). Which of the following will declare a composite PL/SQL data type named COMPO_TYPE.FS2 VARCHAR2(4000) None of the above 6. 2 . DECLARE v_myrec mypack. field2 VARCHAR2(30))... BEGIN . DECLARE v_myrec IS RECORD (mypack. 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... (*) DECLARE compo_type IS RECORD (field1 NUMBER. containing two fields named FIELD1 and FIELD2? Mark for Review (1) Points DECLARE compo_type (field1 NUMBER. 7. field2 VARCHAR2(30)). BEGIN .. field2 VARCHAR2(30))..mytype. DECLARE TYPE compo_type IS (field1 NUMBER. A PL/SQL package named MYPACK declares a record type named MYTYPE as a public variable in the package specification.mytype)..mytype. BEGIN .

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. 3 . (*) GRANT SELECT ON filesdir TO PUBLIC.department_name%TYPE INDEX BY INTEGER. dept_names_tab t_dnames. GRANT READ ON 'C:\BFILEDIR' TO PUBLIC. dept_names_tab t_dnames. 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. 11. Which of the following successfully declares an INDEX BY table named DEPT_NAMES_TAB. DECLARE TYPE t_dnames IS TABLE OF department_name INDEX BY BINARY_INTEGER. GRANT READ ON DIRECTORY filesdir TO PUBLIC. dept_names_tab t_dnames. DECLARE TYPE t_dnames IS TABLE OF departments. The database administrator has created a directory as follows: CREATE DIRECTORY filesdir AS 'C:\BFILEDIR'.FS2 9. An INDEX BY table of records can store a maximum of 255 records. dept_names_tab t_dnames%TYPE.department_name%TYPE INDEX BY BINARY_INTEGER.department_name%TYPE INDEX BY PLS_INTEGER. True or False? Mark for Review (1) Points True False (*) 10. (*) DECLARE TYPE t_dnames IS TABLE OF departments. GRANT QUERY ON DIRECTORY filesdir TO PUBLIC.

Mark for Review (1) Points IF BFILENAME(v_locator) EXISTS THEN IF DBMS_LOB. END IF. . which has been populated with locator values. 13.FILEEXISTS(v_locator) = 1 THEN (*) IF DBMS_LOB. The BIGEMP table contains a RESUME column of datatype BFILE. What should be coded at Point A? DECLARE v_locator BFILE. (*) The database contains a locator which points to the external BFILE. We can read BFILE data using the DBMS_LOB package. END.. DBMS_LOB.FILEOPEN(v_locator). If the file is present. Which of the following statements about dependencies are true? (Choose two.FILEEXISTS THEN IF BFILEEXISTS(v_locator) THEN 14..FS2 12. Which of the following statements about BFILEs are NOT true? (Choose two.) Mark for Review (1) Points (Choose all correct answers) 4 . -. CREATE PROCEDURE ed_proc IS CURSOR ed_curs IS SELECT * FROM ed_view.).Point A DBMS_LOB. The following code reads a BFILE locator value into a variable. (*) We can read BFILE data in a SELECT statement.) Mark for Review (1) Points (Choose all correct answers) They are stored outside the database.FILECLOSE(v_locator). We can grant SELECT object privilege on them. BEGIN SELECT resume INTO v_locator FROM bigemp WHERE employee_id = 100.FILEEXISTS(v_locator) THEN IF DBMS_LOB. the code opens the file and reads its contents. ... DBMS_LOB..READ(v_locator. Examine the following code: CREATE VIEW ed_view AS SELECT * FROM employees NATURAL JOIN departments. then checks whether the BFILE itself exists in the operating system directory..

city. END. country_id FROM locations. A procedure includes the following code: CURSOR loc_curs IS SELECT location_id. type FROM user_dependencies WHERE name IN ('DEPTFUNC'.sql script is run? Mark for Review (1) Points The DEPTREE view The DEPTREE_FILL procedure The USER_DEPENDENCIES view (*) The DEPTREE_TEMPTAB table 17. Which of the following will display the dependency between DEPTFUNC and DEPARTMENTS? Mark for Review (1) Points SELECT name. ALTER TABLE locations DROP COLUMN postal_code. ALTER TABLE locations ADD (climate VARCHAR2(30)). (*) 16. Examine the following code: CREATE FUNCTION deptfunc RETURN NUMBER IS v_count NUMBER(6).'DEPARTMENTS').FS2 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 15. RETURN v_count. Which of the following is NOT created when the utldtree. (*) ALTER TABLE locations DROP COLUMN city.) Mark for Review (1) Points (Choose all correct answers) RENAME locations TO new_locations. BEGIN SELECT COUNT(*) INTO v_count FROM departments. Which of the following changes to the LOCATIONS table will allow the procedure to be recompiled successfully without editing its code? (Choose two. 5 .

Procedure CALL_EMP invokes EMPPACK. The body of EMPPACK is invalidated. 18. Function FETCH_EMP references the EMPLOYEES table. Which one of the following statements is true? Mark for Review (1) Points The specification and body of EMPPACK are invalidated. type. referenced_type FROM user_dependencies WHERE name = 'DEPARTMENTS' AND type = 'TABLE'. referenced_name. 20.GET_EMP is invalidated. referenced_type FROM user_dependencies WHERE referenced_name = 'DEPARTMENTS' AND referenced_type = 'TABLE'. object_type FROM user_objects WHERE object_name IN ('DEPARTMENTS'. but other procedures in EMPPACK remain valid. type. referenced_name. but the specification remains valid. The table is modified by: ALTER TABLE employees ADD (resume CLOB). Package EMPPACK contains a public procedure GET_EMP. Nothing is invalidated because the PL/SQL code does not reference the GENDER column. (*) EMPPACK. 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 19. which contains a reference to the EMPLOYEES table. A single procedure can be both a referenced object and a dependent object.FS2 SELECT name. (*) SELECT name.GET_EMP. When will the ORACLE server try to recompile FETCH_EMP automatically? Mark for Review (1) Points When the command ALTER FUNCTION fetch_emp COMPILE. True or False? Mark for Review (1) Points True (*) False 6 . but CALL_EMP remains valid. The following SQL statement is executed: ALTER TABLE employees ADD (gender CHAR(1)). SELECT object_name.'DEPTFUNC') AND referenced = 'YES'.

salary. t_emp_sals(v_emprec.salary.salary. emp_sals_tab(v_emprec.Line A END LOOP.salary.salary%TYPE emp_curs%ROWTYPE Any one of the above (*) None of the above 7 . salary FROM employees) LOOP -.employee_id) := v_emprec. Which of the following can be coded at Point A? Mark for Review (1) Points employees%ROWTYPE employees. v_mytab t_mytype.FS2 4. JPEG. 7. Examine the following code: DECLARE CURSOR emp_curs IS SELECT employee_id.employee_id) := v_emprec.salary%TYPE INDEX BY BINARY_INTEGER. BLOB. BFILE and MP3 are all LOB column datatypes. emp_sals_tab t_emp_sals.Point A INDEX BY BINARY_INTEGER. BEGIN FOR v_emprec IN (SELECT employee_id. (*) emp_sals_tab(i) := v_emprec. What must be coded at Line A? Mark for Review (1) Points emp_sals_tab(employee_id) := v_emprec. True or False? Mark for Review (1) Points True False (*) 6. END. TYPE t_mytype IS TABLE OF -. first_name. last_name FROM employees. using the employee_id as the BINARY_INTEGER index of the table: DECLARE TYPE t_emp_sals IS TABLE OF employees. The following code declares an INDEX BY table and populates it with employees' salaries.

(*) SELECT COUNT(*) FROM user_dependencies WHERE type = 'PACKAGE BODY' AND status = 'INVALID'. 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 (*) 18.) 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 (*) 17. SELECT COUNT(*) FROM user_objects WHERE object_type LIKE 'PACKAGE%' AND status = 'INVALID'. SELECT COUNT(*) FROM user_packages WHERE status = 'INVALID'. Which of the following will display dependency information which has been generated by executing the DEPTREE_FILL procedure? (Choose two. 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'.FS2 16. 8 .

GETLENGTH DBMS_LOB. Which of the following PL/SQL data structures can store a collection? (Choose two.FS2 1. You need to add store each employee's movies will be stored must you use for this (1) Points CLOB BLOB (*) LONG RAW BFILE LONG 10.PUT DBMS_LOB. You have created several directory objects in the database. 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 9. A movie can be up to 4GB in size and the inside the database for better security. This column will favourite movie. Which datatype column? Mark for Review 9 .) Mark for Review (1) Points (Choose all correct answers) An INDEX BY table (*) A record %ROWTYPE An INDEX BY table of records (*) A BLOB 6. Which of the following methods can be used to query CLOB data values? (Choose two.READ (*) a new column to the EMPLOYEES table.) Mark for Review (1) Points (Choose all correct answers) SELECT (*) DBMS_LOB. as pointers to operating system directories which contain BFILEs.

WRITE(v_locator) WHERE candidate_id = 100.ed_type.FS2 13...ed_type%TYPE. BEGIN v_locator := 'I worked for Oracle for five years'. BEGIN. 12. Which of the following will do this successfully? (Choose two. Variables of datatype ED_TYPE can be declared only within ED_PACK..14) = 'for five years' WHERE candidate_id = 100.. DECLARE v_ed_rec ed_pack.) Mark for Review (1) Points (Choose all correct answers) UPDATE job_applicants SET SUBSTR(resume. 21. UPDATE job_applicants SET resume = 'I worked for Oracle for five years' WHERE candidate_id = 100.. BEGIN . not in separate subprograms or anonymous blocks..ed_type%ROWTYPE. (*) DECLARE v_locator CLOB. END. None of the above. BEGIN . Package ED_PACK has declared a record type named ED_TYPE in the package specification.. resume CLOB) For applicant_id 100. 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. 10 . BEGIN . we want to modify the value of the RESUME column value from "I worked for Oracle" to "I worked for Oracle for five years". (*) DECLARE v_ed_rec ed_pack. UPDATE job_applicants SET resume = DBMS_LOB. The JOB_APPLICANTS table contains two columns: (applicant_id NUMBER PRIMARY KEY.. DECLARE v_ed_rec ed_pack.ed_type.

A SELECT from the DEPTREE table displays table LOCATIONS at nested level 0 and procedure LOCPROC at nested level 2. ALTER TABLE newemp MODIFY (photo_id BLOB).WRITE(v_lobloc.14. (*) ALTER TABLE newemp DROP COLUMN (photo_id). 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). When a table is dropped. ALTER TABLE newemp ADD (photo_id BLOB). all PL/SQL subprograms that reference the table are automatically dropped. ALTER TABLE newemp MODIFY (photo_id BFILE). True or False? Mark for Review (1) Points True False (*) 4.21. (*) 20. The PL/SQL variable V_LAST_NAME is used to store fetched values of the LAST_NAME column of the EMPLOYEES table. DBMS_LOB. BEGIN SELECT resume INTO v_lobloc FROM job_applicants WHERE applicant_id = 100. 16. the variable should be declared as: v_last_name VARCHAR2(25). True or False? Mark for Review (1) Points 11 . This shows that LOCPROC is directly dependent on LOCATIONS. ALTER TABLE newemp COLUMN (photo_id LONG RAW).FS2 DECLARE v_lobloc CLOB. True or False? Mark for Review (1) Points True False (*) 19. To minimize dependency failures.'for five years'). Table NEWEMP contains a PHOTO_ID column of datatype LONG RAW. END.

Which of the following must he execute to populate the DEPTREE_TEMPTAB table? Mark for Review (1) Points BEGIN utldtree('DEPARTMENTS').'BOB'. We want to store a complete copy of the DEPARTMENTS table (all the rows and all the columns) in a single PL/SQL variable. BEGIN ideptree('TABLE'. END. Which of the following must be used to populate a BFILE column with a locator value? Mark for Review (1) Points The DBMS_LOB.'DEPARTMENTS'). 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 11.'BOB'. BEGIN deptree_fill('TABLE'.FILOPEN procedure 18. END. END.FILEGETNAME procedure The DBMS_LOB. END.FS2 True False (*) 8.'DEPARTMENTS').BFILENAME function The BFILENAME function (*) The BFILELOCATOR function The DBMS_LOB. 12 .'DEPARTMENTS'). (*) BEGIN deptree_fill('TABLE'. User BOB wants to know which objects reference his DEPARTMENTS table.

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 (*) 13 .FS2 8.