Langsung ke konten utama

Section 4 Quiz Oracle Database Programming with SQL

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

Komentar

  1. terimakasih. Sangat membantu :)

    BalasHapus
  2. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  3. What function would you use to return the highest date in a month?
    LAST_DAY (*)
    HIGHEST_DAY
    END_DAY
    FINAL_DAY

    BalasHapus
  4. Which of the following SQL statements will correctly display the last name and the number of weeks employed for all employees in department 90?
    SELECT 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;

    BalasHapus
  5. What does the following SQL SELECT statement return?
    SELECT UPPER( SUBSTR('Database Programming', INSTR('Database Programming','P'),20))
    FROM dual;

    DATABASE
    Database
    Programming
    PROGRAMMING (*)

    BalasHapus
  6. Which SQL function can be used to remove heading or trailing characters (or both) from a character string?
    LPAD
    NVL2
    TRIM (*)
    CUT

    BalasHapus
  7. Evaluate this SELECT statement:
    SELECT 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.

    BalasHapus
  8. Which query would return a user password combining the ID of an employee and the first 4 digits of the last name?
    SELECT 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

    BalasHapus
  9. Which function would you use to return the current database server date and time?
    DATETIME
    DATE
    CURRENTDATE
    SYSDATE (*)

    BalasHapus
  10. Which three statements about functions are true? (Choose three.)
    (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. (*)

    BalasHapus
  11. 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?
    CONCAT
    TRUNC
    INSTR
    SUBSTR (*)

    BalasHapus
  12. Which query selects the first names of the DJ On Demand clients who have a first name beginning with "A"?
    SELECT 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%

    BalasHapus
  13. 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?
    SELECT 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;

    BalasHapus
  14. What will the following SQL statemtent display?
    SELECT 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. (*)

    BalasHapus
  15. Evaluate this SELECT statement:
    SELECT 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

    BalasHapus
  16. Which character manipulation function always returns a numerical value?
    LPAD
    SUBSTR
    LENGTH (*)
    TRIM

    BalasHapus
  17. Character functions accept character arguments and only return character values. True or False?
    True
    False (*)

    BalasHapus
  18. Which of the following SQL statements would correctly return a song title identified in the database as "All These Years"?

    WHERE title LIKE LOWER('all these years');
    WHERE title CONTAINS 'Years';
    WHERE title LIKE INITCAP('%all these years'); (*)
    WHERE title IN('All','These','Years');

    BalasHapus

Posting Komentar

Postingan populer dari blog ini

Section 6 Quiz Oracle Database Programming with SQL

Section 6 Quiz             (Answer all questions in this section)                                                             1.         Given the following descriptions of the employees and jobs tables, which of the following scripts will display each employee ï¾’ s possible minimum and maximum salaries based on their job title? EMPLOYEES Table: Name   Null?    Type EMPLOYEE_ID          NOT NULL     NUMBER (6) FIRST_NAME             VARCHAR2 (20) ...

Section 10 Quiz Database Programming With SQL

Section 10 Quiz             (Answer all questions in this section) 1.         A multiple-row operator expects how many values?   Mark for Review (1) Points             One or more (*)             Only one             Two or more             None 2.         The salary column of the f_staffs table contains the following values: 4000 5050 6000 11000 23000 Which of the following statements will return the last_name and first_name of those employees who earn more than 5000?  Mark for Review (1) Points             SELECT last_name, first_name ...

Section 6 Quiz Database Design Oracle

Section 6 Quiz             (Answer all questions in this section) 1.         Examine the following Entity and decide which rule of Normal Form is being violated: ENTITY: CLIENT ATTRIBUTES:     # CLIENT ID     FIRST NAME     LAST NAME     STREET     CITY     ZIP CODE  Mark for Review (1) Points             1st Normal Form.             2nd Normal Form.             3rd Normal Form.             None of the above, the entity is fully normalised. (*) 2.         A transitive dependency exists when any attribute in an entity...