16.
Which function implements IF…THEN…ELSE logic?
- [A]INITCAP
- [B]REPLACE
- [C]DECODE
- [D]IFELSE
- Answer & Explanation
- Report
Answer : [C]
Explanation :
Explanation :
The INITCAP function capitalizes the first letter in each word. The REPLACE function performs search-and-replace string operations. There is no IFELSE function. The DECODE function is the one that implements IF…THEN…ELSE logic. |
17.
Which statement would change all occurrences of the string 'IBM' to the string 'SUN' in
the DESCRIPTION column of the VENDOR table?
- [A]SELECT TRANSLATE(description, 'IBM', 'SUN') FROM vendor
- [B]SELECT CONVERT(description, 'IBM', 'SUN') FROM vendor
- [C]SELECT EXTRACT(description, 'IBM', 'SUN') FROM vendor
- [D]SELECT REPLACE(description, 'IBM', 'SUN') FROM vendor
- Answer & Explanation
- Report
Answer : [D]
Explanation :
Explanation :
CONVERT is used to change from one character set to another. EXTRACT works on date/ time datatypes. TRANSLATE changes all occurrences of each character with a positionally corresponding character, so 'I like IBM' would become 'S like SUN'. |
18.
Which function will return a TIMESTAMP WITH TIME ZONE datatype?
- [A]CURRENT_TIMESTAMP
- [B]LOCALTIMESTAMP
- [C]CURRENT_DATE
- [D]SYSDATE
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
LOCALTIMESTAMP does not return the time zone. CURRENT_DATE and SYSDATE return neither fractional seconds nor a time zone; they both return the DATE datatype. |
19.
Which expression will always return the date one year later than the current date?
- [A]SYSDATE + 365
- [B]SYSDATE + TO_YMINTERVAL('01-00')
- [C]CURRENT_DATE + 1
- [D]NEW_TIME(CURRENT_DATE,1,'YEAR')
- [E]None of the above
- Answer & Explanation
- Report
Answer : [E]
Explanation :
Explanation :
Option A will not work if there is a February 29 (leap year) in the next 365 days. Option B will always add one year to the present date, except if the current date is February 29 (leap year). Option C will return the date one day later. NEW_TIME is used to return the date/time in a different time zone. ADD_MONTHS (SYSDATE,12) can be used to achieve the desired result. |
20.
What will the following SQL statement return?
SELECT COALESCE(NULL,'Oracle ','Certified') FROM dual;
- [A]NULL
- [B]Oracle
- [C]Certified
- [D]Oracle Certified
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
The COALESCE function returns the first non-NULL parameter, which is the character string 'Oracle |