Which two statements are true about the above code?

Examine the code in the following PL/SQL block:
DECLARE
TYPE NumList IS TABLE OF INTEGER;
List1 NumList := NumList(11,22,33,44);
BEGIN
List1.DELETE(2);
DBMS_OUTPUT.PUT_LINE
( ‘The last element# in List1 is ‘ || List1.LAST ||
‘ and total of elements is ‘||List1.COUNT);
List1.EXTEND(4,3);
END;
/
Which two statements are true about the above code? (Choose two.)

Examine the code in the following PL/SQL block:
DECLARE
TYPE NumList IS TABLE OF INTEGER;
List1 NumList := NumList(11,22,33,44);
BEGIN
List1.DELETE(2);
DBMS_OUTPUT.PUT_LINE
( ‘The last element# in List1 is ‘ || List1.LAST ||
‘ and total of elements is ‘||List1.COUNT);
List1.EXTEND(4,3);
END;
/
Which two statements are true about the above code? (Choose two.)

A.
LAST and COUNT give different values.

B.
LAST and COUNT give the same values.

C.
The four new elements that are added contain the value 33.

D.
The four new elements that are added contain the value 44.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


gelete

gelete

A,C

A.
FIRST, LAST: For nested tables, normally, LAST equals COUNT.
But, if you delete elements from the middle of a nested table, LAST is larger than COUNT.
DBMS Output: The last element# in List1 is 4 and total of elements is 3

https://docs.oracle.com/cd/B19306_01/appdev.102/b14261/collection_method.htm

C.
EXTEND is one of the Oracle PL/SQL collection methods which is used with Nested Tables and VARRAYS
to append single or multiple elements to the collection.
1. EXTEND, which adds a single NULL instance.
2. EXTEND(n) which adds multiple NULL instances. The number of instances is specified by n.
3. EXTEND(n,m) which appends n copies of cell m to the collection.

psoug.org/definition/EXTEND.htm