Section 4 Quiz
(Answer all questions in this section)
1. You issue this SQL statement:
SELECT TRUNC(751.367,-1) FROM dual;
Which value does this statement display?
Mark for Review
(1) Points
750 (*)
751
700
751.3
Incorrect. Refer to Section 4 Lesson 2.
2. ROUND and TRUNC functions can be used with which of the following Datatypes?
Mark for Review
(1) Points
Dates and numbers (*)
Dates and characters
Numbers and characters
None of the above
Correct
3. Which number function may be used to determine if a value is odd or even?
Mark for Review
(1) Points
TRUNC
BINARY
ROUND
MOD (*)
Correct
4. The answer to the following script is 456. True or False?
SELECT TRUNC(ROUND(456.98))
FROM dual;
True
False (*)
Correct
Mark for Review
(1) Points
5. You issue this SQL statement:
Mark for Review
SELECT ROUND (1282.248, -2) FROM dual;
What value does this statement produce?
(1) Points
1282
1282.25
1200
1300 (*)
Correct
6.
The STYLES table contains this data:
Mark for Review
STYLE_ID
STYLE_NAME
CATEGORY
COST
895840
SANDAL
85940
12.00
968950
SANDAL
85909
10.00
869506
SANDAL
89690
15.00
809090
LOAFER
89098
10.00
890890
LOAFER
89789
14.00
857689
HEEL
85940
11.00
758960
SANDAL
86979
12.00
(1) Points
You query the database and return the value 79. Which script
did you use?
SELECT SUBSTR(category, 2,2)
FROM styles
WHERE style_id = 895840;
SELECT SUBSTR(category, -2,2)
FROM styles
WHERE style_id = 758960;
(*)
SELECT INSTR(category, -2,2)
FROM styles
WHERE style_id = 895840;
SELECT INSTR(category, 2,2)
FROM styles
WHERE style_id = 895840;
Correct
7.
Evaluate this SELECT statement:
SELECT LENGTH(email)
FROM employee;
What will this SELECT statement display?
The maximum number of characters allowed in the EMAIL
column
The email address of each employee in the EMPLOYEE
table
The number of characters for each value in the EMAIL
column in the employees table (*)
Mark for Review
(1) Points
The longest e-mail address in the EMPLOYEE table
Correct
8.
Which three statements about functions are true? (Choose
three.)
Mark for Review
(1) Points
(Choose all correct answers)
The CONCAT function can only be used on character
strings, not on numbers.
The SUBSTR character function returns a portion of a
string beginning at a defined character position to a
specified length. (*)
The ROUND number function rounds a value to a
specified decimal place or the nearest whole number. (*)
The SYSDATE function returns the Oracle Server date and
time. (*)
Correct
9.
Character functions accept character arguments and only
return character values. True or False?
Mark for Review
(1) Points
True
False (*)
Correct
10. You query the database with this SQL statement:
Mark for Review
SELECT CONCAT(last_name, (SUBSTR(LOWER(first_name), 4)))
(1) Points
"Default Password"
FROM employees;
Which function will be evaluated first?
CONCAT
SUBSTR
LOWER (*)
All three will be evaluated simultaneously.
Correct
11. Which
Mark for Review
function
would you
use to
(1) Points
return the
current
database
server
date and
time?
CURRENTDATE
DATETIME
SYSDATE (*)
DATE
Correct
12.
You need to subtract three months from the current date. Which function should you
use?
Mark for Review
(1) Points
ROUND
MONTHS_BETWEEN
ADD_MONTHS (*)
TO_DATE
Correct
13.
What function would you use to return the highest date in a month?
Mark for Review
(1) Points
END_DAY
HIGHEST_DAY
FINAL_DAY
LAST_DAY (*)
Correct
14.
Which SELECT statement will return a numeric value?
Mark for Review
(1) Points
SELECT SYSDATE - 7
FROM employees;
SELECT SYSDATE + 600 / 24
FROM employees;
SELECT ROUND(hire_date, DAY)
FROM employees;
SELECT (SYSDATE - hire_date) / 7
FROM employees;
(*)
Correct
15.
Which query would return a whole number if the sysdate is 26-May-2004?
Mark for Review
(1) Points
SELECT TRUNC(MONTHS_BETWEEN(SYSDATE,'19-Mar-1979') /12)
AS YEARS
FROM DUAL;
(*)
SELECT TRUNC(YEARS_BETWEEN(SYSDATE,'19-Mar-1979') /12)
AS YEARS
FROM DUAL;
SELECT MONTHS_BETWEEN(SYSDATE,'19-Mar-1979') /12
AS YEARS
FROM DUAL;
None of the above
Incorrect. Refer to Section 4 Lesson 3.