Pagini

marți, 12 martie 2013

Section 2 Lesson 5: Writing PL/SQL Executable Statements


Writing PL/SQL Executable Statements

 Section 1
   
  1.  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?  (1) Points
   
    45
    29
    25 (*)
    14
   
  2.  Which explicit function is used to convert a character into a number?  (1) Points
   
    TO_DATE
    TO_NUMBER (*)
    TO_CHAR
   
  3.  Using implicit conversions is good programming practice.  (1) Points
   
    True
    False (*)
   
  4.  Examine the following block. What should be coded at Line A?
DECLARE
v_char VARCHAR2(8) := '24/09/07';
v_date DATE;
BEGIN
v_date := ....... Line A
END;
(1) Points
   
    v_date := FROM_CHAR(v_char,'dd/mm/yy');
    v_date := TO_DATE(v_char,'dd/mm/yy'); (*)
    v_date := v_char;

  5.  When PL/SQL converts data automatically from one data type to another, it is called _______ conversion.  (1) Points
   
    Explicit
    Implicit (*)
    TO_CHAR
   
  6.  The DECODE and MAX functions can be used in PL/SQL statements. True or False?  (1) Points
   
    True
    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 (*)

Niciun comentariu:

Trimiteți un comentariu