Using PL/SQL Collections and Records - questions and answers

Using PL/SQL Collections and Records - questions and answers


1) Which of the following is a group of related data items stored in fields, each with its own name and datatype?

A) A Record
B) A Collection
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) A Record




2) Collection is an ordered group of elements, all of the same type.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




3) Which collection types is also known as index-by tables, lets you look up elements using arbitrary numbers and strings for subscript values?

A) Associative arrays
B) Nested tables
C) Varrays
D) None of the above
View Answer / Hide Answer

ANSWER: A) Associative arrays




4) Arrays in other languages become varrays in PL/SQL.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




5) Varrays are a good choice when -

A) The number of elements is known in advance.
B) The elements are usually all accessed in sequence.
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B




6) Nested tables are a good choice when -

A) The index values are not consecutive.
B)There is no set number of index values. However, a maximum limit is imposed.
C) You need to delete or update some elements, but not all the elements at once.
D) You would usually create a separate lookup table, with multiple entries for each row of the main table, and access it through join queries.
E) All mentioned above
F) None of the above
View Answer / Hide Answer

ANSWER: E) All mentioned above




7) Nested tables can be sparse: you can delete arbitrary elements, rather than just removing an item from the end.

A) Yes
B) No
View Answer / Hide Answer

ANSWER: A) Yes




8) Associative arrays also known as index-by tables.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




9) Assigning a value to a collection element can cause exceptions, such as.

A) If the subscript is NULL or is not convertible to the right datatype, PL/SQL raises the predefined exception VALUE_ERROR. Usually, the subscript must be an integer.
Associative arrays can also be declared to have VARCHAR2 subscripts.
B) If the subscript refers to an uninitialized element, PL/SQL raises SUBSCRIPT_BEYOND_COUNT.
C) If the collection is atomically null, PL/SQL raises COLLECTION_IS_NULL.
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above




10) A collection method is a built-in function or procedure that operates on collections and is called using dot notation.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




11) Which of the following cannot be used with associative arrays?

A) EXTEND
B) TRIM
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: C) Both A & B




12) Only EXISTS can be applied to atomically null collections. If you apply another method to such collections, PL/SQL raises COLLECTION_IS_NULL.

A) Yes
B) No
View Answer / Hide Answer

ANSWER: A) Yes




13) Which collection exception is raised when a subscript designates an element that was deleted, or a nonexistent element of an associative array?

A) NO_DATA_FOUND
B) COLLECTION_IS_NULL
C) SUBSCRIPT_BEYOND_COUNT
D) SUBSCRIPT_OUTSIDE_LIMIT
View Answer / Hide Answer

ANSWER: A) NO_DATA_FOUND




14) Which collection exception is raised when a subscript exceeds the number of elements in a collection?

A) VALUE_ERROR
B) COLLECTION_IS_NULL
C) SUBSCRIPT_BEYOND_COUNT
D) SUBSCRIPT_OUTSIDE_LIMIT
View Answer / Hide Answer

ANSWER: C) SUBSCRIPT_BEYOND_COUNT




15) In the Restrictions on Record Inserts and Updates, which of the following are not supported?

A) Nested record types
B) Functions that return a record
C) Record inserts and updates using the EXECUTE IMMEDIATE statement
D) All mentioned above
View Answer / Hide Answer

ANSWER: D) All mentioned above


Post your comment