Database Programming With SQL Section 4 Quiz
Database Programming With SQL Section 4 Quiz
Database Programming With SQL Section 4 Quiz
Section 4 Quiz
(Answer all questions in this section)
1. Which number function may be used to determine if a value is odd or even? Mark
for Review
(1) Points
TRUNC
MOD (*)
ROUND
BINARY
46
45.9
50 (*)
None of the above
3. Which two functions can be used to manipulate number or date column values, but NOT character
column values? (Choose two.) Mark for Review
(1) Points
(Choose all correct answers)
CONCAT
INSTR
ROUND (*)
RPAD
TRUNC (*)
4. Evaluate this function: MOD (25, 2) Which value is returned? Mark for Review
(1) Points
0
25
1 (*)
2
5. Which script displays '01-May-2004' when the HIRE_DATE value is '20-May-2004'? Mark
for Review
(1) Points
6. You need to display the current year as a character value (for example: Two Thousand and One).
Which element would you use? Mark for Review
(1) Points
YY
YYYY
RR
YEAR (*)
11-Jul-1995
11-Jan-2000
This in not a valid SQL statement. (*)
11-Jul-2000
8. You need to display the number of months between today's date and each employee's hiredate.
Which function should you use? Mark for Review
(1) Points
ROUND
ADD_MONTHS
BETWEEN
MONTHS_BETWEEN (*)
9. Which query would return a whole number if the sysdate is 26-May-2004? Mark for Review
(1) Points
10. Which SELECT statement will NOT return a date value? Mark for Review
(1) Points
11. You need to display each employee's name in all uppercase letters. Which function should you
use? Mark for Review
(1) Points
CASE
TOUPPER
UCASE
UPPER (*)
Programming
Database
PROGRAMMING (*)
DATABASE
1
2
17
13 (*)
15. Which of the following are types of SQL functions? (Choose two correct answers.) Mark for
Review
(1) Points
(Choose all correct answers)
Column-Row Functions
Multi-Row Functions (*)
Single-Row Functions (*)
Many-to-Many Functions
1200
1300 (*)
1282.25
1282
46
45.9
50 (*)
None of the above
5. Which number function may be used to determine if a value is odd or even? Mark for Review
(1) Points
BINARY
MOD (*)
TRUNC
ROUND
6. If hire_date has a value of '03-Jul-2003', then what is the output from this code?
SELECT ROUND(hire_date, 'Year') FROM employees; Mark for Review
(1) Points
01-Jul-2003
01-Jan-2003
01-Jan-2004 (*)
01-Aug-2003
7. Which SELECT statement will return a numeric value? Mark for Review
(1) Points
SELECT SYSDATE - 7
FROM employees;
8. Which query would return a whole number if the sysdate is 26-May-2004? Mark for Review
(1) Points
9. 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
17-Jul-1994
11-Jul-1994 (*)
17-Jan-1994
11-Jan-1995
17
1
2
13 (*)
You query the database and return the value 95. Which script did you use?
SELECT SUBSTR(product_id, 3, 2)
FROM price
WHERE manufacturer_id = 59604;
(*)
SELECT LENGTH(product_id, 3, 2)
FROM price
WHERE manufacturer_id = 59604;
13. You need to display the number of characters in each customer's last name. Which function should
you use? Mark for Review
(1) Points
SUBSTR
COUNT
LENGTH (*)
LPAD
14. Identify the output from the following SQL statement:
SELECT RPAD('SQL',6, '*')
FROM DUAL;
SQL*** (*)
******SQL
***SQL
SQL******
Database
Programming
DATABASE
PROGRAMMING (*)
The values returned by this SELECT statement will be of which data type?
DATE (*)
INTEGER
NUMBER
DATETIME
2. If hire_date has a value of '03-Jul-2003', then what is the output from this code?
SELECT ROUND(hire_date, 'Year') FROM employees; Mark for Review
(1) Points
01-Jan-2004 (*)
01-Aug-2003
01-Jan-2003
01-Jul-2003
3. Which query would return a whole number if the sysdate is 26-May-2004? Mark for Review
(1) Points
11-Jul-2000
11-Jan-2000
This in not a valid SQL statement. (*)
11-Jul-1995
11-Jan-1995
11-Jul-1994 (*)
17-Jan-1994
17-Jul-1994
6. Which script displays '01-May-2004' when the HIRE_DATE value is '20-May-2004'? Mark
for Review
(1) Points
46
45.9
50 (*)
None of the above
IS NULL
BETWEEN IN
LIKE
IN (*)
9. Which number function may be used to determine if a value is odd or even? Mark for Review
(1) Points
TRUNC
ROUND
MOD (*)
BINARY
10. Evaluate this function: MOD (25, 2) Which value is returned? Mark for Review
(1) Points
2
25
1 (*)
0
11. Which of the following are types of SQL functions? (Choose two correct answers.) Mark for
Review
(1) Points
(Choose all correct answers)
INSTR (*)
SUBSTR
CONCAT
LENGTH
13 (*)
1
2
17
CONCAT
SUBSTR
LOWER (*)
All three will be evaluated simultaneously.
15. You need to display the number of characters in each customer's last name. Which function should
you use? Mark for Review
(1) Points
SUBSTR
LENGTH (*)
LPAD
COUNT