Oracle
Oracle
html
False
7. Which of the following are PL/SQL data types? (Choose three.) (1) Points (Choose all
correct answers)
Large Objects (LOB) (*)
Lexical
Scalar (*)
Delimiter
Composite (*)
False (*)
7. Which of the following are valid PL/SQL operators? (Choose three.) (1) Points (Choose
all correct answers)
Concatenation (*)
Exception
Exponential (*)
Arithmetic (*)
8. Which of the following statements about implicit conversions is NOT true? (1) Points
Code containing implicit conversions typically runs faster than code containing explicit
conversions. (*)
Code containing implicit conversions may not work in the future if Oracle changes the
conversion rules.
Code containing implicit conversions is harder to read and understand.
9. Which of the following is correct? (1) Points
v_family_name = SMITH;
V_FAMILY_NAME = SMITH;
v_family_name := SMITH;
v_family_name := 'SMITH'; (*)
10. The TO_CHAR function is used for explicit data type conversions. True or False? (1)
Points
True (*)
False
11. Explicit conversions can be slower than implicit conversions. True or False? (1) Points
True
False (*)
12. PL/SQL statements must be written on a single line. (1) Points
True
False (*)
13. What will happen when the following code is executed?
DECLARE v_new_date DATE;
BEGIN
v_new_date := 'Today';
DBMS_OUTPUT.PUT_LINE(v_new_date);
END;
(1) Points
The block will execute and display today's date.
The block will execute and display the word "Today".
The block will fail because the character value "Today" cannot be implicitly converted to a
date. (*)
14. The LENGTH and ROUND functions can be used in PL/SQL statements. True or
False? (1) Points
True (*)
False
15. PL/SQL can implicitly convert a CHAR to a NUMBER, provided the CHAR contains a
numeric value, for example '123'. True or False? (1) Points
True (*)
False
16. Which of the following data type conversions can be done implicitly? (Choose two.)
(1) Points
(Choose all correct answers)
DATE to NUMBER
NUMBER to VARCHAR2 (*)
NUMBER to PLS_INTEGER (*)
Unequal
Nothing will be displayed because V_MESSAGE is set to NULL.
4. Examine the following code:
DECLARE
v_score NUMBER(3);
v_grade CHAR(1);
BEGIN
v_grade := CASE v_score
-- Line A
....
The CASE expression must convert a numeric score to a letter grade: 90 -> A, 80 -> B, 70 ->
C and so on. What should be coded at Line A?
(1) Points
WHEN 90 THEN grade := 'A'
WHEN 90 THEN v_grade := 'A';
WHEN 90 THEN 'A' (*)
WHEN 90 THEN 'A';
5. What will be displayed when the following block is executed?
DECLARE
v_age NUMBER(3);
v_gender VARCHAR2(6) := 'Female';
v_status VARCHAR2(20);
BEGIN
CASE
WHEN v_age >= 18 AND v_gender = 'Male' THEN v_status := 'Adult Male';
WHEN v_age >= 18 AND v_gender = 'Female' THEN v_status := 'Adult Female';
WHEN v_age < 18 AND v_gender = 'Male' THEN v_status := 'Junior Male';
WHEN v_age < 18 AND v_gender = 'Female' THEN v_status := 'Junior Female';
ELSE v_status := 'Other Value';
END CASE;
DBMS_OUTPUT.PUT_LINE(v_status);
END;
(1) Points
Adult Male
Junior Female
Other Value (*)
Nothing will be displayed because V_STATUS is set to NULL.
6. How must you end a CASE statement? (1) Points
END;
END CASE; (*)
END IF;
ENDCASE;
8. How many EXIT statements can be coded inside a basic loop? (1) Points
None.
One only.
Two.
As many as you need, there is no limit. (*)
5
10
15
50 (*)
4. When the following code is executed, how many lines of output will be displayed?
BEGIN
FOR i IN 1..5 LOOP
FOR j IN 1..8 LOOP
DBMS_OUTPUT.PUT_LINE(i || ',' || j);
END LOOP;
DBMS_OUTPUT.PUT_LINE(i);
END LOOP;
END;
(1) Points
80
45 (*)
14
41
5. What type of loop statement would you write for Point A?
BEGIN
FOR v_outerloop IN 1..3 LOOP
-- Point A
DBMS_OUTPUT.PUT_LINE('Outer loop is:'||v_outerloop||
' and inner loop is: '||v_innerloop);
END LOOP;
END LOOP;
END;
(1) Points
WHILE v_innerloop <=5 LOOP
FOR v_innerloop 1..5 LOOP (*)
LOOP
WHILE v_outerloop<v_innerloop LOOP
6. Look at the following code:
DECLARE
v_blue NUMBER(3) := 0;
v_red NUMBER(3) := 0;
BEGIN
<< blue >> LOOP
v_blue := v_blue + 1;
EXIT WHEN v_blue > 10;
<< red >> LOOP
v_red := v_red + 1;
EXIT WHEN v_red > 10;
-- Line A