Here, you can read PL/SQL Collections and Records multiple choice questions and answers with explanation.
1) Which collection exception is raised when a subscript exceeds the number of elements in a collection? - Published on 09 Jul 15
a. VALUE_ERROR
b. COLLECTION_IS_NULL
c. SUBSCRIPT_BEYOND_COUNT
d. SUBSCRIPT_OUTSIDE_LIMIT
Answer
Explanation
|
ANSWER: SUBSCRIPT_BEYOND_COUNT
Explanation: The SUBSCRIPT_BEYOND_COUNT error is where the in-limit of a subscript was greater than that of the count of a varray or was too large for a nested table.
|
|
2) Which collection exception is raised when a subscript designates an element that was deleted, or a nonexistent element of an associative array? - Published on 09 Jul 15
a. NO_DATA_FOUND
b. COLLECTION_IS_NULL
c. SUBSCRIPT_BEYOND_COUNT
d. SUBSCRIPT_OUTSIDE_LIMIT
Answer
Explanation
|
ANSWER: NO_DATA_FOUND
Explanation: The NO_DATA_FOUND exception is raised when the FETCH statement is not able to find the relevant data that we have asked for.
|
|
3) Only EXISTS can be applied to automatically null collections. If you apply another method to such collections, PL/SQL raises COLLECTION_IS_NULL. - Published on 09 Jul 15
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: A built in function or procedure which is operated on collections and usually called using the dot notation is known as a collection method.
|
|
4) Nested tables can be sparse: you can delete arbitrary elements, rather than just removing an item from the end. - Published on 08 Jul 15
a. Yes
b. No
Answer
Explanation
|
ANSWER: Yes
Explanation: The nested tables and the varrays are the one that we need to select upon. A nested table is a dimensional array with arbitary elements.
|
|
5) Assigning a value to a collection element can cause exceptions, such as - Published on 08 Jul 15
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
Answer
Explanation
|
ANSWER: All mentioned above
Explanation: No explanation is available for this question!
|
|
6) Which collection types is also known as index-by tables, lets you look up elements using arbitrary numbers and strings for subscript values? - Published on 08 Jul 15
a. Associative arrays
b. Nested tables
c. Varrays
d. None of the above
Answer
Explanation
|
ANSWER: Associative arrays
Explanation: The associative arrays helps us to look up to the elements using arbitary numbers and strings for subscript values. They are similar to hash tables.
|
|
7) Associative arrays also known as index-by tables. - Published on 07 Jul 15
a. True
b. False
Answer
Explanation
|
ANSWER: True
Explanation: The associative arrays helps us to look up to the elements using arbitary numbers and strings for subscript values. They are similar to hash tables.
|
|
8) Nested tables are a good choice when - Published on 07 Jul 15
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
Answer
Explanation
|
ANSWER: All mentioned above
Explanation: No explanation is available for this question!
|
|
9) Which of the following is a group of related data items stored in fields, each with its own name and datatype? - Published on 07 Jul 15
a. A Record
b. A Collection
c. Both A & B
d. None of the above
Answer
Explanation
|
ANSWER: A Record
Explanation: A record is a data structure which can hold items of different types.
|
|
10) In the Restrictions on Record Inserts and Updates, which of the following are not supported? - Published on 19 Oct 15
a. Nested record types
b. Functions that return a record
c. Record inserts and updates using the EXECUTE IMMEDIATE statement
d. All mentioned above
Answer
Explanation
|
ANSWER: All mentioned above
Explanation: The restrictions on the record are made on the DML statements. Some of the DML statements are restricted too.
|
|