Data Manipulation   «Prev  Next»

Oracle Character functions - Quiz

Each question is worth one point. Select the best answer for each question.
1. Which function is designed to find the position of a word or other substring within a long character value?
Please select the best answer.
  A. RTRIM
  B. INSTR
  C. SUBSTR
  D. LENGTH

2. Assuming the default binary, case-sensitive collation, what value is returned by the following expression?
SUBSTR('I am Jack Horner.', 1, INSTR('I am Jack Horner.', 'J') - 1) || SUBSTR('He is Joe Sprat.', INSTR('He is Joe Sprat.', 'S'))

Please select the best answer.
  A. I am Jack Sprat.
  B. I am Joe Sprat.
  C. I am Sprat.
  D. I am JSprat.

3. Which numbered line causes an invalid-number-of-arguments error in the following query?
1 SELECT RPAD(UPPER(FIRSTNAME || ' ' || LASTNAME), 25, '-+'),
2        LOWER(CITY, INSTR(STATE, 'H')),
3        LPAD(INITCAP(STATE), LENGTH(CITY))
4 FROM CUSTOMER
5 WHERE SOUNDEX(LASTNAME) = SOUNDEX('Jonston')

Please select the best answer.
  A. 1
  B. 2
  C. 3
  D. 5

4. Which expression returns the number of characters in CUSTOMER_NAME rather than the number of bytes used to store it?
Please select the best answer.
  A. LENGTH(CUSTOMER_NAME)
  B. LENGTHB(CUSTOMER_NAME)
  C. SUBSTR(CUSTOMER_NAME, 1)
  D. LOWER(CUSTOMER_NAME)

5. Which expression replaces every occurrence of the substring St. with Street in ADDRESS_LINE?
Please select the best answer.
  A. REPLACE(ADDRESS_LINE, 'St.', 'Street')
  B. TRANSLATE(ADDRESS_LINE, 'St.', 'Street')
  C. RTRIM(ADDRESS_LINE, 'St.')
  D. SUBSTR(ADDRESS_LINE, 'St.', 'Street')