Quiz 5

Download as pdf or txt
Download as pdf or txt
You are on page 1of 7
At a glance
Powered by AI
The key takeaways are that PL/SQL records can store a whole database record in a single variable, and INDEX BY tables allow storing collections of records with a primary key index. Different types of PL/SQL records discussed include %ROWTYPE, user-defined records, and records as components of other records.

The different types of PL/SQL records discussed include %ROWTYPE records, user-defined records through defining a record type, and records being used as components of other records.

Some ways to declare an INDEX BY table discussed include declaring a table type of %ROWTYPE and indexing it by a numeric type like BINARY_INTEGER.

1.

You can
Marcar para Revisión
store a
(1) Puntos
whole
record in a
single
variable
using
%ROWTYPE
or by
creating
your own
record
structure
as a type
and then
declaring a
variable of
that type.

True (*)

False

Correct

2. Consider the following code:


Marcar para Revisión
DECLARE (1) Puntos
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?


one

four

two (*)

three

Correct

3. Which of the following statements about user-defined


Marcar para Revisión
PL/SQL records is NOT true?
(1) Puntos

It can be a component of another PL/SQL record.

It can be defined as NOT NULL.

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 must contain one or more components, but all the


components must have scalar datatypes. (*)

Correct

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


Marcar para Revisión
(1) Puntos

True (*)

False

Correct
5. Which of the following will successfully create a record
Marcar para Revisión
type containing two fields, and a record variable of that
(1) Puntos
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;

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 person_type;

(*)

Correct

To
Marcar para Revisión
declare
(1) Puntos
an
INDEX
BY table,
we must
first
declare a
type and
then
declare a
collection
variable
of that
type.
True or
False?
True (*)
False

Incorrect. Refer to
Section 5 Lesson 2.

7. Which of these PL/SQL data structures can NOT


Marcar para Revisión
store a collection? (1) Puntos

A PL/SQL record (*)


An INDEX BY table indexed by
PLS_INTEGER
An INDEX BY table of records
An INDEX BY table indexed by
BINARY_INTEGER

Incorrect. Refer to
Section 5 Lesson 2.

8. In an INDEX BY table of records the record can be


Marcar para Revisión
_______________________. (1) Puntos

a user-defined record
Either one. (*)
%ROWTYPE

Incorrect. Refer to
Section 5 Lesson 2.

9. What is the largest number of elements (i.e., records)


Marcar para Revisión
that an INDEX BY table of records can contain?
(1) Puntos

Many millions of records because a


BINARY_INTEGER or PLS_INTEGER can
have a very large value (*)
32767
4096
100
None of these.

Correct
10. Which of the following successfully declares an
Marcar para Revisión
INDEX BY table of records which could be used to
(1) Puntos
store copies of complete rows from the departments
table?

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

(*)
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;

11.Which of
Marcar para Revisión
these
(1) Puntos
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 (*)


A record
An explicit cursor based on SELECT * FROM
employees;
An INDEX BY table

Correct

12. An INDEX BY TABLE primary key cannot be


Marcar para Revisión
negative.
(1) Puntos

True
False (*)

Incorrect. Refer to
Section 5 Lesson 2.

13. Which of the following methods can be used to


Marcar para Revisión
reference elements of an INDEX BY table? (1) Puntos
(Choose three.)

(Seleccione todas las respuestas correctas)

DROP
COUNT (*)
FIRST (*)
PREVIOUS
EXISTS (*)

Correct

14. An INDEX BY TABLE must have a primary key.


Marcar para Revisión
(1) Puntos

True (*)
False

Correct

15. Identify the valid collection types:


Marcar para Revisión
(1) Puntos

(Seleccione todas las respuestas correctas)

INDEX BY TABLE OF RECORDS (*)


INDEX BY TABLE OF ROWS
INDEX BY TABLE (*)
INDEX BY VIEW

You might also like