Section 2 Quiz
Section 2 Quiz
1. Which statements about lexical units are true? (Choose two.) Mark for Review
(1) Points
They are sequences of characters including letters, digits, tabs, returns and
symbols (*)
They are optional but can make a PL/SQL block execute faster
They are the building blocks of every PL/SQL program (*)
They are named objects stored in the database
Correct
Correct
3. What will be displayed when the following code is executed? Mark for Review
DECLARE (1) Points
x VARCHAR2(6) := 'Chang';
BEGIN
DECLARE
x VARCHAR2(12) := 'Susan';
BEGIN
x := x || x;
END;
DBMS_OUTPUT.PUT_LINE(x);
END;
Susan
Chang (*)
The code will fail with an error
ChangChang
SusanChang
Correct
4. A variable defined in an outer block is global to the outer block and local to the inner Mark for Review
block. True or False?
(1) Points
True
False (*)
Correct
Correct.
Not correct. (*)
DECLARE
v_number
NUMBER :=
10;
v_result
NUMBER;
Which of the
following
correctly
assigns the
value 50 to
V_RESULT?
7. The implicit data type conversion at Point A may not work correctly. Why not? Mark for Review
DECLARE (1) Points
v_mydate DATE;
BEGIN
V_MYDATE := '29-Feb-2004'; -- Point A
END;
8. Which of the following are valid PL/SQL operators? (Choose three.) Mark for Review
(1) Points
Exponential (*)
Arithmetic (*)
Concatenation (*)
Exception
Correct
9. Examine the following block. What should be coded at Line A? Mark for Review
DECLARE
v_char VARCHAR2(8) := '24-Sep-2007'; (1) Points
v_date DATE;
BEGIN
v_date := ....... Line A
END;
Correct
10. Which of the following is a composite data type? Mark for Review
(1) Points
DATE
VARCHAR2
CLOB
RECORD (*)
Correct
11. Which Mark for Review
statement
most (1) Points
closely
describes
"data
type"?
Correct
12. Which of the following makes PL/SQL code easier to read and maintain? Mark for Review
(1) Points
13. Which of the following are examples of good programming practice? (Choose Mark for Review
three.)
(1) Points
14. You need to declare a variable to hold a value which has been read from the Mark for Review
SALARY column of the EMPLOYEES table. Which of the following is an
advantage of declaring the variable as: employees.salary%TYPE ? (1) Points
If the SALARY column is ALTERed later, the PL/SQL code need not be
changed. (*)
It is shorter than coding NUMBER(8,2)
It executes much faster than using NUMBER(8,2)
It allows the software to perform implicit data type conversions.
Correct
15. Which of the following is NOT a character data type? Mark for Review
(1) Points
LONG
BOOLEAN (*)
CHAR
VARCHAR2
Correct