Section 2
Code is easier to read if you declare one identifier per
line. True or False?
True
(*)
False
If you are using the %TYPE
attribute, you can avoid hard coding the:
Column
name
Data
type (*)
Table
name
Constraint
Using implicit conversions is
good programming practice.
True
False
(*)
Examine the following code.
What is the final value of V_MYVAR ?
DECLARE
v_myvar NUMBER;
BEGIN
v_myvar := 1 + 2 *
3;
v_myvar := v_myvar
* 2;
END;
18
81
49
14 (*)
Examine the following block.
What should be coded at Line A?
DECLARE
v_char VARCHAR2(8) := '24-Sep-2007';
v_date DATE;
BEGIN
v_date := ....... Line A
END;
v_date
:= FROM_CHAR(v_char,'dd-Mon-YYYY');
v_date
:= v_char;
v_date
:= TO_DATE(v_char,'dd-Mon-YYYY'); (*)
Which of the following are lexical units? (Choose two.)
PL/SQL
blocks
Data
types
Literals
(*)
Identifiers
(*)
Valid identifiers begin with a
_____.
Letter
(*)
Number
Special
character
A datatype may specify a valid
range of values. True or False?
True
(*)
False
Which statement most closely
describes "data type"?
It is
the value of a variable.
It is
used to test if errors have occurred.
It
specifies a storage format, constraints, and a valid range of values for a
variable. (*)
It
allows different kinds of data to be stored in a single variable.
Two variables with the same name
can be declared in an outer block and an inner block. True or False
True
(*)
False
What will be displayed when the following code is executed?
DECLARE
x VARCHAR2(6) :=
'Chang';
BEGIN
DECLARE
x VARCHAR2(12)
:= 'Susan';
BEGIN
x := x || x;
END;
DBMS_OUTPUT.PUT_LINE(x);
END;
ChangChang
Chang
(*)
SusanChang
Susan
The
code will fail with an error
Variables can be used in the
following ways in a PL/SQL block. (Choose two.)
To
refer to a single data value several times. (*)
To
rename tables and columns.
To
comment code.
To
store data values. (*)
Which of the following are
required when declaring a variable? (Choose two.)
CONSTANT
Data
type (*)
NOT
NULL
Identifier
name (*)
Which of the following will help
to make code easier to read?
Including
comments in the code. (*)
Using
%Type.
Naming
variables.
Examine the following code:
DECLARE
v_first_name varchar2 (30);
v_salary number (10);
BEGIN
SELECT first_name, salary
INTO v_first_name, v_salary
FROM employees
WHERE last_name = 'King';
END;
Which programming guideline would improve this code?
Use a
suitable naming convention for variables.
Use
upper and lower case consistently.
Indent
the code to make it more readable. (*)
No comments:
Post a Comment