View the Exhibit to examine the PL/SQL block.
Which statement is true about the execution of the PL/SQL block?
A. It executes successfully and gives the desired output.
B. It does not execute because the definition of type population is indexed by VARCHAR2.
C. It executes, and the string keys of an associative array are not stored in creation order, but in sorted order.
D. It does not execute because the value that is once assigned to the element of the associative array cannot be changed.
Agree that correct answer is C.
Executed sample code from reference:
DECLARE
— Associative array indexed by string:
TYPE population IS TABLE OF NUMBER — Associative array type
INDEX BY VARCHAR2(64); — indexed by string
city_population population; — Associative array variable
i VARCHAR2(64); — Scalar variable
BEGIN
— Add elements (key-value pairs) to associative array:
city_population(‘Smallville’) := 2000;
city_population(‘Midland’) := 750000;
city_population(‘Megalopolis’) := 1000000;
— Change value associated with key ‘Smallville’:
city_population(‘Smallville’) := 2001;
— Print associative array:
i := city_population.FIRST; — Get first element of array
WHILE i IS NOT NULL LOOP
DBMS_Output.PUT_LINE
(‘Population of ‘ || i || ‘ is ‘ || city_population(i));
i := city_population.NEXT(i); — Get next element of array
END LOOP;
END;
/
Population of Megalopolis is 1000000
Population of Midland is 750000
Population of Smallville is 2001
Hi there,
is these questions still valid for exam 1z0-144