Sie sind auf Seite 1von 151

Oracle 1z0-001

Introduction to Oracle: SQL and PL/SQL

Version 1.0
QUESTION NO: 1

The PLAYER table contains these columns:

ID NUMBER(9)

NAME VARCHAR(2)

MANAGER_ID NUMBER(9)

In this instance, managers are players and you need to display a list of players.

Evaluate these two SQL statements:

SELECT p.name, m.name

FROMplayer p, player m

WHEREm.id = p.manager_id;

SELECT p.name, m.name

FROMplayer p, player m

WHEREm.manager_id = p.id;

How will the results differ?

A. Statement 1 will not execute; statement 2 will.

B. The results will be the same, but the display will be different.

C. Statement 1 will execute; statement 2 will not.


D. Statement 1 is self-join; statement 2 is not.

Answer: B

QUESTION NO: 2

Under which situation is it necessary to use an explicit cursor?

A. when a SELECT statement in a PL/SQL block retrieves more than one row

B. when an UPDATE statement in a PL/SQL block has to modify more than one row

C. when a DELETE statement in a PL/SQL block deletes more than one row

D. when any DML or SELECT statement is used in a PL/SQL block

Answer: A

QUESTION NO: 3

Which statement is true when a DROP TABLE command is executed on a table?

A. Any pending transactions on the table are rolled back.

B. The table structure and its deleted data cannot be rolled back and restored once the DROP TABLE
command is executed.

C. The DROP TABLE command can be executed on a table on which there are pending transactions.

D. The structure of the table remains in the database, and the data and indexes are deleted.

E. Only a DBA can execute the DROP TABLE command.


Answer: B

QUESTION NO: 4

Which statement about implicit cursors is true?

A. Programmers need to close all the implicit cursors before the end of the PL/SQL program.

B. Programmers can declare implicit cursors by using the CURSOR type in the declaration section.

C. Implicit cursors are declared implicitly only for DML statements.

D. Implicit cursors are declared implicitly for all the DML and SELECT statements.

Answer: D

QUESTION NO: 5

How would you add a foreign key constraint on the dept_no column in the EMP table, referring to the id
column in the DEPT table?

A. Use the ALTER TABLE command with the ADD clause on the EMP table.

B. Use the ALTER TABLE command with the MODIFY clause on the EMP table.

C. Use the ALTER TABLE command with the ADD clause on the DEPT table.

D. This task cannot be accomplished.

E. Use the ALTER TABLE command with the MODIFY clause on the DEPT table.

Answer: A
QUESTION NO: 6

Evaluate this SQL script:

CREATE ROLE manager;

CREATE ROLE clerk;

CREATE ROLE inventory;

CREATE USER scott IDENTIFIED BY tiger;

GRANT inventory TO clerk;

GRANT clerk TO manager;

GRANT inventory TO scott

How many roles will user SCOTT have access to?

A. 1

B. 2

C. 0

D. 3

Answer: A

QUESTION NO: 7

You want to display the details of all employees whose last name is Smith, but you are not sure in which
case the last names are stored. Which statement will list all the employees whose last name is Smith?
A. SELECT lastname, firstname

FROM emp

WHERE LOWER(lastname) = 'smith';

B. SELECT lastname, firstname

FROM emp

WHERE UPPER(lastname) = 'smith';

C. SELECT lastname, firstname

FROM emp

WHERE lastname = 'smith';

D. SELECT lastname, firstname

FROM emp

WHERE lastname = UPPER('smith');

Answer: A

QUESTION NO: 8

You are updating the employee table. Jane has been granted the same privileges as you on the
employee table. You ask Jane to log on to the database to check your work before you issue a COMMIT
command. What can Jane do to the employee table?

A. Jane can access the table, but she cannot see your changes and cannot make the same changes.

B. Jane can access the table and verify your changes.

C. Jane cannot access the table.

D. Jane can access the table, but she cannot see your changes. She can make the changes for you.
Answer: A

QUESTION NO: 9

Click on the EXHIBIT button and examine the table instance chart for the sales table.

You attempt to change the database with this command:

INSERT INTO sales (purchase_no, customer_id, car_id)

VALUES (1234, 345, 6);

If this statement fails, which condition would explain the failure?

A. The sales table has too many foreign keys.

B. The statement has invalid datatypes.

C. A mandatory column value is missing.

D. This statement does not fail at all.

Answer: C
QUESTION NO: 10

Which statement about SQL is true?

A. Date values are displayed in descending order by default.

B. Null values are displayed last in ascending sequences.

C. The results are sorted by the first column in the SELECT list if the ORDER BY clause is not provided.

D. You cannot specify a column alias in an ORDER BY clause.

E. You cannot sort query results by a column that is not included the SELECT list.

Answer: B

QUESTION NO: 11

Evaluate this SQL statement:

SELECTe.id, (.15 * e.salary) + (.25 * e.bonus) + (s.sale_amount * (.15 * e.commission_pct))

FROMemployee e, sale s

WHEREe.id = s.emp_id;

What would happen if you removed all the parentheses from the calculation?

A. The results will be lower.

B. The statement will achieve the same results.

C. The statement will not execute.


D. The results will be higher.

Answer: B

QUESTION NO: 12

Within a PL/SQL loop, you need to test if the current fetch was successful. Which SQL cursor attribute
would you use to accomplish this task?

A. A SQL cursor attribute cannot be used within a PL/SQL loop.

B. This task cannot be accomplished with a SQL cursor attribute.

C. SQL%ROWCOUNT

D. SQL%ISOPEN

E. SQL%FOUND

Answer: E

QUESTION NO: 13

In the declarative section of a PL/SQL block, you created but did not initialize a number variable. When
the block executes, what will be the initial value of the variable?

A. The block will not execute because the variable was not initialized.The block will not execute because
the variable was not initialized.

B. 0

C. null

D. It depends on the scale and precision of the variable.


Answer: C

QUESTION NO: 14

Examine the code:

DECLARE

CURSOR emp_cursor IS

SELECT ename, deptno

FROM emp;

emp_rec emp_cursor%ROWTYPE;

BEGIN

OPEN emp_cursor;

LOOP

FETCH emp_cursor

INTO emp_rec;

EXIT WHEN emp_cursor%NOTFOUND;

INSERT INTO temp_emp(name, dno)

VALUES (emp_rec.ename, emp_rec.deptno);

END LOOP;

CLOSE emp_cursor;

END;

Using a cursor FOR loop, which PL/SQL block is equivalent to the above code?
A. DECLARE

CURSOR emp_cursor IS

SELECT ename, deptno

FROM emp;

BEGIN

FOR emp_rec IN emp_cursor LOOP

INSERT INTO temp_emp(name, dno)

VALUES (emp_rec.ename, emp_rec.deptno);

END LOOP;

CLOSE emp_cursor;

END;

B. DECLARE

CURSOR emp_cursor IS

SELECT ename, deptno

FROM emp;

BEGIN

FOR emp_rec IN emp_cursor LOOP

INSERT INTO temp_emp(name, dno)

VALUES (emp_rec.ename, emp_rec.deptno);

END LOOP;

END;

C. DECLARE

CURSOR emp_cursor IS

SELECT ename, deptno


FROM emp;

emp_rec emp_cursor%ROWTYPE;

BEGIN

FETCH emp_cursor

INTO emp_rec;

FOR emp_rec IN emp_cursor LOOP

INSERT INTO temp_emp(name, dno)

VALUES (emp_rec.ename, emp_rec.deptno);

END LOOP;

END;

D. DECLARE

CURSOR emp_cursor IS

SELECT ename, deptno

FROM emp;

BEGIN

FOR emp_rec IN emp_cursor LOOP

OPEN emp_cursor;

INSERT INTO temp_emp(name, dno)

VALUES (emp_rec.ename, emp_rec.deptno);

END LOOP;

END;

Answer: B
QUESTION NO: 15

You want to retrieve the employee details from the EMP table and process them in PL/SQL block. Which
type of variable do you create in the PL/SQL block to retrieve all the rows and columns using a single
SELECT statement from the EMP table?

A. PL/SQL table of scalars

B. PL/SQL table of records

C. %ROWTYPE variable

D. PL/SQL record

Answer: B

QUESTION NO: 16

Given this executable section of a PL/SQL block:

BEGIN

FOR employee_record IN salary_cursor LOOP

employee_id_table(employee_id) :=

employee_record.last_name;

END LOOP;

CLOSE salary_cursor;

END;

Why does this section cause an error?


A. The cursor does not need to be closed.

B. No FETCH statements were issued.

C. Terminating conditions are missing.

D. The cursor needs to be opened.

Answer: A

QUESTION NO: 17

Evaluate this PL/SQL block:

DECLARE

v_result NUMBER(2);

BEGIN

DELETE

FROM employee

WHERE dept_id IN (10, 20, 30);

v_result := SQL%ROWCOUNT;

COMMIT;

END;

What will be the value of V_RESULT if no rows are deleted?

A. 1

B. NULL
C. 0

D. FALSE

E. TRUE

Answer: C

QUESTION NO: 18

Which SELECT statement displays all the employees who do not have any subordinates?

A. SELECT e.ename

FROM emp e

WHERE e.empno NOT IN (SELECT m.mgr

FROM emp m

WHERE m.mgr IS NOT NULL);

B. SELECT e.ename

FROM emp e

WHERE e.empno IN (SELECT m.mgr

FROM emp m);

C. SELECT e.ename

FROM emp e

WHERE e.mgr IS NOT NULL;

D. SELECT e.ename

FROM emp e

WHERE e.empno NOT IN (SELECT m.mgr


FROM emp m);

Answer: A

QUESTION NO: 19

As a DBA, you have just created a user account for employee Smith by using the CREATE USER
command. Smith should be able to create tables and packages in his schema. Which command will the
DBA need to execute next so that Smith can perform his tasks successfully?

A. GRANT CREATE CONNECT, CREATE TABLE, CREATE PROCEDURE

TO smith;

B. GRANT CREATE TABLE, CREATE PACKAGE

TO smith;

C. GRANT CREATE TABLE, CREATE PROCEDURE

TO smith;

D. GRANT CREATE SESSION, CREATE TABLE, CREATE PROCEDURE

TO smith;

Answer: D

QUESTION NO: 20

Evaluate this IF statement:

IF v_value > 100 THEN

v_new_value := 2 * v_value;
ELSIF v_value > 200 THEN

v_new_value := 3 * v_value;

ELSIF v_value < 300 THEN

v_new_value := 4 * v_value;

ELSE

v_new_value := 5 * v_value;

END IF;

What would be assigned to V_NEW_VALUE if V_VALUE is 250?

A. 250

B. 1250

C. 750

D. 500

E. 1000

Answer: D

QUESTION NO: 21

Click on the EXHIBIT button and examine the table instance chart for the patient table.

You created the patient_vu view based on id_number and last_name from the patient table. What is
the best way to modify the view to contain only those patients born in 1997?
A. Drop the patient_vu, then create a new view with a WHERE clause.

B. Replace the view adding a WHERE clause.

C. Drop the patient_vu, then create a new view with a HAVING clause.

D. Use the ALTER command to add a WHERE clause to verify the time.

Answer: B

QUESTION NO: 22

Mr. King is the president of a company. Five managers report to him. All other employees report to
these managers.

Examine the code:

SELECT employee.ename

FROM emp employee

WHERE employee.empno NOT IN

(SELECT manager.mgr

FROM emp manager);

The above statement returns


no rows selected.

as the result. Why?

A. None of the employees has a manager.

B. A NULL value is returned from the subquery.

C. All employees have a manager.

D. NOT IN operator is not allowed in subqueries.

Answer: B

QUESTION NO: 23

Examine the structure of the STUDENT table:

Name Null? Type

----------------- ----------- ------------

STUD_ID NOT NULL NUMBER(3)

NAME NOT NULL VARCHAR2(25)

ADDRESS VARCHAR2(50)

GRADUATION DATE

Which statement inserts a new row into the STUDENT table?

A. INSERT INTO student (stud_id, address, graduation)

VALUES (101,'100 Main Street','17-JUN-99');


B. INSERT INTO student (stud_id, address, name, graduation)

VALUES (101,'100 Main Street','Smith','17-JUN-99');

C. INSERT INTO student

VALUES (101,'100 Main Street','17-JUN-99','Smith');

D. INSERT INTO student

VALUES (101,'Smith');

E. INSERT INTO student table

VALUES (101,'Smith','100 Main Street','17-JUN-99');

Answer: B

QUESTION NO: 24

Which operator is NOT appropriate in the join condition of a non-equi join SELECT statement?

A. LIKE operator

B. IN operator

C. equal operator

D. greater than or equal to operator

E. BETWEEN x AND y operator

Answer: C

QUESTION NO: 25
You have been granted UPDATE privileges on the last_name column of the employee table. Which data
dictionary view would you query to display the column the privilege was granted on and the schema
that owns the employee table?

A. ALL_TABLES

B. This information cannot be retrieved from a single data dictionary view.

C. ALL_SOURCE

D. TABLE_PRIVILEGES

E. ALL_COL_PRIVS_RECD

F. ALL_OBJECTS

Answer: E

QUESTION NO: 26

Examine the table structures:

EMP Table

Name Null? Type

------------------------------- ------------- -----------

EMPNO NOT NULL NUMBER(4)

NAME VARCHAR2(10)

JOB VARCHAR2(9)

MGR NUMBER(4)

HIREDATE DATE

SALARY NUMBER(7,2)
COMM NUMBER(7,2)

DEPTNO NOT NULL NUMBER(2)

TAX Table

Name Null? Type

------------------------------- -------- -----------

TAXGRADE NUMBER

LOWSAL NUMBER

HIGHSAL NUMBER

You want to create a report that displays the employee details along with the tax category of each
employee. The tax category is determined by comparing the salary of the employee from the EMP table
to the lower and upper salary values in the TAX table.

Which SELECT statement produces the required results?

A. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary IN t.lowsal AND t.highsal;

B. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary BETWEEN t.lowsal AND t.highsal;

C. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary >= t.lowsal AND <= t.highsal;

D. SELECT e.name, e.salary, t.taxgrade


FROM emp e, tax t

WHERE e.salary <= t.lowsal AND e.salary >= t.highsal;

Answer: B

QUESTION NO: 27

How do you declare a PL/SQL table of records to hold the rows selected from the EMP table?

A. DECLARE

emp_table IS TABLE OF emp%ROWTYPE;

B. DECLARE

TYPE emp_table_type IS TABLE OF emp%ROWTYPE

INDEX BY BINARY_INTEGER;

emp_table emp_table_type;

C. BEGIN

TYPE emp_table_type IS TABLE OF emp%ROWTYPE;

emp_table emp_table_type;

D. DECLARE

TYPE emp_table_type IS TABLE OF emp%ROWTYPE

INDEX BY WHOLE_NUMBER;

emp_table emp_table_type;

Answer: B
QUESTION NO: 28

Examine the structure of the STUDENT table:

Name Null? Type

------------------ -------------- ------------

STUD_ID NOT NULL NUMBER(3)

NAME NOT NULL VARCHAR2(25)

ADDRESS VARCHAR2(50)

GRADUATION DATE

Graduation column is a foreign key column to the GRADDATE table.

Examine the data in the GRADDATE 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. UPDATE student

SET name = 'Smith',

graduation = '15-AUG-2000'

WHERE stud_id = 101;

B. UPDATE studentD.UPDATE student

SET stud_id = NULL,

address = '100 Main Street'

WHERE graduation = '20-JAN-1999';

C. UPDATE student

SET name = 'Smith',

graduation = '29-MAY-2001'

WHERE stud_id = 101;

D. UPDATE student

SET stud_id = 999,

graduation = '29-MAY-2001'

WHERE stud_id = 101;

Answer: A

QUESTION NO: 29

The EMPLOYEE table contains these columns:

FIRST_NAMEVARCHAR2(25)
COMMISSION NUMBER(3,2)

Evaluate this SQL statement:

SELECT first_name, commission

FROM employee

WHERE commission =

(SELECTcommission

FROMemployee

WHEREUPPER(first_name) = 'SCOTT')

What would cause this statement to fail?

A. Scott has a NULL commission value.

B. There is no employee with the first name Scott.

C. The FIRST_NAME values in the database are in lowercase.

D. Scott has a zero commission value.

E. There is more than one employee with the first name Scott.

Answer: E

QUESTION NO: 30

The EMPLOYEE table contains these columns:

LAST_NAME VARCHAR2(25)

FIRST_NAME VARCHAR2(25)
SALARY NUMBER(7,2)

You need to display the names of employees that earn more than the average salary of all employees.

Evaluate this SQL statement:

SELECT last_name, first_name

FROMemployee

WHEREsalary > AVG(salary);

Which change should you make to achieve the desired results?

A. Move the function to the SELECT clause and add a GROUP BY clause and a HAVING clause.

B. Change the function in the WHERE clause.

C. Move the function to the SELECT clause and add a GROUP BY clause.

D. Use a subquery in the WHERE clause to compare the average salary value.

Answer: D

QUESTION NO: 31

In which section of a PL/SQL block is a user-defined exception raised?

A. exception handling

B. executable

C. heading
D. declarative

Answer: B

QUESTION NO: 32

You are a user of the PROD database which contains over 1000 tables, and you need to determine the
number of tables you can access. Which data dictionary view could you query to display this
information?

A. DBA_TABLES

B. ALL_OBJECTS

C. USER_OBJECTS

D. DBA_SEGMENTS

Answer: B

QUESTION NO: 33

Using SQL*Plus, you created a user with this command:

CREATE USER jennifer IDENTIFIED BY jbw122;

What should you do to allow the user database access?

A. Grant the user the CREATE SESSION privilege.


B. Use the ALTER USER to assign the user a default profile.

C. Use the ALTER USER command to assign the user a default tablespace.

D. No action is required to give the user database access.

Answer: A

QUESTION NO: 34

The EMPLOYEE table contains these columns:

FIRST_NAME VARCHAR2(25)

LAST_NAME VARCHAR2(25)

Evaluate these two SQL statements:

1. SELECT CONCAT(first_name, last_name),

LENGTH(CONCAT(first_name, last_name))

FROM employee

WHERE UPPER(last_name) LIKE '%J'

ORUPPER(last_name) LIKE '%K'

ORUPPER(last_name) LIKE '%L';

2. SELECT INITCAP(first_name) || INITCAP(last_name),

LENGTH(last_name) + LENGTH(first_name)

FROM employee
WHERE INITCAP(SUBSTR(last_name, 1, 1)) IN ('J', 'K', 'L');

How will the results differ?

A. The statements will retrieve different data from the database.

B. Statement 1 will execute, but statement 2 will not.

C. Statement 2 will execute, but statement 1 will not.

D. The statements will retrieve the same data from the database, but will display it differently.

Answer: A

QUESTION NO: 35

Which statement is true when writing a cursor FOR loop?

A. You do not explicitly open, fetch or close the cursor within a cursor FOR loop .

B. You must explicitly close the cursor prior to the end of the program.

C. You must explicitly fetch the rows within a cursor FOR loop.

D. You must explicitly declare the record variable that holds the row returned from the cursor.

E. You must explicitly open the cursor prior to the cursor FOR loop.

Answer: A

QUESTION NO: 36
You query the database with this command:

SELECT last_name, first_name

FROM employee

WHERE salary IN

(SELECT salary

FROM employee

WHERE dept_no = 3 OR dept_no = 5);

Which values are displayed?

A. last name and first name of only the employees in department number 3 or 5

B. last name and first name of only the employees whose salary falls in the range of salaries from
department 3 or 5

C. last name and first name of all employees except those working in department 3 or 5

D. last name and first name of all employees with the same salary as employees in department 3 or 5

Answer: D

QUESTION NO: 37

You issue this command:

CREATE PUBLIC SYNONYM emp

FOR ed.employee;
Which task has been accomplished?

A. The need to qualify the object name with its schema was eliminated for only you.

B. The need to qualify the object name with its schema has been eliminated for all users.

C. The object can now be accessed by all users.

D. All users were given object privileges to the table.

Answer: B

QUESTION NO: 38

The PRODUCT table contains these columns:

ID NUMBER(9) PK

COST NUMBER(7,2)

SALE_PRICE NUMBER(7,2)

Management has asked you to calculate the net revenue per unit for each product if the cost of each
product is increased by 10% and the sale price of each product is increased by 25%.

You issue this SQL statement:

SELECT id, sale_price * 1.25 - cost * 1.10

FROMproduct;

Which conclusion can you draw from the results?


A. The order of the operations in the calculation needs to be changed to achieve the required results.

B. Only the required results are displayed.

C. The results provide more information than management requested.

D. A function needs to be included in the SELECT statement to achieve the desired results.

Answer: B

QUESTION NO: 39

Which operator is NOT appropriate in the join condition of a non-equi join SELECT statement?

A. equal operator

B. LIKE operator

C. IN operator

D. greater than or equal to operator

E. BETWEEN x AND y operator

Answer: A

QUESTION NO: 40

Which statement about multiple column subqueries is true?

A. In a pairwise subquery, the values returned from the subquery are compared individually to the
values in the outer query.

B. A non-pairwise comparison produces a cross product.


C. In a non-pairwise subquery, the values returned from the subquery are compared as a group to the
values in the outer query.

D. A pairwise comparison produces a cross product.

Answer: B

QUESTION NO: 41

Examine the structure of the STUDENT table:

Name Null? Type

---------------- ----------- ------------

STUD_ID NOT NULL NUMBER(3)

NAME NOT NULL VARCHAR2(25)

PHONE NOT NULL VARCHAR2(9)

ADDRESS VARCHAR2(50)

GRADUATION DATE

There are 100 records in the STUDENT table. You need to modify the PHONE column to hold only
numeric values.

Which statement will modify the datatype of the PHONE column?

A. ALTER TABLE student

MODIFY COLUMN phone NUMBER(9);

B. ALTER TABLE student


MODIFY phone NUMBER(9);

C. You cannot modify the datatype of a column if there is data in the column.

D. You cannot modify a VARCHAR2 datatype to a NUMBER datatype for a column.

Answer: C

QUESTION NO: 42

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

A. a cursor for each active set

B. a cursor FOR loop

C. a cursor that uses parameters

D. a multiple selection cursor

Answer: C

QUESTION NO: 43

The EMP table contains columns to hold the birth date and hire date of employees. Both of these
columns are defined with DATE as their datatype. You want to insert a row with the details of employee
Smith who was born in 1944 and hired in 2004. Which statement will ensure that values are inserted
into the table in the correct century?

A. INSERT INTO EMP(empno, ename, birthdate, hiredate)

VALUES (EMPNO_SEQ.NEXTVAL,'SMITH',
TO_DATE('12-DEC-44','DD-MON-YY'),

TO_DATE('10-JUN-04','DD-MON-YY'));

B. INSERT INTO EMP(empno, ename, birthdate, hiredate)

VALUES (EMPNO_SEQ.NEXTVAL,'SMITH',

TO_DATE('12-DEC-1944','DD-MON-YYYY'),

TO_DATE('10-JUN-04','DD-MON-RR'));

C. INSERT INTO EMP(empno, ename, birthdate, hiredate)

VALUES (EMPNO_SEQ.NEXTVAL,'SMITH',

TO_DATE('12-DEC-44','DD-MON-RR'),

TO_DATE('10-JUN-04','DD-MON-RR'));

D. INSERT INTO EMP(empno, ename, birthdate, hiredate)

VALUES (EMPNO_SEQ.NEXTVAL,'SMITH', '12-DEC-44',

'10-JUN-04');

Answer: B

QUESTION NO: 44

Click on the EXHIBIT button and examine the table instance chart for the employee table.

You need to display the hire_date values in this format:

10 of October 1999.

Which SELECT statement can you use?


A. SELECT hire_date ('fmDD "of" MONTH YYYY') "Date Hired"

FROM employee;

B. SELECT TO_CHAR(hire_date, 'DDspth of MONTH YYYY') "DATE HIRED"

FROM employee;

C. SELECT hire_date ('DD "of" MONTH YYYY') "Date Hired"

FROM employee;

D. SELECT TO_CHAR(hire_date, 'fmDD "of" Month YYYY') DATEHIRED

FROM employee;

Answer: D

QUESTION NO: 45

You have decided to permanently remove all the data from the STUDENT table, and you need the table
structure in the future. Which single command performs this?

A. DELETE *

FROM student

KEEP STRUCTURE;
B. TRUNCATE TABLE student

KEEP STRUCTURE;

C. DROP TABLE student;

D. DELETE *

FROM student;

E. TRUNCATE TABLE student;

Answer: E

QUESTION NO: 46

Examine the structure of the STUDENT table:

Name Null? Type

------------------ ---------- ------------

STUD_ID NOT NULL NUMBER(3)

NAME NOT NULL VARCHAR2(25)

PHONE NOT NULL VARCHAR2(9)

ADDRESS VARCHAR2(50)

GRADUATION DATE

There are 100 records in the STUDENT table. You want to change the name of the GRADUATION column
to GRAD_DATE.

Which statement is true?


A. You cannot rename a column.

B. You use the ALTER TABLE command with the RENAME COLUMN clause to rename the column.

C. You use the ALTER TABLE command with the MODIFY COLUMN clause to rename the column.

D. You use the ALTER TABLE command with the MODIFY clause to rename the column.

Answer: A

QUESTION NO: 47

The EMPLOYEE table contains these columns:

LAST_NAME VARCHAR2(25)

FIRST_NAME VARCHAR2(25)

DEPT_ID NUMBER(9)

You need to display the names of employees that are not assigned to a department.

Evaluate this SQL statement:

SELECT last_name, first_name

FROM employee

WHEREdept_id = NULL;

Which change should you make to achieve the desired result?

A. Change the operator in the WHERE condition.


B. Create an outer join.

C. Add a second condition to the WHERE condition.

D. Change the column in the WHERE condition.

Answer: A

QUESTION NO: 48

Click on the EXHIBIT button and examine the structure of the BOOK_TITLE, COPY, and CHECK_OUT
tables.

You need to create the BOOKS_AVAILABLE view.

These are the desired results:

1.Include the title of each book.

2.Include the availability of each book.

3.Order the results by the author.

Evaluate this SQL statement:

CREATE VIEW books_available

AS

SELECT b.title, c.availability

FROMbook_title b, copy c

WHEREb.id = c.title_id

ORDER BY b.author;
What does the statement provide?

A. a syntax error

B. one of the desired results

C. all of the desired results

D. two of the desired results

Answer: A

QUESTION NO: 49

Examine this block of code:

SET SERVEROUTPUT ON

DECLARE

x NUMBER;

v_sal NUMBER;

v_found VARCHAR2(10) := 'TRUE';

BEGIN

x := 1;
v_sal := 1000;

DECLARE

v_found VARCHAR2(10);

y NUMBER;

BEGIN

IF (v_sal > 500) THEN

v_found := 'YES';

END IF;

DBMS_OUTPUT.PUT_LINE ('Value of v_found is '|| v_found);

DBMS_OUTPUT.PUT_LINE ('Value of v_sal is '|| v_sal);

y := 20;

END;

DBMS_OUTPUT.PUT_LINE ('Value of v_found is '|| v_found);

DBMS_OUTPUT.PUT_LINE ('Value of Y is '|| TO_CHAR(y));

END;

SET SERVEROUTPUT OFF

What is the result of executing this block of code?

A. Value of v_found is YES

Value of v_sal is 1000

Value of v_found is YES

Value of Y is 20

B. Value of v_found is YES

Value of v_sal is 1000


Value of v_found is TRUE

Value of Y is 20

C. PLS-00201: identifier 'Y' must be declared

D. Value of v_found is YES

Value of v_sal is 1000

Value of v_found is TRUE

E. PLS-00201: identifier 'v_sal' must be declared

PLS-00201: identifier 'Y' must be declared

Answer: C

QUESTION NO: 50

Examine the table structures:

EMP Table Name Null? Type

------------------------------- -------- --------

EMPNO NOT NULL NUMBER(4)

NAME VARCHAR2(10)

JOB VARCHAR2(9)

MGR NUMBER(4)

HIREDATE DATE

SALARY NUMBER(7,2)

COMM NUMBER(7,2)

DEPTNO NOT NULL NUMBER(2)


TAX Table

Name Null? Type

------------------------------- -------- ---------

TAXGRADE NUMBER

LOWSAL NUMBER

HIGHSAL NUMBER

You want to create a report that displays the employee details along with the tax category of each
employee. The tax category is determined by comparing the salary of the employee from the EMP table
to the lower and upper salary values in the TAX table.

Which SELECT statement produces the required results?

A. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary IN t.lowsal AND t.highsal;

B. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary BETWEEN t.lowsal AND t.highsal;

C. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary >= t.lowsal AND <= t.highsal;

D. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary <= t.lowsal AND e.salary >= t.highsal;


Answer: B

QUESTION NO: 51

Click on the EXHIBIT button and examine the table instance chart for the patient table.

You need to create the patient_id_seq sequence to be used with the patient table's primary key column.
The sequence should begin at 1000, have a maximum value of 999999999, never reuse any numbers,
and increment by 1.

Which statement would you use to complete this task?

A. CREATE SEQUENCE patient_id_seq

START WITH 1000

MAXVALUE 999999999

STEP BY 1;

B. This task cannot be accomplished.


C. CREATE SEQUENCE patient_id_seq

ON patient (patient_id)

MINVALUE 1000

MAXVALUE 999999999

INCREMENT BY 1

NOCYCLE;

D. CREATE SEQUENCE patient_id_seq

START WITH 1000

MAXVALUE 999999999

NOCYCLE;

Answer: D

QUESTION NO: 52

You attempt to query the database with this command:

SELECT name, salary

FROM employee

WHERE salary =

(SELECT salary

FROM employee

WHERE last_name = 'Wagner' OR dept_no = 233);

Why could this statement cause an error?


A. A single row subquery is used with a multiple row comparison operator.

B. A multiple row subquery is used with a single row comparison operator.

C. Logical operators are not allowed in the WHERE clause.

D. Subqueries are not allowed in the WHERE clause.

Answer: B

QUESTION NO: 53

Which statement shows the view definition of the view EMP_VIEW that is created based on the table
EMP?

A. SELECT text

FROM user_views

WHERE view_name = 'EMP_VIEW';

B. DESCRIBE VIEW emp_view

C. SELECT view_text

FROM my_views

WHERE view_name = 'EMP_VIEW';

D. DESCRIBE emp

E. SELECT view_text

FROM TABLE emp

WHERE view_name = 'EMP_VIEW';

Answer: A
QUESTION NO: 54

Which two conditions in a PL/SQL block cause an exception to occur? (Choose two.)

A. The SELECT statement contains a GROUP BY clause.

B. The SELECT statement returns more than one row.

C. The datatypes in the SELECT list are inconsistent with the datatypes in the INTO clause.

D. The SELECT statement does not return a row.

E. The SELECT statement does not have a WHERE clause.

Answer: B,D

QUESTION NO: 55

Examine the code:

1 DECLARE

2 i NUMBER := 0;

3 v_date DATE;

4 BEGIN

5 i := i+1;

6 LOOP

7 v_date := v_date + 5;

8 i := i+1;
9 EXIT WHEN i = 5;

10 END LOOP;

11 END;

You have encountered unexpected results when the above block of code is executed. How can you
trace the values of the counter variable I and date variable V_DATE in the SQL*Plus environment?

A. by inserting the statement

DBMS_OUTPUT.PUT_LINE (i ||' '|| TO_CHAR(v_date));

between lines 8 and 9

B. by setting the SQL*Plus session variable DEBUGGER = TRUE

C. by inserting the statement

DBMS_OUTPUT.PUT_LINE (i, v_date);

between lines 8 and 9

D. by inserting the statement

DBMS_OUTPUT.DEBUG_VAR (i, v_date);

between lines 8 and 9

Answer: A

QUESTION NO: 56

The PRODUCT table contains these columns:

ID NUMBER(9) PK

COST NUMBER(7,2)

SALE_PRICE NUMBER(7,2)
Management has asked you to calculate the net revenue per unit for each product if the cost of each
product is increased by 10% and the sale price of each product is increased by 25%.

You issue this SQL statement:

SELECT id, sale_price * 1.25 - cost * 1.10

FROM product;

Which conclusion can you draw from the results?

A. A function needs to be included in the SELECT statement to achieve the desired results.

B. The order of the operations in the calculation needs to be changed to achieve the required results.

C. The results provide more information than management requested.

D. Only the required results are displayed.

Answer: D

QUESTION NO: 57

Which statement would you use to add a primary key constraint to the patient table using the
id_number column, immediately enabling the constraint?

A. ALTER TABLE patient

ADD (id_number CONSTRAINT pat_id_pk PRIMARY KEY);

B. ALTER TABLE patient


MODIFY (id_number CONSTRAINT pat_id_pk PRIMARY KEY);

C. This task cannot be accomplished.

D. ALTER TABLE patient

ADD CONSTRAINT pat_id_pk PRIMARY KEY(id_number);

Answer: D

QUESTION NO: 58

You need to analyze how long your orders take to be shipped from the date that the order is placed. To
do this, you must create a report that displays the customer number, date ordered, date shipped, and
the number of months in whole numbers from the time the order is placed to the time the order is
shipped. Which statement produces the required results?

A. SELECT custid, orderdate, shipdate,

ROUND(DAYS_BETWEEN (shipdate, orderdate))/ 30) "Time Taken"

FROM ord;

B. SELECT custid, orderdate, shipdate,

ROUNDOFF(shipdate - orderdate) "Time Taken"

FROM ord;

C. SELECT custid, orderdate, shipdate,

MONTHS_BETWEEN (shipdate, orderdate)"Time Taken"

FROM ord;

D. SELECT custid, orderdate, shipdate,

ROUND(MONTHS_BETWEEN (shipdate, orderdate))

"Time Taken"

FROM ord;
Answer: D

QUESTION NO: 59

In which situation should you use an outer join query?

A. The employee table column corresponding to the region table column contains null values for rows
that need to be displayed.

B. The employee table has two columns that correspond.

C. The employee and region tables have corresponding columns.

D. The employee and region tables have no corresponding columns.

Answer: A

QUESTION NO: 60

Evaluate this IF statement:

IF v_value > 100 THEN

v_new_value := 2 * v_value;

ELSIF v_value > 200 THEN

v_new_value := 3 * v_value;

ELSIF v_value < 300 THEN

v_new_value := 4 * v_value;

ELSE

v_new_value := 5 * v_value;
END IF;

What would be assigned to V_NEW_VALUE if V_VALUE is 250?

A. 500

B. 750

C. 250

D. 1000

E. 1250

Answer: A

QUESTION NO: 61

Evaluate this SQL script:

CREATE ROLE manager;

CREATE ROLE clerk;

CREATE ROLE inventory;

CREATE USER scott IDENTIFIED BY tiger;

GRANT inventory TO clerk;

GRANT clerk TO manager;

GRANT inventory TO scott

/
How many roles will user SCOTT have access to?

A. 3

B. 1

C. 0

D. 2

Answer: B

QUESTION NO: 62

Which is NOT an SQL*Plus command?

A. DESCRIBE

B. CHANGE

C. LIST

D. UPDATE

E. ACCEPT

Answer: D

QUESTION NO: 63

You attempt to query the database with this command:


SELECT dept_no, AVG(MONTHS_BETWEEN(SYSDATE, hire_date))

FROM employee

WHERE AVG(MONTHS_BETWEEN(SYSDATE, hire_date)) > 60

GROUP BY dept_no

ORDER BY AVG(MONTHS_BETWEEN(SYSDATE, hire_date));

Why does this statement cause an error?

A. A SELECT clause cannot contain a group function.

B. An ORDER BY clause cannot contain a group function.

C. A group function cannot contain a single row function.

D. A WHERE clause cannot be used to restrict groups.

Answer: D

QUESTION NO: 64

The EMPLOYEE table contains these columns:

ID NUMBER(9)

LAST_NAME VARCHAR2(25)

FIRST_NAME VARCHAR2(25)

COMMISSION NUMBER(7,2)

You need to display the current commission for all employees.

These are the desired results:


1.Display the commission multiplied by 1.5.

2.Exclude employees with a zero commission.

3.Display a zero for employees with a null commission value.

Evaluate this SQL command:

SELECT id, last_name, first_name, commission * 1.5

FROM employee

WHEREcommission <> 0;

What does the statement provide?

A. one of the desired results

B. a syntax error

C. all of the desired results

D. two of the desired results

Answer: D

QUESTION NO: 65

You issue this command:

CREATE SYNONYM emp


FOR ed.employee;

Which task has been accomplished?

A. The need to qualify an object name with its schema was eliminated for all users.

B. The need to qualify an object name with its schema was eliminated for user Ed.

C. The need to qualify an object name with its schema was eliminated for only you.

D. The need to qualify an object name with its schema was eliminated for users with access.

Answer: C

QUESTION NO: 66

Evaluate this SQL script:

CREATE ROLE manager;

CREATE ROLE clerk;

CREATE ROLE inventory;

CREATE USER scott IDENTIFIED BY tiger;

GRANT inventory TO clerk;

GRANT clerk TO manager;

GRANT inventory TO scott

How many roles will user SCOTT have access to?


A. 2

B. 3

C. 0

D. 1

Answer: D

QUESTION NO: 67

Evaluate this PL/SQL block:

BEGIN

FOR i IN 1..5 LOOP

IF i = 1 THEN null;

ELSIF i = 3 THEN COMMIT;

ELSIF i = 5 THEN ROLLBACK;

ELSE INSERT INTO test(results)

VALUES(i);

END IF;

END LOOP;

COMMIT;

END;

How many values will be permanently inserted into the TEST table?
A. 2

B. 1

C. 5

D. 0

E. 6

F. 3

Answer: B

QUESTION NO: 68

You need to store currency data and you know that the data will always have two digits to the right of
the decimal point. However, the number of digits to the left of the decimal place will vary greatly.
Which datatype would be most appropriate to store this data?

A. LONG

B. NUMBER

C. LONG RAW

D. NUMBER(p)

Answer: B

QUESTION NO: 69

Examine the structure of the STUDENT table:


Name Null? Type

------------- ----------------- -------------

STUD_ID NOT NULL NUMBER(3)

NAME VARCHAR2(25)

ADDRESS VARCHAR2(50)

GRADUATION DATE

Currently, the table is empty. You have decided that NULL values should not be allowed for NAME
column.

Which statement restricts NULL values from being entered into the column?

A. ALTER TABLE student

ADD CONSTRAINT name(NOT NULL);

B. ALTER TABLE student

ADD CONSTRAINT NOT NULL(name);

C. ALTER TABLE student

MODIFY (name varchar2(25) NOT NULL);

D. ALTER TABLE student

MODIFY CONSTRAINT name(NOT NULL);

Answer: C

QUESTION NO: 70
Evaluate this PL/SQL block:

BEGIN

FOR i IN 1..10 LOOP

IF i = 4 OR i = 6 THEN

null;

ELSE

INSERT INTO test(results)

VALUES (I);

END IF;

COMMIT;

END LOOP;

ROLLBACK;

END;

How many values will be inserted into the TEST table?

A. 4

B. 8

C. 0

D. 10

E. 6

Answer: B
QUESTION NO: 71

You attempt to create the salary table with this command:

1.CREATE TABLE salary

2.(employee_idNUMBER(9)

3.CONSTRAINT salary_pk PRIMARY KEY,

4.1995_salaryNUMBER(8,2),

5.manager_nameVARCHAR2(25)

6.CONSTRAINT mgr_name_nn NOT NULL,

7.$salary_96NUMBER(8,2));

Which two lines of this statement will return errors? (Choose two.)

A. 4

B. 5

C. 7

D. 3

E. 2

F. 1

Answer: A,C

QUESTION NO: 72
Which statement about using a subquery in the FROM clause is true?

A. You define a data source for future SELECT statements when using a subquery in the FROM clause.

B. You eliminate the need to create a new view or table by placing a subquery in the FROM clause.

C. You eliminate the need to grant SELECT privileges on the table used in the FROM clause subquery.

D. You cannot use a subquery in the FROM clause.

Answer: B

QUESTION NO: 73

In which order does the Oracle Server evaluate clauses?

A. WHERE, GROUP BY, HAVING

B. WHERE, HAVING, GROUP BY

C. HAVING, WHERE, GROUP BY

D. GROUP BY, HAVING, WHERE

Answer: A

QUESTION NO: 74

You need to change the job title 'Clerk' to 'Administrative Clerk' for all clerks. Which statement does
this?

A. UPDATE emp
SET VALUES job = 'Administrative Clerk'

WHERE UPPER(job) = 'CLERK';

B. UPDATE emp

SET job = 'Administrative Clerk';

C. UPDATE emp

job := 'Administrative Clerk'

WHERE UPPER(job) = 'CLERK';

D. UPDATE emp

SET job = 'Administrative Clerk'

WHERE UPPER(job) = 'CLERK';

Answer: D

QUESTION NO: 75

Examine the structure of the STUDENT table:

Name Null? Type

----------------- ------------- ------------

STUD_ID NOT NULL NUMBER(3)

NAME VARCHAR2(25)

ADDRESS VARCHAR2(50)

GRADUATION DATE

Currently, the table is empty. You have decided that NULL values should not be allowed for NAME
column.
Which statement restricts NULL values from being entered into the column?

A. ALTER TABLE student

MODIFY (name varchar2(25) NOT NULL);

B. ALTER TABLE student

ADD CONSTRAINT name(NOT NULL);

C. ALTER TABLE student

ADD CONSTRAINT NOT NULL(name);

D. ALTER TABLE student

MODIFY CONSTRAINT name(NOT NULL);

Answer: A

QUESTION NO: 76

Click on the EXHIBIT button and examine the table instance chart for the cars table.

You query the database with this command:

SELECT lot_no "Lot Number", COUNT(*) "Number of Cars Available"

FROM cars

WHERE model = 'Fire'

GROUP BY lot_no

HAVING COUNT(*) > 10


ORDER BY COUNT(*);

Which clause restricts which groups are displayed?

A. HAVING COUNT(*) > 10

B. WHERE model = 'Fire'

C. GROUP BY lot_no

D. ORDER BY COUNT(*)

E. SELECT lot_no "Lot Number", COUNT(*) "Number of Cars Available"

Answer: A

QUESTION NO: 77

Which privilege concerns system level security?

A. DROP ANY TABLE

B. INDEX

C. DELETE

D. UPDATE
E. ALTER

Answer: A

QUESTION NO: 78

Which statement is valid within the executable section of a PL/SQL block?

A. WHEN NO_DATA_FOUND THEN

DBMS_OUTPUT.PUT_LINE ('No records found');

B. SELECT ename, sal

INTO v_ename, v_sal

FROM emp

WHERE empno = 101;

C. PROCEDURE calc_max (n1 NUMBER,n2 NUMBER,p_max OUT NUMBER) IS

BEGIN

IF n1 > n2 THEN

p_max := n1;

ELSE

p_max := n2;

END;

D. BEGIN

emp_rec emp%ROWTYPE;

END;
Answer: B

QUESTION NO: 79

A DBA has updated Smith's account by adding the privileges CREATE ANY TABLE and CREATE
PROCEDURE. Which tasks can Smith successfully perform?

A. Smith can create a table in any schema of the database but can drop tables from and create
procedures only in his schema.

B. Smith can create any table or procedure only in his schema. Also, he can drop any table only from his
schema.

C. Smith can create tables, drop tables and create procedures in any schema of the database.

D. Smith can create a table or a procedure in any schema of the database. Also, he can drop a table in
any schema of the database.

Answer: A

QUESTION NO: 80

Which script would you use to query the data dictionary to view only the name of the primary key
constraints by using a substitution parameter for the table name?

A. ACCEPT table PROMPT 'Table to view primary key constraint: '

SELECT constraint_name

FROM user_constraints

WHERE table_name = UPPER('&table') AND constraint_type = 'PRIMARY';

B. ACCEPT table PROMPT 'Table to view primary key constraint: '


SELECT constraint_name

FROM user_cons_columns

WHERE table_name = UPPER('&table') AND constraint_type = 'P';

C. ACCEPT table PROMPT 'Table to view primary key constraint: '

SELECT constraint_name, constraint_type

FROM user_constraints

WHERE table_name = UPPER('&table');

D. ACCEPT table PROMPT 'Table to view primary key constraint: '

SELECT constraint_name

FROM user_constraints

WHERE table_name = UPPER('&table') AND constraint_type = 'P';

Answer: D

QUESTION NO: 81

The EMPLOYEE table contains these columns:

ID NUMBER(9) PK

LAST_NAME VARCHAR2(25)NN

DEPT_ID NUMBER(9)

Evaluate this SQL script:

DEFINE id_2 = 93004

SELECT *

FROMemployee
WHEREid = (&id_2)

Which change should you make to the script so that it will execute?

A. Remove the ampersand.

B. Use the ACCEPT command.

C. Add single quotation marks.

D. No change is needed.

Answer: D

QUESTION NO: 82

Which ALTER command would you use to reinstate a disabled primary key constraint?

A. ALTER TABLE cars

ENABLE CONSTRAINT cars_id_pk;

B. ALTER TABLE cars

ADD CONSTRAINT cars_id_pk PRIMARY KEY (id);

C. ALTER TABLE cars

ENABLE PRIMARY KEY (id) CASCADE;

D. ALTER TABLE cars

ENABLE PRIMARY KEY (id);


Answer: A

QUESTION NO: 83

You need to retrieve the employee names and salaries from your EMP table sorted by salary in
descending order. If two names match for a salary, the names must be displayed in alphabetical order.
Which statement produces the required results?

A. SELECT ename, sal

FROM EMP

ORDER BY ename, sal;

B. SELECT ename, sal

FROM EMP

ORDER BY sal DESC, ename ASCENDING;

C. SELECT ename, sal

FROM EMP

ORDER BY sal, ename;

D. SELECT ename, sal

FROM EMP

ORDER BY sal DESC, ename;

E. SELECT ename, sal

FROM EMP

SORT BY sal DESC, ename;

Answer: D
QUESTION NO: 84

The EMPLOYEE table contains these columns:

FIRST_NAMEVARCHAR2(25)

COMMISSION NUMBER(3,2)

Evaluate this SQL statement:

SELECT first_name, commission

FROM employee

WHERE commission =

(SELECTcommission

FROMemployee

WHEREUPPER(first_name) = 'SCOTT')

What would cause this statement to fail?

A. There is more than one employee with the first name Scott.

B. The FIRST_NAME values in the database are in lowercase.

C. Scott has a NULL commission value.

D. Scott has a zero commission value.

E. There is no employee with the first name Scott.

Answer: A
QUESTION NO: 85

In SQL*Plus, you issued this command:

DELETE FROM dept

WHERE dept_id = 901;

You received an integrity constraint error because a child record was found. What could you do to make
the statement execute?

A. Add the CONSTRAINTS CASCADE option to the command.

B. Add the FORCE keyword to the command.

C. You cannot make the command execute.

D. Delete the child records first.

Answer: D

QUESTION NO: 86

You want to create a report to show different jobs in each department. You do not want to display any
duplicate rows in the report. Which SELECT statement do you use to create the report?

A. SELECT deptno, job

FROM EMP;

B. SELECT NODUPLICATE deptno, job

FROM EMP;

C. SELECT DISTINCT deptno, job


FROM EMP;

D. CREATE REPORT

DISPLAY deptno, job

FROM EMP;

E. SELECT DISTINCT deptno, DISTINCT job

FROM EMP;

Answer: C

QUESTION NO: 87

Which should you do after each FETCH statement in a PL/SQL block?

A. Open the cursor.

B. Initialize the loop.

C. Close the cursor.

D. Test for rows using a cursor attribute.

Answer: D

QUESTION NO: 88

Click on the EXHIBIT button and examine the structure of the DEPARTMENT and EMPLOYEE tables.

Evaluate this SQL statement:


CREATE INDEX emp_dept_id_idx

ON employee(dept_id);

Which result will the statement provide?

A. Increase the chance of full table scans.

B. May reduce the amount of disk I/O for SELECT statements.

C. May reduce the amount of disk I/O for INSERT statements.

D. Store an index in the EMPLOYEE table.

E. Override the unique index created when the FK relationship was defined.

Answer: B

QUESTION NO: 89

Your company wants to give each employee a $100 salary increment. You need to evaluate the results
from the EMP table prior to the actual modification. If you do not want to store the results in the
database, which statement is valid?

A. You need to give the arithmetic expression that involves the salary increment in the UPDATE clause of
the SELECT statement.
B. You need to give the arithmetic expression that involves the salary increment in the SET clause of the
UPDATE statement.

C. You need to add a column to the EMP table.

D. You need to give the arithmetic expression that involves the salary increment in the SELECT clause of
the SELECT statement.

E. You need to give the arithmetic expression that involves the salary increment in the DISPLAY clause of
the SELECT statement.

Answer: D

QUESTION NO: 90

Click on the EXHIBIT button and examine the table instance chart for the patient table.

You created the patient_vu view based on id_number and last_name from the patient table. What is
the best way to modify the view to contain only those patients born in 1997?

A. Replace the view adding a WHERE clause.

B. Drop the patient_vu, then create a new view with a HAVING clause.

C. Drop the patient_vu, then create a new view with a WHERE clause.

D. Use the ALTER command to add a WHERE clause to verify the time.
Answer: A

QUESTION NO: 91

Examine the structure of the STUDENT table:

Name Null? Type

------------- ----------- ------------

STUD_ID NOT NULL NUMBER(3)

NAME NOT NULL VARCHAR2(25)

ADDRESS VARCHAR2(50)

GRADUATION DATE

Graduation column is a foreign key column to the GRADDATE table.

Examine the data in the GRADDATE 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. UPDATE student

SET name = 'Smith',

graduation = '29-MAY-2001'

WHERE stud_id = 101;

B. UPDATE student

SET name = 'Smith',

graduation = '15-AUG-2000'

WHERE stud_id = 101;

C. UPDATE student

SET stud_id = 999,

graduation = '29-MAY-2001'

WHERE stud_id = 101;

D. UPDATE student

SET stud_id = NULL,

address = '100 Main Street'

WHERE graduation = '20-JAN-1999';

Answer: B

QUESTION NO: 92
Examine this block of code:

SET SERVEROUTPUT ON

DECLARE

x NUMBER;

v_sal NUMBER;

v_found VARCHAR2(10) := 'TRUE';

BEGIN

x := 1;

v_sal := 1000;

DECLARE

v_found VARCHAR2(10);

y NUMBER;

BEGIN

IF (v_sal > 500) THEN

v_found := 'YES';

END IF;

DBMS_OUTPUT.PUT_LINE ('Value of v_found is '|| v_found);

DBMS_OUTPUT.PUT_LINE ('Value of v_sal is '|| v_sal);

y := 20;

END;

DBMS_OUTPUT.PUT_LINE ('Value of v_found is '|| v_found);

DBMS_OUTPUT.PUT_LINE ('Value of Y is '|| TO_CHAR(y));

END;

SET SERVEROUTPUT OFF


Why does this code produce an error when executed?

A. The value of V_FOUND cannot be 'YES'.

B. Variable Y is declared in the inner block and referenced in the outer block.

C. Variable V_FOUND is declared at more than one location.

D. Variable V_SAL is declared in the outer block and referenced in the inner block.

Answer: B

QUESTION NO: 93

Click on the EXHIBIT button and examine the table instance chart for the employee table.

You want to display each employee's hire date from earliest to latest. Which SQL statement would you
use?

A. SELECT hire_date

FROM employee;

B. SELECT hire_date
FROM employee

ORDER BY hire_date DESC;

C. SELECT hire_date

FROM employee

ORDER BY hire_date;

D. SELECT hire_date

FROM employee

GROUP BY hire_date;

Answer: C

QUESTION NO: 94

In which section of a PL/SQL block is a user-defined exception raised?

A. heading

B. declarative

C. executable

D. exception handling

Answer: C

QUESTION NO: 95

Examine the declaration section:


DECLARE

CURSOR emp_cursor(p_deptno NUMBER, p_job VARCHAR2)

IS

SELECT empno, ename

FROM emp

WHERE deptno = p_deptno

AND job = p_job;

BEGIN

...

Which statement opens this cursor successfully?

A. OPEN emp_cursor('Clerk', 10);

B. OPEN emp_cursor;

C. OPEN emp_cursor(p_deptno, p_job);

D. OPEN emp_cursor(10,'Analyst');

Answer: D

QUESTION NO: 96

The EMPLOYEE table has ten columns. Since you often query the table with conditions based on four or
more columns, you created an index on all the columns in the table. Which result will occur?

A. The speed of inserts will be increased.


B. Updates on the table will be slower.

C. The size of the EMPLOYEE table will be increased.

D. All queries on the table will be faster.

Answer: B

QUESTION NO: 97

Which SELECT statement would you use in a PL/SQL block to query the employee table and retrieve the
last name and salary of the employee whose id is 3?

A. SELECT last_name, salary

INTO v_last_name, v_salary

FROM employee

WHERE id = 3;

B. SELECT last_name, salary

FROM employee

INTO v_last_name, v_salary

WHERE id = 3;

C. SELECT last_name, salary

FROM employee

WHERE id = 3;

D. SELECT last_name, salary

FROM employee;

Answer: A
QUESTION NO: 98

Examine the table structures:

EMP Table Name Null? Type

------------------------------- ----------------- -----------

EMPNO NOT NULL NUMBER(4)

NAME VARCHAR2(10)

JOB VARCHAR2(9)

MGR NUMBER(4)

HIREDATE DATE

SALARY NUMBER(7,2)

COMM NUMBER(7,2)

DEPTNO NOT NULL NUMBER(2)

TAX Table

Name Null? Type

------------------------------- ---------- --------

TAXGRADE NUMBER

LOWSAL NUMBER

HIGHSAL NUMBER

You want to create a report that displays the employee details along with the tax category of each
employee. The tax category is determined by comparing the salary of the employee from the EMP table
to the lower and upper salary values in the TAX table.
Which SELECT statement produces the required results?

A. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary BETWEEN t.lowsal AND t.highsal;

B. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary <= t.lowsal AND e.salary >= t.highsal;

C. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary IN t.lowsal AND t.highsal;

D. SELECT e.name, e.salary, t.taxgrade

FROM emp e, tax t

WHERE e.salary >= t.lowsal AND <= t.highsal;

Answer: A

QUESTION NO: 99

Click on the EXHIBIT button and examine the structure of the DEPARTMENT and EMPLOYEE tables.

Evaluate this SQL statement:

CREATE INDEX emp_dept_id_idx


ON employee(dept_id);

Which result will the statement provide?

A. May reduce the amount of disk I/O for SELECT statements.

B. May reduce the amount of disk I/O for INSERT statements.

C. Increase the chance of full table scans.

D. Store an index in the EMPLOYEE table.

E. Override the unique index created when the FK relationship was defined.

Answer: A

QUESTION NO: 100

You attempt to create the salary table with this command:

1.CREATE TABLE salary

2.(employee_idNUMBER(9)

3.CONSTRAINT salary_pk PRIMARY KEY,

4.1995_salaryNUMBER(8,2),

5.manager_nameVARCHAR2(25)
6.CONSTRAINT mgr_name_nn NOT NULL,

7.$salary_96NUMBER(8,2));

Which two lines of this statement will return errors? (Choose two.)

A. 3

B. 2

C. 1

D. 7

E. 4

F. 5

Answer: D,E

QUESTION NO: 101

Click on the EXHIBIT button and examine the table instance chart for the cars table.

Which SELECT statement will display style, color, and lot number for all cars based on the model entered
at the prompt, regardless of case?
A. SELECT style, color, lot_no

FROM cars

WHERE model = '&model';

B. SELECT style, color, lot_no

FROM cars

WHERE UPPER(model) = '&model';

C. SELECT style, color, lot_no

FROM cars

WHERE UPPER(model) = UPPER('&model');

D. SELECT style, color, lot_no

FROM cars

WHERE model = UPPER('&model');

Answer: C

QUESTION NO: 102

Examine the structure of the STUDENT table:


Name Null? Type

---------------- -------- ------------

STUD_ID NOT NULL NUMBER(3)

NAME NOT NULL VARCHAR2(25)

ADDRESS VARCHAR2(50)

GRADUATION DATE

Which statement inserts a new row into the STUDENT table?

A. INSERT INTO student

VALUES (101,'Smith');

B. INSERT INTO student (stud_id, address, graduation)

VALUES (101,'100 Main Street','17-JUN-99');

C. INSERT INTO student (stud_id, address, name, graduation)

VALUES (101,'100 Main Street','Smith','17-JUN-99');

D. INSERT INTO student table

VALUES (101,'Smith','100 Main Street','17-JUN-99');

E. INSERT INTO student

VALUES (101,'100 Main Street','17-JUN-99','Smith');

Answer: C

QUESTION NO: 103


You need to store currency data and you know that the data will always have two digits to the right of
the decimal point. However, the number of digits to the left of the decimal place will vary greatly.
Which datatype would be most appropriate to store this data?

A. LONG

B. LONG RAW

C. NUMBER(p)

D. NUMBER

Answer: D

QUESTION NO: 104

You need to remove all the data from the employee table while leaving the table definition intact. You
want to be able to undo this operation. How would you accomplish this task?

A. TRUNCATE TABLE employee;

B. DELETE FROM employee;

C. This task cannot be accomplished.

D. DROP TABLE employee;

Answer: B

QUESTION NO: 105

Click on the EXHIBIT button and examine the employee table.


You create a view with this command:

CREATE VIEW dept_salary_vu

AS SELECT dept_no, salary, last_name

FROM employee

WHERE salary > 45000

WITH CHECK OPTION;

For which employee can you update the dept_no column?

A. Southall

B. none

C. Chiazza

D. Brown

Answer: C

QUESTION NO: 106


The PLAYER table contains these columns:

ID NUMBER(9)

NAME VARCHAR(2)

MANAGER_ID NUMBER(9)

In this instance, managers are players and you need to display a list of players.

Evaluate these two SQL statements:

SELECT p.name, m.name

FROMplayer p, player m

WHEREm.id = p.manager_id;

SELECT p.name, m.name

FROMplayer p, player m

WHEREm.manager_id = p.id;

How will the results differ?

A. Statement 1 will not execute; statement 2 will.

B. Statement 1 is self-join; statement 2 is not.

C. Statement 1 will execute; statement 2 will not.

D. The results will be the same, but the display will be different.

Answer: D
QUESTION NO: 107

You attempt to query the database with this command:

SELECT dept_no, AVG(MONTHS_BETWEEN(SYSDATE, hire_date))

FROM employee

WHERE AVG(MONTHS_BETWEEN(SYSDATE, hire_date)) > 60

GROUP BY dept_no

ORDER BY AVG(MONTHS_BETWEEN(SYSDATE, hire_date));

Why does this statement cause an error?

A. A SELECT clause cannot contain a group function.

B. An ORDER BY clause cannot contain a group function.

C. A group function cannot contain a single row function.

D. A WHERE clause cannot be used to restrict groups.

Answer: D

QUESTION NO: 108

Evaluate this PL/SQL block:

DECLARE
v_result NUMBER(2);

BEGIN

DELETE

FROM employee

WHERE dept_id IN (10, 20, 30);

v_result := SQL%ROWCOUNT;

COMMIT;

END;

What will be the value of V_RESULT if no rows are deleted?

A. 0

B. NULL

C. FALSE

D. 1

E. TRUE

Answer: A

QUESTION NO: 109

Which two conditions in a PL/SQL block cause an exception to occur? (Choose two.)

A. The SELECT statement does not have a WHERE clause.

B. The SELECT statement contains a GROUP BY clause.


C. The SELECT statement does not return a row.

D. The SELECT statement returns more than one row.

E. The datatypes in the SELECT list are inconsistent with the datatypes in the INTO clause.

Answer: C,D

QUESTION NO: 110

The structure of the DEPT table is as follows:

Name Null? Type

------------------------------- -------------- ---------

DEPTNO NOT NULL NUMBER(2)

DNAME VARCHAR2(14)

LOC VARCHAR2(13)

Examine the code:

DECLARE

dept_rec dept%ROWTYPE;

BEGIN

SELECT *

INTO dept_rec

FROM dept

WHERE deptno = 10;


END;

Which PL/SQL statement displays the location of the selected department?

A. DBMS_OUTPUT.PUT_LINE (dept_rec.loc);

B. DBMS_OUTPUT.PUT_LINE (dept_rec);

C. You cannot display a single field in the record because they are not explicitly identified in the
declarative section.

D. DBMS_OUTPUT.PUT_LINE (dept_rec(1).loc);

Answer: A

QUESTION NO: 111

Which SELECT statement displays employee names, salaries, department numbers, and average salaries
for all employees who earn more than the average salary in their department?

A. SELECT outer.ename,outer.sal,outer.deptno,AVG(outer.sal)

FROM emp outer

GROUP BY outer.ename, outer.sal, outer.deptno

HAVING AVG(outer.sal) IN

(SELECT inner.sal

FROM emp inner

WHERE inner.deptno = outer.deptno);

B. SELECT outer.ename,outer.sal,

outer.deptno,AVG(outer.sal)
FROM emp outer

GROUP BY outer.ename, outer.sal, outer.deptno

HAVING AVG(outer.sal) >

(SELECT inner.sal

FROM emp inner WHERE inner.deptno = outer.deptno);

C. SELECT ename, sal, deptno, AVG(sal)

FROM emp

GROUP BY ename, sal, deptno;

D. SELECT a.ename, a.sal, a.deptno, b.salavg

FROM emp a, (SELECT deptno, AVG(sal) salavg

FROM emp

GROUP BY deptno) b

WHERE a.deptno = b.deptno

AND a.sal > b.salavg;

Answer: D

QUESTION NO: 112

You need to execute a script file named QUERYEMP.SQL from your SQL*Plus environment. Which
command do you use?

A. START QUERYEMP

B. RUN QUERYEMP

C. GET QUERYEMP

D. EXECUTE QUERYEMP
Answer: A

QUESTION NO: 113

You need to create a PL/SQL program to insert records into the employee table. Which block of code
successfully uses the INSERT command?

A. DECLARE

v_hiredate DATE := SYSDATE;

BEGIN

INSERT INTO emp(empno, ename, hiredate, deptno)

(empno_sequence.nextval, '&name', v_hiredate,

&deptno);

END;

B. DECLARE

v_hiredate DATE := SYSDATE;

BEGIN

INSERT INTO emp(empno, ename, hiredate, deptno)

VALUES(empno_sequence.nextval, '&name', v_hiredate,

&deptno);

END;

C. DECLARE

v_hiredate DATE := SYSDATE;

BEGIN

INSERT INTO emp(empno, ename, hiredate, deptno)


VALUES(empno_sequence.nextval, '&name', v_hiredate,

&deptno)

WHERE job = 'CLERK';

END;

D. DECLARE

v_hiredate DATE := SYSDATE;

BEGIN

INSERT INTO emp(empno, ename, hiredate)

VALUES(empno_sequence.nextval, '&name', v_hiredate,

&deptno);

END;

Answer: B

QUESTION NO: 114

Which SELECT statement displays the order id, product id, and quantity of items in the ITEM table that
match both the product id and quantity of an item in order 605? (Do not display the details for order
605.)

A. SELECT ordid, prodid, qty

FROM item

WHERE (prodid, qty) IN

(SELECT prodid, qty

FROM item

WHERE ordid = 605)


AND ordid <> 605;

B. SELECT ordid, prodid, qty

FROM item

WHERE (prodid, qty) =

(SELECT prodid, qty

FROM item

WHERE ordid = 605)

AND ordid <> 605;

C. SELECT ordid, prodid, qty

FROM item

WHERE (prodid, qty) IN

(SELECT prodid, qty

FROM item

WHERE ordid = 605);

D. SELECT ordid, prodid, qty

FROM item

WHERE (prodid, qty) IN

(SELECT ordid, prodid, qty

FROM item

WHERE ordid = 605)

AND ordid <> 605;

Answer: A
QUESTION NO: 115

Evaluate this PL/SQL block:

BEGIN

FOR i IN 1..10 LOOP

IF i = 4 OR i = 6 THEN

null;

ELSE

INSERT INTO test(results)

VALUES (I);

END IF;

COMMIT;

END LOOP;

ROLLBACK;

END;

How many values will be inserted into the TEST table?

A. 8

B. 10

C. 4

D. 6

E. 0

Answer: A
QUESTION NO: 116

You create the sale table with this command:

CREATE TABLE sale

(purchase_no NUMBER(9)

CONSTRAINT sale_purchase_no_pk PRIMARY KEY,

customer_id NUMBER(9)

CONSTRAINT sale_customer_id_fk REFERENCES customer (id)

CONSTRAINT sale_customer_id_nn NOT NULL);

Which index or indexes are created for this table?

A. No indexes are created for this table.

B. An index is created for each column.

C. An index is created for the customer_id column.

D. An index is created for the purchase_no column.

Answer: D

QUESTION NO: 117

Click on the EXHIBIT button and examine the table instance chart for the patient table.
You created the patient_id_seq sequence to be used with the patient table's primary key column. The
sequence begins at 1000, has a maximum value of 999999999, and increments by 1. You need to write
a script to insert a row into the patient table and use the sequence you created.

Which script would you use to complete this task?

A. INSERT INTO patient (id_number, last_name, first_name, birth_date)

VALUES (patient_id_seq, last_name, first_name, birth_date)

B. INSERT INTO patient (id_number, last_name, first_name, birth_date)

VALUES (patient_id_seq.NEXTVAL, &last_name, &first_name, &birth_date)

C. INSERT INTO patient (id_number, last_name, first_name, birth_date)

VALUES (patient_id_seq.NEXTVALUE, &last_name, &first_name, &birth_date)

D. INSERT INTO patient (id_number)

VALUES (patient_id_seq.NEXTVALUE)

E. This task cannot be accomplished.

F. INSERT INTO patient (id_number, last_name, first_name, birth_date)

VALUES (patient_id_seq.CURRVAL, &last_name, &first_name, &birth_date)

/
Answer: B

QUESTION NO: 118

How do you send the output of your SQL*Plus session to a text operating system file called
MYOUTPUT.LST?

A. SAVE myoutput.lst

B. SPOOL myoutput.lst

C. PRINT myoutput.lst

D. SENDOUTPUT myoutput.lst

Answer: B

QUESTION NO: 119

You need to analyze how long your orders take to be shipped from the date that the order is placed. To
do this, you must create a report that displays the customer number, date ordered, date shipped, and
the number of months in whole numbers from the time the order is placed to the time the order is
shipped.

Which statement produces the required results?

A. SELECT custid, orderdate, shipdate,

ROUNDOFF(shipdate - orderdate) "Time Taken"

FROM ord;
B. SELECT custid, orderdate, shipdate,

MONTHS_BETWEEN (shipdate, orderdate)"Time Taken"

FROM ord;

C. SELECT custid, orderdate, shipdate,

ROUND(DAYS_BETWEEN (shipdate, orderdate))/ 30) "Time Taken"

FROM ord;

D. SELECT custid, orderdate, shipdate,

ROUND(MONTHS_BETWEEN (shipdate, orderdate))

"Time Taken"

FROM ord;

Answer: D

QUESTION NO: 120

The EMPLOYEE table contains these columns:

BONUSNUMBER(7,2)

DEPT_ID NUMBER(9)

There are 10 departments and each department has at least 1 employee. Bonus values are greater than
500; not all employees receive a bonus.

Evaluate this PL/SQL block:

DECLARE

v_bonusemployee.bonus%TYPE := 300;
BEGIN

UPDATE employee

SET bonus = bonus + v_bonus

WHERE dept_id IN (10, 20, 30);

COMMIT;

END;

What will be the result?

A. A subset of employees will be given a 300 bonus.

B. All employees will be given a 300 increase in bonus.

C. A subset of employees will be given a 300 increase in bonus.

D. All employees will be given a 300 bonus.

Answer: C

QUESTION NO: 121

The view EMP_VIEW is created based on the table EMP as follows:

CREATE OR REPLACE VIEW emp_view

AS

SELECT deptno, SUM(sal) TOT_SAL, COUNT(*) NUM_EMP

FROM emp

GROUP BY deptno;
What happens when the following command is issued?

UPDATE emp_view

SET tot_sal = 20000

WHERE deptno = 10;

A. The base table can not be updated through this view.

B. The SAL column in the EMP table is updated to 20000 for employees in department 10.

C. The TOT_SAL column in EMP table is updated to 20000 for department 10.

D. The TOT_SAL column in EMP_VIEW view is updated to 20000 for department 10.

Answer: A

QUESTION NO: 122

In which order does the Oracle Server evaluate clauses?

A. WHERE, HAVING, GROUP BY

B. HAVING, WHERE, GROUP BY

C. WHERE, GROUP BY, HAVING

D. GROUP BY, HAVING, WHERE

Answer: C
QUESTION NO: 123

Click on the EXHIBIT button and examine the table instance chart for the cars table.

Which SELECT statement will display style, color, and lot number for all cars based on the model entered
at the prompt, regardless of case?

A. SELECT style, color, lot_no

FROM cars

WHERE model = UPPER('&model');

B. SELECT style, color, lot_no

FROM cars

WHERE UPPER(model) = '&model';

C. SELECT style, color, lot_no

FROM cars

WHERE model = '&model';

D. SELECT style, color, lot_no

FROM cars

WHERE UPPER(model) = UPPER('&model');

Answer: D
QUESTION NO: 124

Click on the EXHIBIT button and examine the structure of the PRODUCT and PART tables.

You issue this SQL statement:

SELECT pr.name

FROMpart pt, product pr

WHEREpt.product_id(+) = pr.id;

What is the result?

A. A list of all products is displayed for products with parts.

B. An error is generated.

C. A list of all product names is displayed.

D. A list of products is displayed for parts that have products assigned.

Answer: C
QUESTION NO: 125

The structure of the DEPT table is as follows:

Name Null? Type

------------------------------- ---------- --------

DEPTNO NOT NULL NUMBER(2)

DNAME VARCHAR2(14)

LOC VARCHAR2(13)

Examine the declaration section:

DECLARE

TYPE dept_table_type IS TABLE OF dept%ROWTYPE

INDEX BY BINARY_INTEGER;

dept_table dept_table_type;

You need to assign the LOC field in record 15, the value of 'Atlanta'. Which PL/SQL statement makes this
assignment?

A. dept_table.loc.15 := 'Atlanta';

B. dept_table(15).loc := 'Atlanta';

C. dept_table[15].loc := 'Atlanta';

D. dept_table_type(15).loc := 'Atlanta';

Answer: B
QUESTION NO: 126

Evaluate these two SQL commands:

1.SELECT DISTINCT object_type

FROM user_objects;

2.SELECTobject_type

FROM all_objects;

How will the results differ?

A. Statement 1 will display the distinct object types owned by the user; statement 2 will display all the
object types the user can access.

B. Statement 1 will display the distinct object types owned by the user; statement 2 will display all the
object types in the database.

C. Statement 1 will display the distinct object types in the database; statement 2 will display all the
object types in the database.

D. Statement 1 will display the distinct object types that the user can access; statement 2 will display all
the object types that the user owns.

Answer: A

QUESTION NO: 127

Which statement is valid within the executable section of a PL/SQL block?

A. PROCEDURE calc_max (n1 NUMBER,n2 NUMBER,p_max OUT NUMBER) IS


BEGIN

IF n1 > n2 THEN

p_max := n1;

ELSE

p_max := n2;

END;

B. SELECT ename, sal

INTO v_ename, v_sal

FROM emp

WHERE empno = 101;

C. WHEN NO_DATA_FOUND THEN

DBMS_OUTPUT.PUT_LINE ('No records found');

D. BEGIN

emp_rec emp%ROWTYPE;

END;

Answer: B

QUESTION NO: 128

You want to create a report that gives, per department, the number of employees and total salary as a
percentage of all the departments.

Examine the results from the report:

Department %Employees %Salary


--------------- ---------------- -------------

10 21.43 30.15 2

0 35.71 37.47

30 42.86 32.39

Which SELECT statement produces the report?

A. SELECT deptno "Department",

(COUNT(*)/COUNT(empno)) * 100 "%Employees",

(SUM(sal)/COUNT(*)) * 100 "%Salary"

FROM scott.emp

GROUP BY deptno;

B. SELECT

a.deptno "Department",

ROUND(a.num_emp/b.total_count * 100, 2) "%Employees",

ROUND(a.sal_sum/b.total_sal * 100, 2) "%Salary"

FROM

(SELECT deptno, COUNT(*) num_emp, SUM(SAL) sal_sum

FROM scott.emp

GROUP BY deptno) a,

(SELECT COUNT(*) total_count, SUM(sal) total_sal

FROM scott.emp) b;

C. SELECT deptno "Department",

PCT(empno) "%Employees",

PCT(sal) "%Salary"
FROM scott.emp

GROUP BY deptno;

D. SELECT a.deptno "Department",

(a.num_emp/COUNT(*)) * 100 "%Employees",

(a.sal_sum/COUNT(*)) * 100 "%Salary"

FROM

(SELECT deptno, COUNT(*) num_emp, SUM(SAL) sal_sum

FROM scott.emp

GROUP BY deptno) a;

Answer: B

QUESTION NO: 129

Which privilege concerns system level security?

A. INDEX

B. DROP ANY TABLE

C. DELETE

D. UPDATE

E. ALTER

Answer: B
QUESTION NO: 130

The view EMP_VIEW is created based on the table EMP as follows:

CREATE OR REPLACE VIEW emp_view

AS

SELECT deptno, SUM(sal) TOT_SAL, COUNT(*) NUM_EMP

FROM emp

GROUP BY deptno;

What happens when the following command is issued?

UPDATE emp_view

SET tot_sal = 20000

WHERE deptno = 10;

A. The SAL column in the EMP table is updated to 20000 for employees in department 10.

B. The TOT_SAL column in EMP_VIEW view is updated to 20000 for department 10.

C. The TOT_SAL column in EMP table is updated to 20000 for department 10.

D. The base table can not be updated through this view.

Answer: D

QUESTION NO: 131

Click on the EXHIBIT button and examine the table instance chart for the patient table.
You need to create the patient_id_seq sequence to be used with the patient table's primary key column.
The sequence should begin at 1000, have a maximum value of 999999999, never reuse any numbers,
and increment by 1.

Which statement would you use to complete this task?

A. CREATE SEQUENCE patient_id_seq

START WITH 1000

MAXVALUE 999999999

STEP BY 1;

B. This task cannot be accomplished.

C. CREATE SEQUENCE patient_id_seq

ON patient (patient_id)

MINVALUE 1000

MAXVALUE 999999999

INCREMENT BY 1

NOCYCLE;

D. CREATE SEQUENCE patient_id_seq

START WITH 1000

MAXVALUE 999999999
NOCYCLE;

Answer: D

QUESTION NO: 132

For which three tasks would you use the WHERE clause? (Choose three.)

A. restrict the rows displayed

B. display only data greater than a specified value

C. restrict the output of a group function

D. designate a table location

E. display only unique data

F. compare two values

Answer: A,B,F

QUESTION NO: 133

You have a view called ANN_SAL that is based on the EMPLOYEE table. The structure of the ANN_SAL
view is:

Name Null? Type

------------------------------- -------------- ----------

EMPNO NOT NULL NUMBER(4)

YEARLY_SAL NUMBER(9,2)
MONTHLY_SAL NUMBER(9,2)

Which statement retrieves data from the ANN_SAL view?

A. SELECT *

FROM VIEW ann_sal BASEDON employee;

B. SELECT *

FROM EMPLOYEE;

C. SELECT *

FROM ann_sal;

D. SELECT *

FROM VIEW ann_sal;

Answer: C

QUESTION NO: 134

The PLAYER table contains these columns:

ID NUMBER(9)

NAME VARCHAR(2)

MANAGER_ID NUMBER(9)

In this instance, managers are players and you need to display a list of players.

Evaluate these two SQL statements:


SELECT p.name, m.name

FROMplayer p, player m

WHEREm.id = p.manager_id;

SELECT p.name, m.name

FROMplayer p, player m

WHEREm.manager_id = p.id;

How will the results differ?

A. The results will be the same, but the display will be different.

B. Statement 1 will execute; statement 2 will not.

C. Statement 1 will not execute; statement 2 will.

D. Statement 1 is self-join; statement 2 is not.

Answer: A

QUESTION NO: 135

Click on the EXHIBIT button and examine the structure of the PRODUCT and PART tables.

You issue this SQL statement:

SELECT pr.name
FROMpart pt, product pr

WHEREpt.product_id(+) = pr.id;

What is the result?

A. A list of products is displayed for parts that have products assigned.

B. A list of all product names is displayed.

C. A list of all products is displayed for products with parts.

D. An error is generated.

Answer: B

QUESTION NO: 136

Which statement is true about nesting blocks?

A. A variable defined in the inner block is visible in the outer blocks.

B. A variable defined in the outer block is visible in the inner blocks.

C. Variable names must be unique between blocks.

D. A variable in an inner block may have the same name as a variable in an outer block only if the data
types are different.
Answer: B

QUESTION NO: 137

Which statement about multiple column subqueries is true?

A. A pairwise comparison produces a cross product.

B. In a pairwise subquery, the values returned from the subquery are compared individually to the
values in the outer query.

C. In a non-pairwise subquery, the values returned from the subquery are compared as a group to the
values in the outer query.

D. A non-pairwise comparison produces a cross product.

Answer: D

QUESTION NO: 138

Examine the code:

SET SERVEROUTPUT ON

DECLARE

v_char_val VARCHAR2(100);

BEGIN

v_char_val := 'Hello World';

DBMS_OUTPUT.PUT_LINE(v_char_val);
END;

SET SERVEROUTPUT OFF

This code is stored in a script file named myproc.sql. Which statement executes the code in the script
file?

A. EXECUTE myproc.sql

B. RUN myproc.sql

C. BEGIN myproc.sql END;

D. myproc.sql

E. START myproc.sql

Answer: E

QUESTION NO: 139

You want to display the average salary for departments 20 and 50, but only if those departments have
an average salary of at least 2000. Which statement will produce the required results?

A. SELECT deptno, AVG(sal)

FROM emp

GROUP BY deptno

HAVING AVG(sal) >= 2000

AND deptno IN (20, 50);

B. SELECT deptno, AVG(sal)

FROM emp
WHERE deptno IN (20, 50)

GROUP BY deptno

HAVING AVG(sal) >= 2000;

C. SELECT deptno, AVG(sal)

FROM emp

WHERE deptno IN (20, 50)

GROUP BY AVG(sal)

HAVING AVG(sal) >= 2000;

D. SELECT deptno, AVG(sal)

FROM emp

WHERE deptno IN (20, 50)

AND AVG(sal) >= 2000

GROUP BY deptno;

Answer: B

QUESTION NO: 140

Click on the EXHIBIT button and examine the employee table.

You attempt to query the database with this command:

SELECT dept_no, last_name, SUM(salary)

FROM employee

WHERE salary < 50000


GROUP BY dept_no

ORDER BY last_name;

Which clause causes an error?

A. WHERE salary < 50000

B. FROM employee

C. ORDER BY last_name

D. GROUP BY dept_no

Answer: D

QUESTION NO: 141

Given this CURSOR statement:

DECLARE

CURSOR query_cursor (v_salary) IS

SELECT last_name, salary, dept_no


FROM employee

WHERE salary > v_salary;

Why does this statement cause an error?

A. A scalar datatype was not specified for the parameter.

B. A WHERE clause is not allowed in a CURSOR statement.

C. The INTO clause is missing from the SELECT statement.

D. The parameter mode was not defined.

Answer: A

QUESTION NO: 142

Which three SQL arithmetic expressions return a date? (Choose three.)

A. ('03-JUL-96' - '04-JUL-97') / 7

B. ('03-JUL-96' - '04-JUL-97') / 12

C. '03-JUL-96' + (12 / 24)

D. '03-JUL-96' - '04-JUL-97'

E. '03-JUL-96' + 7

F. '03-JUL-96' - 12

Answer: C,E,F
QUESTION NO: 143

When selecting data, which statement is valid about projection?

A. Projection allows you to choose columns.

B. Projection allows you to choose rows.

C. Projection allows you to join tables together.

D. Projection allows you to add columns to a table.

Answer: A

QUESTION NO: 144

Which statement describes the use of a group function?

A. A group function produces one result from many rows per group.

B. A group function produces one result from each row of the table.

C. A group function produces a group of results from one row.

D. A group function produces many results from many rows per group.

Answer: A

QUESTION NO: 145

Which datatype should you use for interest rates with varying and unpredictable decimal places, such as
1.234, 3.4, 5, and 1.23?
A. NUMBER(p,s)

B. LONG

C. NUMBER

Answer: C

QUESTION NO: 146

The structure of the DEPT table is as follows:

Name Null? Type

------------------------------- -------- -------

DEPTNO NOT NULL NUMBER(2)

DNAME VARCHAR2(14)

LOC VARCHAR2(13)

Examine the code:

DECLARE

TYPE dept_record_type IS RECORD

(dno NUMBER,

name VARCHAR2(20));

dept_rec dept_record_type;

BEGIN
SELECT deptno, dname

INTO dept_rec

FROM dept

WHERE deptno = 10;

END;

Which statement displays the name of the selected department?

A. DBMS_OUTPUT.PUT_LINE(dept_rec.name);

B. DBMS_OUTPUT.PUT_LINE(dname);

C. DBMS_OUTPUT.PUT_LINE(dept_rec.dname);

D. DBMS_OUTPUT.PUT_LINE(name);

E. DBMS_OUTPUT.PUT_LINE(dept_rec(name));

Answer: A

QUESTION NO: 147

You need to create a report to display the ship date and order totals of your ORDER table. If the order
has not been shipped, your report must display 'Not Shipped'. If the total is not available, your report
must display 'Not Available'.

In the ORDER table, the SHIPDATE column has a datatype of DATE. The TOTAL column has a datatype of
NUMBER.

Which statement do you use to create this report?


A. SELECT ordid, NVL(shipdate, 'Not Shipped'),

NVL(total,'Not Available')

FROM order;

B. SELECT ordid, shipdate "Not Shipped",

total "Not Available"

FROM order;

C. SELECT ordid, NVL(TO_CHAR(shipdate), 'Not Shipped'),

NVL(TO_CHAR(total),'Not Available')

FROM order;

D. SELECT ordid,TO_CHAR(shipdate, 'Not Shipped'),

TO_CHAR(total,'Not Available')

FROM order;

Answer: C

QUESTION NO: 148

Examine the code:

SELECT employee.ename

FROM emp employee

WHERE employee.empno NOT IN

(SELECT manager.mgr

FROM emp manager);


What is the NOT IN operator equivalent to, in the above query?

A. ALL

B. !=ALL

C. NOT LIKE

D. !=

Answer: B

QUESTION NO: 149

The PART table contains these columns:

ID NUMBER(7) PK

COST NUMBER(7,2)

PRODUCT_ID NUMBER(7)

Evaluate these two SQL statements:

1.SELECT ROUND(MAX(cost),2),

ROUND(MIN(cost),2),ROUND(SUM(cost),2),

ROUND(AVG(cost),2)

FROM part;

2.SELECT product_id, ROUND(MAX(cost),2),


ROUND(MIN(cost),2),ROUND(SUM(cost),2),

ROUND(AVG(cost),2)

FROM part

GROUP BY product_id;

How will the results differ?

A. Statement 1 will only display one row of results; statement 2 could display more than one.

B. The results will be the same, but the display will differ.

C. Statement 1 will display a result for each part; statement 2 will display a result for each product.

D. One of the statements will generate an error.

Answer: A

QUESTION NO: 150

Which table name is valid?

A. invoices-1996

B. catch_#22

C. 1996_invoices

D. number

E. #_667

Answer: B
QUESTION NO: 151

In which section of a PL/SQL block is a user-defined exception raised?

A. heading

B. declarative

C. exception handling

D. executable

Answer: D

QUESTION NO: 152

You need to perform a major update on the EMPLOYEE table. You have decided to disable the PRIMARY
KEY constraint on the empid column and the CHECK constraint on the job column.

What happens when you try to enable the constraints after the update is completed?

A. You need to recreate the constraints once they are disabled.

B. The indexes on both the columns with the PRIMARY KEY constraint and the CHECK constraint are
automatically re-created.

C. Any existing rows that do not confirm with the constraints are automatically deleted.

D. All the existing column values are verified to confirm with the constraints and an error message is
generated if any existing values do not confirm.

E. Only the future values are verified to confirm with the constraints, leaving the existing values
unchecked.
Answer: D

QUESTION NO: 153

The structure of the DEPT table is as follows:

Name Null? Type

------------------------------- ------------ --------

DEPTNO NOT NULL NUMBER(2)

DNAME VARCHAR2(14)

LOC VARCHAR2(13)

Examine the declaration section:

DECLARE

TYPE dept_record_type IS RECORD

(dno NUMBER,

name VARCHAR2(20));

dept_rec dept_record_type;

How do you retrieve an entire row of the DEPT table using the DEPT_REC variable?

A. SELECT *

INTO dept_rec.dno, dept_rec.name, dept_rec.loc


FROM dept

WHERE deptno = 10;

B. You can not retrieve the entire row using the DEPT_REC variable declared in the code.

C. SELECT deptno, dname, loc

INTO dept_rec

FROM dept

WHERE deptno = 10;

D. SELECT *

INTO dept_rec

FROM dept

WHERE deptno = 10;

Answer: B

QUESTION NO: 154

You need to update employee salaries. If the salary of an employee is less than 1000, the salary needs to
be incremented by 10%.

Use a SQL*Plus substitution variable to accept the employee number.

Which PL/SQL block successfully updates the salaries?

A. DECLARE

v_sal emp.sal%TYPE;

BEGIN
SELECT sal

INTO v_sal

FROM emp

WHERE empno = &&p_empno;

IF (v_sal < 1000) THEN

UPDATE emp

INTO sal := sal * 1.1

WHERE empno = &p_empno;

END IF;

END;

B. DECLARE

v_sal emp.sal%TYPE;

BEGIN

SELECT sal

INTO v_sal

FROM emp

WHERE empno = &&p_empno;

IF (v_sal < 1000) THEN

UPDATE emp

SET sal = sal * 1.1

WHERE empno = &p_empno;

END IF;

END;

C. DECLARE

v_sal emp.sal%TYPE;
BEGIN

SELECT sal

INTO v_sal

FROM emp

WHERE empno = &&p_empno;

IF (v_sal < 1000) THEN

UPDATE emp

sal := sal * 1.1

WHERE empno = &p_empno;

END IF;

END;

D. DECLARE

v_sal emp.sal%TYPE;

BEGIN

SELECT sal

INTO v_sal

FROM emp

WHERE empno = &&p_empno;

IF (v_sal < 1000) THEN

sal := sal * 1.1;

END IF;

END;

Answer: B
QUESTION NO: 155

Scott forgot his password while on vacation. What command must be executed to set a password for
Scott?

A. Scott must execute the command:

ALTER USER scott

IDENTIFIED BY lion;

B. The DBA must execute the command:

CHANGE PASSWORD TO lion

WHERE USER = 'SCOTT';

C. Scott must execute the command:

ALTER USER scott

PASSWORD BY lion;

D. Scott must execute the command:

CHANGE PASSWORD TO lion

WHERE USER = 'SCOTT';

E. The DBA must execute the command:

ALTER USER scott

IDENTIFIED BY lion;

Answer: E

QUESTION NO: 156

You issue this command:


CREATE PUBLIC SYNONYM emp

FOR ed.employee;

Which task has been accomplished?

A. All users were given object privileges to the table.

B. The need to qualify the object name with its schema has been eliminated for all users.

C. The need to qualify the object name with its schema was eliminated for only you.

D. The object can now be accessed by all users.

Answer: B

QUESTION NO: 157

In the declarative section of a PL/SQL block, you created but did not initialize a number variable. When
the block executes, what will be the initial value of the variable?

A. null

B. It depends on the scale and precision of the variable.

C. The block will not execute because the variable was not initialized.The block will not execute because
the variable was not initialized.

D. 0

Answer: A
QUESTION NO: 158

Which data dictionary view contains the definition of a view?

A. USER_VIEWS

B. SYSTEM_VIEWS

C. USER_TAB_VIEWS

D. MY_VIEWS

Answer: A

QUESTION NO: 159

Which statement is true about nesting blocks?

A. Variable names must be unique between blocks.

B. A variable defined in the outer block is visible in the inner blocks.

C. A variable in an inner block may have the same name as a variable in an outer block only if the data
types are different.

D. A variable defined in the inner block is visible in the outer blocks.

Answer: B

QUESTION NO: 160

Examine the structure of the STUDENT table:


Name Null? Type

------------- ------------- ------------

STUD_ID NOT NULL NUMBER(3)

NAME NOT NULL VARCHAR2(25)

ADDRESS VARCHAR2(50)

GRADUATION DATE

Which statement adds a new column after the NAME column to hold phone numbers?

A. ALTER TABLE student

ADD COLUMN3 (phone varchar2(9));

B. ALTER TABLE student

ADD (phone varchar2(9)) AS COLUMN3;

C. You cannot specify the position where a new column has to be added.

D. ALTER TABLE student

ADD COLUMN phone varchar2(9) POSITION 3;

Answer: C

QUESTION NO: 161

Evaluate these two SQL commands:

1.SELECT DISTINCT object_type


FROM user_objects;

2.SELECT object_type

FROM all_objects;

How will the results differ?

A. Statement 1 will display the distinct object types that the user can access; statement 2 will display all
the object types that the user owns.

B. Statement 1 will display the distinct object types in the database; statement 2 will display all the
object types in the database.

C. Statement 1 will display the distinct object types owned by the user; statement 2 will display all the
object types in the database.

D. Statement 1 will display the distinct object types owned by the user; statement 2 will display all the
object types the user can access.

Answer: D

QUESTION NO: 162

You have decided to permanently remove all the data from the STUDENT table, and you need the table
structure in the future. Which single command performs this?

A. DELETE *

FROM student

KEEP STRUCTURE;

B. DELETE *

FROM student;
C. TRUNCATE TABLE student;

D. TRUNCATE TABLE student

KEEP STRUCTURE;

E. DROP TABLE student;

Answer: C

QUESTION NO: 163

You are updating the employee table. Jane has been granted the same privileges as you on the
employee table. You ask Jane to log on to the database to check your work before you issue a COMMIT
command. What can Jane do to the employee table?

A. Jane can access the table, but she cannot see your changes and cannot make the same changes.

B. Jane cannot access the table.

C. Jane can access the table, but she cannot see your changes. She can make the changes for you.

D. Jane can access the table and verify your changes.

Answer: A

QUESTION NO: 164

Evaluate this IF statement:

IF v_value > 100 THEN

v_new_value := 2 * v_value;

ELSIF v_value > 200 THEN


v_new_value := 3 * v_value;

ELSIF v_value < 300 THEN

v_new_value := 4 * v_value;

ELSE

v_new_value := 5 * v_value;

END IF;

What would be assigned to V_NEW_VALUE if V_VALUE is 250?

A. 250

B. 500

C. 1250

D. 750

E. 1000

Answer: B

QUESTION NO: 165

Examine the code:

SET SERVEROUTPUT ON

DECLARE

v_name emp.ename%TYPE;

v_num NUMBER;
v_sal NUMBER(8,2);

BEGIN

-- This code displays salaries if larger than 10000

SELECT ename, sal

INTO v_name, v_sal

FROM emp

WHERE empno = 101;

IF (v_sal .GT. 10000) THEN

DBMS_OUTPUT.PUT_LINE ('Salary is ' || v_sal

|| ' for employee ' || v_name);

END IF;

END;

SET SERVEROUTPUT OFF

Which statement causes a compilation error when the above PL/SQL block is executed?

A. SELECT ename, sal

INTO v_name, v_sal

FROM emp

WHERE empno = 101;

B. IF (v_sal .GT. 10000) THEN

C. v_name emp.ename%TYPE;

D. v_num NUMBER;

E. -- This code displays salaries if larger than 10000


Answer: B

QUESTION NO: 166

You want to display the details of all employees whose last name is Smith, but you are not sure in which
case the last names are stored. Which statement will list all the employees whose last name is Smith?

A. SELECT lastname, firstname

FROM emp

WHERE UPPER(lastname) = 'smith';

B. SELECT lastname, firstname

FROM emp

WHERE LOWER(lastname) = 'smith';

C. SELECT lastname, firstname

FROM emp

WHERE lastname = UPPER('smith');

D. SELECT lastname, firstname

FROM emp

WHERE lastname = 'smith';

Answer: B

QUESTION NO: 167

The EMPLOYEE table contains these columns:

LAST_NAME VARCHAR2(25)
FIRST_NAME VARCHAR2(25)

SALARY NUMBER(7,2)

You need to display the names of employees that earn more than the average salary of all employees.

Evaluate this SQL statement:

SELECT last_name, first_name

FROMemployee

WHEREsalary > AVG(salary);

Which change should you make to achieve the desired results?

A. Move the function to the SELECT clause and add a GROUP BY clause and a HAVING clause.

B. Move the function to the SELECT clause and add a GROUP BY clause.

C. Use a subquery in the WHERE clause to compare the average salary value.

D. Change the function in the WHERE clause.

Answer: C

QUESTION NO: 168

You are a user of the PROD database which contains over 1000 tables, and you need to determine the
number of tables you can access. Which data dictionary view could you query to display this
information?

A. ALL_OBJECTS
B. DBA_TABLES

C. USER_OBJECTS

D. DBA_SEGMENTS

Answer: A

QUESTION NO: 169

You are updating the employee table. Jane has been granted the same privileges as you on the
employee table. You ask Jane to log on to the database to check your work before you issue a COMMIT
command. What can Jane do to the employee table?

A. Jane can access the table, but she cannot see your changes and cannot make the same changes.

B. Jane can access the table, but she cannot see your changes. She can make the changes for you.

C. Jane can access the table and verify your changes.

D. Jane cannot access the table.

Answer: A

QUESTION NO: 170

You need to create a PL/SQL program to insert records into the employee table. Which block of code
successfully uses the INSERT command?

A. DECLARE

v_hiredate DATE := SYSDATE;

BEGIN
INSERT INTO emp(empno, ename, hiredate, deptno)

(empno_sequence.nextval, '&name', v_hiredate,

&deptno);

END;

B. DECLARE

v_hiredate DATE := SYSDATE;

BEGIN

INSERT INTO emp(empno, ename, hiredate)

VALUES(empno_sequence.nextval, '&name', v_hiredate,

&deptno);

END;

C. DECLARE

v_hiredate DATE := SYSDATE;

BEGIN

INSERT INTO emp(empno, ename, hiredate, deptno)

VALUES(empno_sequence.nextval, '&name', v_hiredate,

&deptno);

END;

D. DECLARE

v_hiredate DATE := SYSDATE;

BEGIN

INSERT INTO emp(empno, ename, hiredate, deptno)

VALUES(empno_sequence.nextval, '&name', v_hiredate,

&deptno)

WHERE job = 'CLERK';


END;

Answer: C

QUESTION NO: 171

Click on the EXHIBIT button and examine the table instance chart for the patient table.

Which script would you use to delete a patient from the table by prompting the user for the id_number
of the patient?

A. DELETE

FROM patient

WHERE id_number = :id_number

B. DELETE

FROM patient

WHERE id_number = &id_number


/

C. DEFINE :id_number

DELETE

FROM patient

WHERE id_number = :id_number

D. This task cannot be accomplished.

E. DELETE

DEFINE &id_number

FROM patient

WHERE id_number = &id_number

Answer: B

Das könnte Ihnen auch gefallen