Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
2K views

Writing PL SQL Executable Statements

This quiz tested knowledge of PL/SQL data type conversions and executable statements. Key points covered include: - Implicit conversions automatically change data types, while explicit conversions use functions like TO_DATE and TO_NUMBER. - Implicit conversions between data types like NUMBER and DATE are allowed, while conversions from strings to dates require explicit functions. - PL/SQL statements can contain functions like LENGTH, ROUND, and arithmetic operators but not DECODE or MAX. Implicit conversions are generally faster than explicit but can cause errors if data types change.

Uploaded by

Catalina Achim
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2K views

Writing PL SQL Executable Statements

This quiz tested knowledge of PL/SQL data type conversions and executable statements. Key points covered include: - Implicit conversions automatically change data types, while explicit conversions use functions like TO_DATE and TO_NUMBER. - Implicit conversions between data types like NUMBER and DATE are allowed, while conversions from strings to dates require explicit functions. - PL/SQL statements can contain functions like LENGTH, ROUND, and arithmetic operators but not DECODE or MAX. Implicit conversions are generally faster than explicit but can cause errors if data types change.

Uploaded by

Catalina Achim
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 5

Test: Quiz: Writing PL/SQL Executable Statements 1.

When PL/SQL converts data automatically from one data type to another, it is called _______ conversion. Mark for Review (1) Points Explicit Implicit (*) TO_CHAR

Correct 2. Which of the following data type conversions can be done implicitly? (C hoose two.) Mark for Review (1) Points (Choose all correct answers) DATE to NUMBER NUMBER to VARCHAR2 (*) NUMBER to PLS_INTEGER (*)

Incorrect. Refer to Section 2 Lesson 5. 3. 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; Mark for Review (1) Points v_date := FROM_CHAR(v_char,'dd/mm/yy'); v_date := TO_DATE(v_char,'dd/mm/yy'); (*) v_date := v_char;

Incorrect. Refer to Section 2 Lesson 5. 4. Explicit conversions can be slower than implicit conversions. True or F alse? Mark for Review (1) Points True False (*)

Incorrect. Refer to Section 2 Lesson 5. 5. PL/SQL statements must be written on a single line. (1) Points True False (*) Mark for Review

Incorrect. Refer to Section 2 Lesson 5. 6. The LENGTH and ROUND functions can be used in PL/SQL statements. True o r False? Mark for Review (1) Points True (*) False

Correct 7. 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; Mark for Review (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 implic itly converted to a date. (*)

Correct 8. The DECODE and MAX functions can be used in PL/SQL statements. True or False? Mark for Review (1) Points True False (*)

Incorrect. Refer to Section 2 Lesson 5. 9. Using implicit conversions is good programming practice. Review (1) Points True False (*) Mark for

Correct 10. PL/SQL can implicitly convert a CHAR to a NUMBER, provided the CHAR con tains a numeric value, for example '123'. True or False? Mark for Review (1) Points True (*) False

Incorrect. Refer to Section 2 Lesson 5. 11. (1) Points Which of the following is correct? Mark for Review

v_family_name = SMITH; V_FAMILY_NAME = SMITH;

v_family_name := SMITH; v_family_name := 'SMITH'; (*)

Correct 12. Which of the following statements about implicit conversions is NOT tru e? Mark for Review (1) Points Code containing implicit conversions typically runs faster than code con taining explicit conversions. (*) Code containing implicit conversions may not work in the future if Oracl e changes the conversion rules. Code containing implicit conversions is harder to read and understand.

Incorrect. Refer to Section 2 Lesson 5. 13. The TO_CHAR function is used for explicit data type conversions. True o r False? Mark for Review (1) Points True (*) False

Incorrect. Refer to Section 2 Lesson 5. 14. Which explicit function is used to convert a character into a number? Mark for Review (1) Points TO_DATE TO_NUMBER (*) TO_CHAR

Correct

15. 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? Mark for Review (1) Points 45 29 25 (*) 14

Correct ose three.) (1) Points 16. Which of the following are valid PL/SQL operators? (Cho Mark for Review (Choose all correct answers) Concatenation (*) Exception Exponential (*) Arithmetic (*)

Incorrect. Refer to Section 2 Lesson 5.

You might also like