Home
61.
The SALARY table has the following data:



Consider the following SQL instructions, and choose the best option:
SELECT last_name, NVL2(salary, salary, 0) N1,
NVL(salary,0) N2
FROM salary;
  • A.
    Column N1 and N2 will have different results.
  • B.
    Column N1 will show zero for all rows, and column N2 will show the correct salary values, and zero for Tobias.
  • C.
    The SQL will error out because the number of arguments in the NVL2 function is incorrect.
  • D.
    Columns N1 and N2 will show the same result.
  • Answer & Explanation
  • Report
Answer : [D]
Explanation :
The NVL function returns zero if the salary value is NULL , or else it returns the origi- nal value. The NVL2 function returns the second argument if the salary value is not NULL . If NULL , the third argument is returned.
Report
Name Email  
62.
Which two functions could you use to strip leading characters from a character string? (Choose two.)
  • A.
    LTRIM
  • B.
    SUBSTR
  • C.
    RTRIM
  • D.
    INSTR
  • D.
    STRIP
  • Answer & Explanation
  • Report
Answer : [A, B
Explanation :
RTRIM removes trailing (not leading) characters. INSTR returns a number. STRIP is not a valid Oracle function. SUBSTR , with the second argument greater than 1, removes leading characters from a string.
Report
Name Email  
63.
What is the result of MOD(x1, 4) if x1 is 11?
  • A.
    -1
  • B.
    3
  • C.
    1
  • D.
    REMAINDER(11,4)
  • Answer & Explanation
  • Report
Answer : [B]
Explanation :
MOD returns the number remainder after division. The REMAINDER function is similar to MOD but will use the ROUND function in the algorithm; hence, the result of REMAINDER(11,4) would be –1 . MOD uses FLOOR in the algorithm.
Report
Name Email  
64.
Which SQL statement will replace the last two characters of last_name with 'XX' in the employees table when executed?
  • A.
    SELECT RTRIM(last_name, SUBSTR(last_name, LENGTH(last_name)-1)) || 'XX' new_col FROM employees;
  • B.
    SELECT REPLACE(last_name, SUBSTR(last_name, LENGTH(last_name)-1), 'XX') new_col FROM employees;
  • C.
    SELECT REPLACE(SUBSTR(last_name, LENGTH(last_name)-1), 'XX') new_col FROM employees;
  • D.
    SELECT CONCAT(SUBSTR(last_name, 1,LENGTH(last_name)-2), 'XX') new_col FROM employees;
  • Answer & Explanation
  • Report
Answer : [D]
Explanation :
The SUBSTR function in option A would return the last two characters of the last name. These two characters are right-trimmed using the RTRIM function. The result would be the first portion of the last name and is concatenated to 'XX' only if the last two characters are not repeating (for example, Pululul will be PXX ). Option B would replace all the occurrences of the last two characters. Option C would choose only the last two characters.
Report
Name Email  
65.
Which date components does the CURRENT_TIMESTAMP function display?
  • A.
    Session date, session time, and session time zone offset
  • B.
    Session date and session time
  • C.
    Session date and session time zone offset
  • D.
    Session time zone offset
  • Answer & Explanation
  • Report
Answer : [A]
Explanation :
The CURRENT_TIMESTAMP function returns the session date, session time, and session time zone offset. The return datatype is TIMESTAMP WITH TIME ZONE.
Report
Name Email