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
2. What is the result of the following SQL
Statement:
SELECT
ROUND(45.923,-1)
FROM
DUAL; Mark for Review
(1)
Points
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
SELECT ROUND(hire_date, 'MON')
FROM
employees;
SELECT ROUND(hire_date, 'MONTH')
FROM
employees;
SELECT TRUNC(hire_date, 'MI')
FROM
employees;
SELECT TRUNC(hire_date, 'MONTH')
FROM
employees;
(*)
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 (*)
7. What is the result of the following
query?
SELECT
ADD_YEARS ('11-Jan-1994',6)
FROM
dual; Mark for Review
(1)
Points
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
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
10. Which SELECT statement will NOT return a
date value? Mark for Review
(1)
Points
SELECT (hire_date - SYSDATE) +
TO_DATE('25-Jun-2002')
FROM
employees;
SELECT (30 + hire_date) + 1440/24
FROM
employees;
SELECT SYSDATE -
TO_DATE('25-Jun-2002') + hire_date
FROM
employees;
SELECT (SYSDATE - hire_date) + 10*8
FROM
employees;
(*)
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 (*)
12. The STYLES table contains this data:
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
You
query the database and return the value 79. Which script did you use?
Mark for Review
(1)
Points
SELECT SUBSTR(category, -2,2)
FROM
styles
WHERE
style_id = 758960;
(*)
SELECT SUBSTR(category, 2,2)
FROM
styles
WHERE
style_id = 895840;
SELECT INSTR(category, 2,2)
FROM
styles
WHERE
style_id = 895840;
SELECT INSTR(category, -2,2)
FROM
styles
WHERE
style_id = 895840;
13. What does the following SQL SELECT
statement return?
SELECT
UPPER( SUBSTR('Database Programming', INSTR('Database Programming','P'),20))
FROM
dual;
Mark
for Review
(1)
Points
Programming
Database
PROGRAMMING (*)
DATABASE
14. You issue this SQL statement:
SELECT
INSTR ('organizational sales', 'al')
FROM
dual;
Which
value is returned by this command?
Mark for Review
(1)
Points
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
1. The answer to the following script is
456. True or False?
SELECT
TRUNC(ROUND(456.98))
FROM
dual;
Mark for Review
(1)
Points
True
False (*)
2. You issue this SQL statement:
SELECT
ROUND (1282.248, -2) FROM dual;
What
value does this statement produce?
Mark for Review
(1)
Points
1200
1300 (*)
1282.25
1282
3. You issue this SQL statement:
SELECT
TRUNC(751.367,-1) FROM dual;
Which
value does this statement display?
Mark for Review
(1)
Points
700
750 (*)
751.3
751
4. What is the result of the following SQL
Statement:
SELECT
ROUND(45.923,-1)
FROM
DUAL; Mark for Review
(1)
Points
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 ROUND(hire_date, DAY)
FROM
employees;
SELECT (SYSDATE - hire_date) / 7
FROM
employees;
(*)
SELECT SYSDATE + 600 / 24
FROM
employees;
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
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
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
10. What
is the result of the following query?
SELECT
ADD_MONTHS ('11-Jan-1994',6)
FROM
dual; Mark for Review
(1)
Points
17-Jul-1994
11-Jul-1994 (*)
17-Jan-1994
11-Jan-1995
11. You
issue this SQL statement:
SELECT
INSTR ('organizational sales', 'al')
FROM
dual;
Which
value is returned by this command?
Mark for Review
(1) Points
17
1
2
13 (*)
12. The
PRICE table contains this data:
PRODUCT_ID MANUFACTURER_ID
86950 59604
You
query the database and return the value 95. Which script did you use?
Mark for Review
(1)
Points
SELECT TRIM(product_id, -3, 2)
FROM
price
WHERE
manufacturer_id = 59604;
SELECT SUBSTR(product_id, 3, 2)
FROM
price
WHERE
manufacturer_id = 59604;
(*)
SELECT LENGTH(product_id, 3, 2)
FROM
price
WHERE
manufacturer_id = 59604;
SELECT SUBSTR(product_id, -1, 3)
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;
Mark for Review
(1)
Points
SQL*** (*)
******SQL
***SQL
SQL******
15. What
does the following SQL SELECT statement return?
SELECT
UPPER( SUBSTR('Database Programming', INSTR('Database Programming','P'),20))
FROM
dual;
Mark for Review
(1)
Points
Database
Programming
DATABASE
PROGRAMMING (*)
1. The EMPLOYEES table contains these
columns:
LAST_NAME
VARCHAR2(20)
FIRST_NAME
VARCHAR2(20)
HIRE_DATE
DATE
EVAL_MONTHS
NUMBER(3)
Evaluate
this SELECT statement:
SELECT
hire_date + eval_months
FROM
employees;
The
values returned by this SELECT statement will be of which data type?
Mark for Review
(1)
Points
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
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
4. What is the result of the following
query?
SELECT
ADD_YEARS ('11-Jan-1994',6)
FROM
dual; Mark for Review
(1)
Points
11-Jul-2000
11-Jan-2000
This in not a valid SQL statement.
(*)
11-Jul-1995
5. What is the result of the following
query?
SELECT
ADD_MONTHS ('11-Jan-1994',6)
FROM
dual; Mark for Review
(1)
Points
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
SELECT ROUND(hire_date, 'MONTH')
FROM
employees;
SELECT ROUND(hire_date, 'MON')
FROM
employees;
SELECT TRUNC(hire_date, 'MI')
FROM
employees;
SELECT TRUNC(hire_date, 'MONTH')
FROM
employees;
(*)
7. What is the result of the following SQL
Statement:
SELECT
ROUND(45.923,-1)
FROM
DUAL; Mark for Review
(1)
Points
46
45.9
50 (*)
None of the above
8. Which comparison operator retrieves a
list of values? Mark for Review
(1)
Points
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)
Multi-Row Functions (*)
Single-Row Functions (*)
Column-Row Functions
Many-to-Many Functions
12. Which
SQL function is used to return the position where a specific character string
begins within a larger character string?
Mark for Review
(1)
Points
INSTR (*)
SUBSTR
CONCAT
LENGTH
13. You
issue this SQL statement:
SELECT
INSTR ('organizational sales', 'al')
FROM
dual;
Which
value is returned by this command?
Mark for Review
(1)
Points
13 (*)
1
2
17
14. You
query the database with this SQL statement:
SELECT
CONCAT(last_name, (SUBSTR(LOWER(first_name), 4))) "Default Password"
FROM
employees;
Which
function will be evaluated first?
Mark for Review
(1)
Points
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
terimakasih. Sangat membantu :)
BalasHapusbandar judi online sabung ayam terbesar indonesia
BalasHapusyoutube adu ayam
BalasHapusKomentar ini telah dihapus oleh pengarang.
BalasHapusBosan Menang tidak dibayar ? judi sabung ayam
BalasHapusWhat function would you use to return the highest date in a month?
BalasHapusLAST_DAY (*)
HIGHEST_DAY
END_DAY
FINAL_DAY
Which of the following SQL statements will correctly display the last name and the number of weeks employed for all employees in department 90?
BalasHapusSELECT last_name, (SYSDATE-hire_date)AS WEEK
FROM employees
WHERE department_id = 90;
SELECT last_name, # of WEEKS
FROM employees
WHERE department_id = 90;
SELECT last_name, (SYSDATE-hire_date)/7 AS WEEKS
FROM employees
WHERE department_id = 90; (*)
SELECT last name, (SYSDATE-hire_date)/7 DISPLAY WEEKS
FROM employees
WHERE department id = 90;
What does the following SQL SELECT statement return?
BalasHapusSELECT UPPER( SUBSTR('Database Programming', INSTR('Database Programming','P'),20))
FROM dual;
DATABASE
Database
Programming
PROGRAMMING (*)
Which SQL function can be used to remove heading or trailing characters (or both) from a character string?
BalasHapusLPAD
NVL2
TRIM (*)
CUT
Evaluate this SELECT statement:
BalasHapusSELECT SYSDATE + 30
FROM dual;
Which value is returned by the query?
The current date plus 30 hours.
The current date plus 30 days. (*)
No value is returned because the SELECT statement generates an error.
The current date plus 30 months.
Which query would return a user password combining the ID of an employee and the first 4 digits of the last name?
BalasHapusSELECT CONCAT (employee_id, INSTR(last_name,1,4))
AS "User Passwords"
FROM employees
SELECT CONCAT (employee_id, SUBSTR(last_name,4,1))
AS "User Passwords"
FROM employees
SELECT CONCAT (employee_id, SUBSTR(last_name,1,4))
AS "User Passwords"
FROM employees (*)
SELECT CONCAT (employee_id, INSTR(last_name,4,1))
AS "User Passwords"
FROM employees
Which function would you use to return the current database server date and time?
BalasHapusDATETIME
DATE
CURRENTDATE
SYSDATE (*)
Which three statements about functions are true? (Choose three.)
BalasHapus(Choose all correct answers)
The SYSDATE function returns the Oracle Server date and time. (*)
The ROUND number function rounds a value to a specified decimal place or the nearest whole number. (*)
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. (*)
You need to return a portion of each employee's last name, beginning with the first character up to the fifth character. Which character function should you use?
BalasHapusCONCAT
TRUNC
INSTR
SUBSTR (*)
Which query selects the first names of the DJ On Demand clients who have a first name beginning with "A"?
BalasHapusSELECT UPPER(first_name)
FROM d_clients
WHERE first_name LIKE 'a%'
SELECT UPPER(first_name)
FROM d_clients
WHERE LOWER(first_name) LIKE 'a%' (*)
SELECT UPPER(first_name)
FROM d_clients
WHERE first_name LIKE '%a%'
SELECT UPPER(first_name)
FROM d_clients
WHERE first_name LIKE %a%
You want to create a report that displays all orders and their amounts that were placed during the month of January. You want the orders with the highest amounts to appear first. Which query should you issue?
BalasHapusSELECT orderid, total
FROM orders
WHERE order_date BETWEEN '01-Jan-2002' AND '31-Jan-2002'
ORDER BY total DESC; (*)
SELECT orderid, total
FROM orders
WHERE order_date BETWEEN '31-Jan-2002' AND '01-Jan-2002'
ORDER BY total DESC;
SELECT orderid, total
FROM orders
WHERE order_date IN ( 01-Jan-2002 , 31-Jan-2002 )
ORDER BY total;
SELECT orderid, total
FROM orders
WHERE order_date LIKE '01-Jan-2002' AND '31-Jan-2002'
ORDER BY total DESC;
What will the following SQL statemtent display?
BalasHapusSELECT last_name, LPAD(salary, 15, '$')SALARY
FROM employees;
The last name of employees that have a salary that includes a $ in the value, size of 15 and the column labeled SALARY.
The query will result in an error: "ORA-00923: FROM keyword not found where expected."
The last name and the format of the salary limited to 15 digits to the left of the decimal and the column labeled SALARY.
The last name and salary for all employees with the format of the salary 15 characters long, left-padded with the $ and the column labeled SALARY. (*)
Evaluate this SELECT statement:
BalasHapusSELECT LENGTH(email)
FROM employee;
What will this SELECT statement display?
The number of characters for each value in the EMAIL column in the employees table (*)
The longest e-mail address in the EMPLOYEE table
The maximum number of characters allowed in the EMAIL column
The email address of each employee in the EMPLOYEE table
Which character manipulation function always returns a numerical value?
BalasHapusLPAD
SUBSTR
LENGTH (*)
TRIM
Character functions accept character arguments and only return character values. True or False?
BalasHapusTrue
False (*)
Which of the following SQL statements would correctly return a song title identified in the database as "All These Years"?
BalasHapusWHERE title LIKE LOWER('all these years');
WHERE title CONTAINS 'Years';
WHERE title LIKE INITCAP('%all these years'); (*)
WHERE title IN('All','These','Years');