Writing PL/SQL Executable Statements: Quiz

Writing PL/SQL Executable Statements: Quiz

1)Which of the following is correct?
*v_family_name := 'SMITH';

2)PL/SQL statements must be written on a single line.
*     False

3)The DECODE and MAX functions can be used in PL/SQL statements. True or False?
*     False

4)When PL/SQL converts data automatically from one data type to another, it is called _______ conversion.
*Implicit

5)     Explicit conversions can be slower than implicit conversions. True or False?
*False

6)Which of the following statements about implicit conversions is NOT true?
*Code containing implicit conversions typically runs faster than code containing explicit conversions.

7)Using implicit conversions is good programming practice.
*False

8)Which explicit function is used to convert a character into a number?
*TO_NUMBER

9)Which of the following are valid PL/SQL operators? (Choose three.)
*Arithmetic
*Exponential
*Concatenation

10)Examine the following code: DECLARE x VARCHAR2(20); BEGIN x:= 5 + 4 * 5 ; DBMS_OUTPUT.PUT_LINE(x); END; What value of x will be displayed?
*45

11)The TO_CHAR function is used for explicit data type conversions. True or False?
*true

12).     Examine the following block. What should be coded at Line A?
DECLARE
v_char VARCHAR2(8) := '24/09/2007';
v_date DATE;
BEGIN
v_date := ....... Line A
END;
*v_date := TO_DATE(v_char,'dd/mm/yyyy');

13)     Which of the following data type conversions can be done implicitly? (Choose two.)
*NUMBER to PLS_INTEGER
*NUMBER to VARCHAR2

14)PL/SQL can implicitly convert a CHAR to a NUMBER, provided the CHAR contains a numeric value, for example '123'. True or False?
*true

15)     The LENGTH and ROUND functions can be used in PL/SQL statements. True or False?
*true

16)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;
*the block will fail because the character value "Today" cannot be implicitly converted to a date.

Comments

Post a Comment