1. 
In an INDEX BY table of records the record can be _______________________.
  • %ROWTYPE
  • a user-defined record
  • Either one. (*)

2.
Which of the following successfully declares an INDEX BY table of records which could be used to store copies of complete rows from the departments table?




DECLARE
    TYPE t_depttab IS INDEX BY TABLE OF departments%ROWTYPE
    INDEX BY BINARY_INTEGER;
DECLARE
    TYPE t_depttab IS TABLE OF departments%TYPE
    INDEX BY BINARY_INTEGER;
DECLARE
    TYPE t_depttab IS TABLE OF departments%ROWTYPE
    INDEXED BY NUMBER;
DECLARE
    TYPE t_depttab IS TABLE OF departments%ROWTYPE
    INDEX BY BINARY_INTEGER;

(*)
Correct
3.
To declare an INDEX BY table, we must first declare a type and then declare a collection variable of that type. True or False?
True (*)
False
Correct
4.
An INDEX BY TABLE type can only have one data field.
True (*)
False
Correct
5.
An INDEX BY TABLE primary key cannot be negative.
  • true
  • false(*)





6.
Which of these PL/SQL data structures could store a complete copy of the employees table, i.e., 20 complete table rows?


An INDEX BY table of records (*)

An explicit cursor based on SELECT * FROM employees;

An INDEX BY table

A record


Correct


7.
Which of these PL/SQL data structures can NOT store a collection?


An INDEX BY table indexed by BINARY_INTEGER

An INDEX BY table of records

An INDEX BY table indexed by PLS_INTEGER

A PL/SQL record (*)


Correct

  



8.
Identify the valid collection types:
(Choose all correct answers)
  • INDEX BY TABLE OF RECORDS (*)
  • INDEX BY TABLE OF ROWS
  • INDEX BY VIEW
  • INDEX BY TABLE (*)

9.
What is the largest number of elements (i.e., records) that an INDEX BY table of records can contain?


100

None of these.

4096

32767

Many millions of records because a BINARY_INTEGER or PLS_INTEGER can have a very large value (*)


Correct


10.
Which of the following methods can be used to reference elements of an INDEX BY table? (Choose three.)


(Choose all correct answers)


EXISTS (*)

DROP

COUNT (*)

PREVIOUS

FIRST (*)



11.
You can use %ROWTYPE with tables and views.


True (*)

False


Correct


12.
Consider the following code:
DECLARE
 TYPE dept_info_type IS RECORD
  (department_id departments.department_id%TYPE,
  department_name departments.department_name%TYPE);
 TYPE emp_dept_type IS RECORD
  (first_name employees.first_name%TYPE,
  last_name employees.last_name%TYPE),
  dept_info dept_info_type);

 v_emp_dept_rec emp_dept_type;

How many fields can be addressed in v_emp_dept_rec?
  • four (*)
  • two
  • one
  • three
 
13.
Consider the following code:
DECLARE
 TYPE dept_info_type IS RECORD
  (department_id departments.department_id%TYPE,
  department_name departments.department_name%TYPE);
 TYPE emp_dept_type IS RECORD
  (first_name employees.first_name%TYPE,
  last_name employees.last_name%TYPE),
  dept_info dept_info_type);

 v_dept_info_rec dept_info_type;
 v_emp_dept_rec emp_dept_type;

How many fields can be addressed in v_dept_info_rec?
Mark for Review
(1) Points
two (*)
one
three
four
Correct
14.
Which of the following will successfully create a record type containing two fields, and a record variable of that type?
Mark for Review
(1) Points
TYPE person_type IS RECORD
    (l_name VARCHAR2(20),
    gender CHAR(1));
person_rec person_type;

(*)
  • TYPE person_type IS (l_name VARCHAR2(20),
    gender CHAR(1));
person_rec person_type; 


TYPE person_type IS RECORD
    (l_name VARCHAR2(20),
    gender CHAR(1));
person_rec TYPE person_type;
TYPE person_type IS (l_name VARCHAR2(20),
    gender CHAR(1));
person_rec TYPE person_type;
Incorrect. Refer to Section 5 Lesson 1.
15.
Which of the following statements about user-defined PL/SQL records is NOT true?
Mark for Review
(1) Points
It can be used as an OUT parameter in a package procedure.
It is not the same as a row in a database table.
It can be a component of another PL/SQL record.
It can be defined as NOT NULL.
It must contain one or more components, but all the components must have scalar datatypes. (*)