Shiridi Sai Baba

Conversion Functions - Answers




1.   What type of conversion is performed by the following statement?
SELECT LENGTH(3.14285) FROM DUAL; (Choose the best answer.)

a.    Explicit conversion
b.  Implicit conversion
c.    TO_NUMBER function conversion
d.   None of the above

2.   Choose all correct statements regarding conversion functions. (Choose all that apply.)

a.  TO_CHAR may convert date items to character items.
b.  TO_DATE may convert character items to date items.
c.   TO_CHAR may convert numbers to character items.
d.   TO_DATE may convert date items to character items.

3.   What value is returned after executing the following statement?
SELECT TO_NUMBER(1234.49, '999999.9') FROM DUAL; (Choose the best answer.)

a.    1234.49
b.   001234.5
c.    1234.5
d.  None of the above
Note:      TO_NUMBER accepts character and converts it into number.
              To_CHAR accepts Number and converts it into character.

4.   What value is returned after executing the following statement?
SELECT TO_CHAR(1234.49, '999999.9') FROM DUAL;      (Choose the best answer.)

a.    1234.49
b.    001234.5
c.   1234.5
d.   None of the above

5.   If SYSDATE returns 12-JUL-2009, what is returned by the following statement?
SELECT TO_CHAR(SYSDATE, 'fmMONTH, YEAR') FROM DUAL;        (Choose the best answer.)

a.    JUL, 2009
b.  JULY, TWO THOUSAND NINE
c.    JUL-09
d.    None of the above
6.   If SYSDATE returns 12-JUL-2009, what is returned by the following statement?
SELECT TO_CHAR(SYSDATE, 'fmDDth MONTH') FROM DUAL;         (Choose the best answer.)

a.   12TH JULY
b.    12th July
c.    TWELFTH JULY
d.    None of the above
Note : Since DD, MONTH are used. Oracle returns UPPER case output.
                   If we use dd, month are used then Oracle returns LOWER case output.
           
7.   If SYSDATE returns 12-JUL-2009, what is returned by the following statement?
SELECT TO_CHAR(TO_DATE(TO_CHAR(SYSDATE,'DD'),'DD'),'YEAR') FROM DUAL;
(Choose the best answer.)

a.    2009
b.  TWO THOUSAND NINE
c.    12-JUL-2009
d.    None of the above

8.   What value is returned after executing the following statement?
SELECT NVL2(NULLIF('CODA','SID'),'SPANIEL','TERRIER') FROM DUAL;
(Choose the best answer.)
a.   SPANIEL
b.    TERRIER
c.    NULL
d.    None of the above

9.   What value is returned after executing the following statement?
SELECT NVL(SUBSTR('AM I NULL',10),'YES I AM') FROM DUAL;         (Choose the best answer.)
a.    NO
b.    NULL
c.   YES I AM
d.    None of the above

10.                If SYSDATE returns 12-JUL-2009, what is returned by the following statement?
SELECT DECODE(TO_CHAR(SYSDATE,'MM'),'02','TAX DUE','PARTY') FROM DUAL;
(Choose the best answer.)

a.    TAX DUE
b.  PARTY
c.    02
d.    None of the above