Oracle Final Test Questions And Answers

40 Questions | Attempts: 3660

SettingsSettingsSettings
Oracle Final Test Questions And Answers - Quiz

Hey, check out this amazing 'Oracle Final Test' quiz. We've designed this quiz to test your knowledge about the Oracle subject. If you are planning to give the Oracle Certification Exam, then this quiz will prove to be very useful for you as it will help you prepare for the course. All you have to do is choose the correct option for each question asked in this test. So, are you ready to take the test? Let's start then.


Questions and Answers
  • 1. 
    Examine the structure of the STUDENT table: NAME NULL? TYPE STUDENT_ID NOT NULL NUMBER(3) NAME NOT NULL VARCHAR2(25) ADDRESS VARCHAR2(50) GRADUATION DATE Graduation column is a foreign key column to the graduate table. Examine the data in the GRADE DATE table: Graduation 20-jan-1999 12-may-1999 19-jan-2000 25-may-2000 13-jan-2001 29-may-2001 Which update statement produces the following error: ORA-02291 integrity constraint(sys_c23) violated parent key not found?
    • A. 

      A. UPDATE student SET stud-id=999, graduation= ’29-MAY-2001’ WHERE stud-id=101;’

    • B. 

      B. UPDATE student SET name= ‘Smith’, graduation= ’29-MAY-2001’ WHERE stud-id=101;

    • C. 

      C. UPDATE student SET name= ‘Smith’, graduation= ‘15-AUG-2000’ WHERE stud-id=101

    • D. 

      D. UPDATE student SET stud-id=NULL, address= ‘100 Main Street’ WHERE graduation= ‘20-JAN-1999’

  • 2. 
    You want to create a cursor that can be used several times in a block. Selecting a different active set each time that it is opened. Which type of cursor do you create?
    • A. 

      A. A cursor for loop.

    • B. 

      B. A multiple selection cursor.

    • C. 

      C. A cursor for each active set.

    • D. 

      D. A cursor that uses parameters.

  • 3. 
    You created a view called EMP_DEPT_VU that contains three columns from the EMPLOYEES  and DEPARTMENTS  tables EMPLOYEE_ID, EMPLOYEE_NAME  AND DEPARTMENT_NAME The DEPARTMENT_ID column of the EMPLOYEES table is the foreign key to the primary key DEPARTMENT_ID column of the DEPARTMENTS table. You want to modify the view by adding a fourth column, MANAGER_Id of NUMBER data type from the EMPLOYEES table.  How can you accomplish this task?
    • A. 

      A. ALTER VIEW emp_dept_vu (ADD manager_id NUMBER),

    • B. 

      B. MODIFY VIEW emp_dept_vu (ADD manager_id NUMBER);

    • C. 

      C. ALTER VIEW emp_dept_vu AS SELECT employee_id, employee_name Department_name, manager_id FROM employees e, departments d WHERE department_id = d.department_id;

    • D. 

      D. MODIFY VIEW emp_depat_vu AS SELECT employee_id, employee_name, Department_name, manager_id FROM employees e, departments d WHERE e.department_id = d.department_id;

    • E. 

      E. CREATE OR REPLACE VIEW emp_dept_vu AS SELECT emplouee_id, employee_ name, Department_name, manager _id FROM employees e, departments d WHERE e.department_id=d.department_id;

    • F. 

      F. You must remove the existing view first, and then run the CRATE VIEW command with a new column list to modify a view.

  • 4. 
     Which statement describes the ROWID data type?
    • A. 

      A. binary data up to 4 gigabytes

    • B. 

      B. character data up to 4 gigabytes

    • C. 

      C. raw binary data of variable length up to 2 gigabytes

    • D. 

      D. binary data stored in an external file, up to 4 gigabytes

    • E. 

      E. a hexadecimal string representing the unique address of a row in its table

  • 5. 
    The DBA issues this SQL command: CREATE USER scott  INDENTIFIED by tiger; What privileges does the user Scott have at this point?
    • A. 

      A. no privileges

    • B. 

      B. only the SELECT privilege

    • C. 

      C. only the CONNECT privilege

    • D. 

      D. all the privileges of a default user

  • 6. 
    Which substitution variable would you use if you want to reuse the variable value without prompting the user each time?
    • A. 

      A. &

    • B. 

      B. ACCEPT

    • C. 

      C. PROMPT

    • D. 

      D. &&

  • 7. 
     Which three are true regarding the use of outer joins? (Choose three.)
    • A. 

      A. You cannot use IN operator in a condition that involves an outerjoin

    • B. 

      B. You use (+) on both sides of the WHERE condition to perform an outerjoin

    • C. 

      C. You use (*) on both sides of the WHERE condition to perform an outerjoin.

    • D. 

      D. You use an outerjoin to see only the rows that do not meet the join condition

    • E. 

      E. In the WHERE condition, you use (+) following the name of the column in the table without matching rows, to perform an outerjoin

    • F. 

      F. You cannot link a condition that is involved in an outerjoin to another condition by using the OR operator

  • 8. 
     Which statement creates a new user?
    • A. 

      A. CREATE USER susan

    • B. 

      B. CREATE OR REPLACE USER susan

    • C. 

      C. CREATE NEW USER susan DEFAULT,

    • D. 

      D. CREATE USER susan INDENTIFIED BY blue

    • E. 

      E. CREATE NEW USER susan IDENTIFIED BY blue

    • F. 

      F. CREATE OR REPLACE USER susan IDENTIFIED BY blue;

  • 9. 
    The EMPLOYEES table contains these columns:EMPLOYEE_ID NUMBER(4)LAST_NAME VARCHAR2 (25)JOB_ID VARCHAR2(10) You want to search for strings that contain 'SA_' in the JOB_ID column. Which SQLstatement do you use?
    • A. 

      A. SELECT employee_id, last_name, job_id FROM employees WHERE job_id LIKE'%SA\_%' ESCAPE '\';

    • B. 

      B. SELECT employee_id, last_name, job_id FROM employees WHERE job_id LIKE'%SA_';

    • C. 

      C. SELECT employee_id, last_name, job_id FROM employees WHERE job_id LIKE '%SA_'ESCAPE "\";

    • D. 

      D. SELECT employee_id, last_name, job_id FROM employees WHERE job_id = '%SA_'

  • 10. 
    EMPLOYEES and DEPARTMENTS data: EMPLOYEES EMPLOYEE_ID EMP_NAME DEPT_ID MGR_ID JOB_ID SALARY 101 Smith 20 120 SA_REP 4000 102 Martin 10 105 CLERK 2500 103 Chris 20 120 IT_ADMIN 4200 104 John 30 108 HR_CLERK 2500 105 Diana 30 108 IT_ADMIN 5000 106 Smith 40 110 AD_ASST 3000 108 Jennifer 30 110 HR_DIR 6500 110 Bob 40 EX_DIR 8000 120 Ravi 20 110 SA_DIR 6500 DEPARTMENTS DEPARTMENT_ID DEPARTMENT_NAME 10 Admin 20 Education 30 IT On the EMPLOYEES table, EMPLOYEE_ID is the primary key. MGR_ID is the ID managers and refers to the EMPLOYEE_ID. On the DEPARTMENTS table DEPARTMENT_ID is the primary key. Evaluate this UPDATE statement. UPDATE employees SET mgr_id = (SELECT mgr_id FROM employees WHERE dept_id= (SELECT department_id FROM departments WHERE department_name = 'Administration')), Salary = (SELECT salary FROM employees WHERE emp_name = 'Smith') WHERE job_id = 'IT_ADMIN'; What happens when the statement is executed?
    • A. 

      A. The statement executes successfully, leaves the manager ID as the existing value, and changes the salary to 4000 for the employees with ID 103 and 105.

    • B. 

      B. The statement executes successfully, changes the manager ID to NULL, and changes the salary to 4000 for the employees with ID 103 and 105.

    • C. 

      C. The statement executes successfully, changes the manager ID to NULL, and changes the salary to 3000 for the employees with ID 103 and 105.

    • D. 

      D. The statement fails because there is more than one row matching the employee name Smith.

    • E. 

      E. The statement fails because there is more than one row matching the IT_ADMIN job ID in the EMPLOYEES table.

    • F. 

      F. The statement fails because there is no 'Administration' department in the DEPARTMENTS table.

  • 11. 
    What is true about the WITH GRANT OPTION clause?
    • A. 

      A. It allows a grantee DBA privileges.

    • B. 

      B. It is required syntax for object privileges.

    • C. 

      C. It allows privileges on specified columns of tables.

    • D. 

      D. It is used to grant an object privilege on a foreign key column.

    • E. 

      E. It allows the grantee to grant object privileges to other users and roles.

  • 12. 
    Which constraint can be defines only at the column level?
    • A. 

      A. UNIQUE

    • B. 

      B. NOT NULL

    • C. 

      C. CHECK

    • D. 

      D. PRIMARY KEY

    • E. 

      E. FOREIGN KEY

  • 13. 
    Which SELECT statement should you use to extract the year from the system date and display it in the format "1998"?
    • A. 

      A. SELECT TO_CHAR(SYSDATE,'yyyy') FROM dual;

    • B. 

      B. SELECT TO_DATE(SYSDATE,'yyyy') FROM dual;

    • C. 

      C. SELECT DECODE(SUBSTR(SYSDATE, 8), 'YYYY') FROM dual;

    • D. 

      D. SELECT DECODE(SUBSTR(SYSDATE, 8), 'year') FROM dual;

    • E. 

      E. SELECT TO_CHAR(SUBSTR(SYSDATE, 8,2),'yyyy') FROM dual;

  • 14. 
    Scott issues the SQL statements: CREATE TABLE dept (deptno NUMBER(2), dname VARCHAR2(14), loc VARCHAR2(13)}; GRANT SELECT ON DEPT TO SUE; If Sue needs to select from Scott's DEPT table, which command should she use?
    • A. 

      A. SELECT * FROM DEPT;

    • B. 

      B. SELECT * FROM SCOTT.DEPT;

    • C. 

      C. SELECT * FROM DBA.SCOTT.DEPT;

    • D. 

      D. SELECT * FROM ALL_USERS WHERE USER_NAME = 'SCOTT' AND TABLE NAME = 'DEPT';

  • 15. 
    .What is true about joining tables through an equijoin?
    • A. 

      A. You can join a maximum of two tables through an equijoin.

    • B. 

      B. You can join a maximum of two columns through an equijoin.

    • C. 

      C. You specify an equijoin condition in the SELECT or FROM clauses of a SELECT statement.

    • D. 

      D. To join two tables through an equijoin, the columns in the join condition must be primary key and foreign key columns.

    • E. 

      E. You can join n tables (all having single column primary keys) in a SQL statement by specifying a minimum of n-1 join conditions.

  • 16. 
    Mark for review The PRODUCTS table has these columns: PRODUCT_ID NUMBER(4) PRODUCT_NAME VARCHAR2(45) PRICE NUMBER(8,2) Evaluate this SQL statement: SELECT * FROM PRODUCTS ORDER BY price, product_name; What is true about the SQL statement?
    • A. 

      A. The results are not sorted.

    • B. 

      B. The results are sorted numerically

    • C. 

      C. The results are sorted alphabetically

    • D. 

      . D. The results are sorted numerically and then alphabetically.

  • 17. 
    What is true about updates through a view?
    • A. 

      A. You cannot update a view with group functions.

    • B. 

      B. When you update a view group functions are automatically computed.

    • C. 

      C. When you update a view only the constraints on the underlying table will be in effect

    • D. 

      D. When you update a view the constraints on the views always override the constraints on the underlying tables

  • 18. 
    Which of the following correctly shows the correct use of the TRUNC command on a date?
    • A. 

      A. SELECT TRUNC(TO_DATE(12-Feb-99,DD-MON-YY, 'YEAR')) "Date " FROM DUAL;

    • B. 

      B. TRUNC = TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR', "Date " FROM DUAL;

    • C. 

      C. SELECT TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL;

    • D. 

      D. date = TRUNC(TO_DATE('12-Feb-99','DD-MON-YY'), 'YEAR') "Date " FROM DUAL

  • 19. 
    Examine the data in the EMPLOYEES and DEPARTMENTS tables. You want to retrieve all employees' last names, along with their manager's last names and their department names. Which query would you use?
    • A. 

      A. SELECT last_name, manager_id, department_name FROM employees e FULL OUTER JOIN departments d ON (e.department_id = d.department_id);

    • B. 

      B. SELECT e.last_name, m.last_name, department_name FROM employees e LEFT OUTER JOIN employees m on ( e.managaer_id = m.employee_id) LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);

    • C. 

      C. SELECT e.last_name, m.last_name, department_name FROM employees e RIGT OUTER JOIN employees m on ( e.manager_id = m.employee_id) LEFT OUTER JOIN departments d ON (e.department_id = d.department_id);

    • D. 

      D. SELECT e.last_name, m.last_name, department_name FROM employees e LEFT OUTER JOIN employees m on ( e.manager_id = m.employee_id) RIGT OUTER JOIN departments d ON (e.department_id = d.department_id);

    • E. 

      E. SELECT e.last_name, m.last_name, department_name FROM employees e RIGHT OUTER JOIN employees m on ( e.manager_id = m.employee_id) RIGHT OUTER JOIN departments d ON (e.department_id = d.department_id)

    • F. 

      F. SELECT last_name, manager_id, department_name FROM employees e JOIN departments d ON (e.department_id = d.department_id) ;

  • 20. 
    Which statement correctly describes SQL and /SQL*Plus?
    • A. 

      A. Both SQL and /SQL*plus allow manipulation of values in the database.

    • B. 

      B. /SQL*Plus recognizes SQL statements and sends them to the server; SQL is the Oracle proprietary interface for executing SQL statements.

    • C. 

      C. /SQL*Plus is a language for communicating with the Oracle server to access data; SQL recognizes SQL statements and sends them to the server.

    • D. 

      D. SQL manipulates data and table definitions in the database; /SQL*Plus does not allow manipulation of values in the database.

  • 21. 
    You need to perform these tasks: 1. Create and assign a MANAGER role to Blake and Clark 2. Grant CREATE TABLE and CREATE VIEW privileges to Blake and Clark Which set of SQL statements achieves the desired results?
    • A. 

      A. CREATE ROLE manager; GRANT create table, create view TO manager; GRANT manager TO BLAKE,CLARK; ;

    • B. 

      B. CREATE ROLE manager; GRANT create table, create voew TO manager; GRANT manager ROLE TO BLAKE,CLARK;

    • C. 

      C. GRANT manager ROLE TO BLAKE,CLARK; GRANT create table, create voew TO BLAKE CLARK;

  • 22. 
    Which SQL statement displays the date March 19, 2001 in a format that appears as "Nineteenth of March 2001 12:00:00 AM"?
    • A. 

      A. SELECT TO_CHAR(TO_DATE("19-Mar-2001', 'DD-Mon-YYYY'), 'fmDdspth "of" Month YYYY fmHH:MI:SS AM') NEW_DATE FROM dual;

    • B. 

      B. SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'Ddspth "of" Month YYYY fmHH:MI:SS AM') NEW_DATE FROM dual;

    • C. 

      C. SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY'), 'fmDdspth "of" Month YYYY HH:MI:SS AM') NEW_DATE

    • D. 

      D. SELECT TO_CHAR(TO_DATE('19-Mar-2001', 'DD-Mon-YYYY), 'fmDdspth "of" Month YYYY

  • 23. 
    Which object privileges can be granted on a view?
    • A. 

      A. none

    • B. 

      B. DELETE, INSERT,SELECT

    • C. 

      C. ALTER, DELETE, INSERT, SELECT

    • D. 

      D. DELETE, INSERT, SELECT, UPDATE

  • 24. 
    Examine the structure of the EMPLOYEES table: EMPLOYEE_ID NUMBER NOT NULL, Primary Key EMP_NAME VARCHAR2(30) JOB_ID NUMBER\ SAL NUMBER MGR_ID NUMBER References EMPLOYEE_ID column DEPARTMENT_ID NUMBER Foreign key to DEPARTMENT_ID column of the DEPARTMENTS table You created a sequence called EMP_ID_SEQ in order to populate sequential values for the EMPLOYEE_ID column of the EMPLOYEES table. Which two statements regarding the EMP_ID_SEQ sequence are true? (Choose two.)
    • A. 

      A. You cannot use the EMP_ID_SEQ sequence to populate the JOB_ID column.

    • B. 

      B. The EMP_ID_SEQ sequence is invalidated when you modify the EMPLOYEE_ID column.

    • C. 

      C. The EMP_ID_SEQ sequence is not affected by modifications to the EMPLOYEES table.

    • D. 

      D. Any other column of NUMBER data type in your schema can use the EMP_ID_SEQ sequence.

    • E. 

      E. The EMP_ID_SEQ sequence is dropped automatically when you drop the EMPLOYEES table.

    • F. 

      F. The EMP_ID_SEQ sequence is dropped automatically when you drop the EMPLOYEE_ID column.

  • 25. 
    Refer to the SQL codes below: SELECT manager_id, last_name, hire_date, salary, AVG(salary) OVER (PARTITION BY manager_id ORDER BY hire_date ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) AS c_mavg FROM employees; What has been achieved?
    • A. 

      A. because of a syntax problem, no row will be returned

    • B. 

      B. it calculates, for each employee in the employees table, the average salary of the employees reporting to his/her respective manager

    • C. 

      C. it calculates, for each employee in the employees table, the average salary of the employees reporting to his/her respective manager who were hired just before the employee

    • D. 

      D. it calculates, for each employee in the employees table, the average salary of the employees reporting to the same manager who were hired in the range just before through just after the employee

    • E. 

      E. it calculates, for each employee in the employees table, the average salary of the employees reporting to his/her respective manager who were hired just after the employee

Back to Top Back to top
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.