1. Which of the following statements contains an error?
A. SELECT * FROM emp WHERE empid = 493945;
B. SELECT empid FROM emp WHERE empid= 493945;
C. SELECT empid FROM emp;
D. SELECT empid WHERE empid = 56949 AND lastname = 'SMITH';
2. Which of the following correctly describes how to specify a column alias?
A. Place the alias at the beginning of the statement to describe the table.
B. Place the alias after each column, separated by white space, to describe the column.
C. Place the alias after each column, separated by a comma, to describe the column.
D. Place the alias at the end of the statement to describe the table.
3. The NVL function
A. Assists in the distribution of output across multiple columns.
B. Allows the user to specify alternate output for non-null column values.
C. Allows the user to specify alternate output for null column values.
D. Nullifies the value of the column output.
4. Output from a table called PLAYS with two columns, PLAY_NAME and AUTHOR, is shown below. Which of the following SQL statements
produced it?
PLAY_TABLE
-------------------------------------
"Midsummer Night's Dream", SHAKESPEARE
"Waiting For Godot", BECKETT
"The Glass Menagerie", WILLIAMS
A. SELECT play_name || author FROM plays;
B. SELECT play_name, author FROM plays;
C. SELECT play_name||', ' || author FROM plays;
D. SELECT play_name||', ' || author PLAY_TABLE FROM plays;
5. Issuing the DEFINE_EDITOR="emacs" will produce which outcome?
A. The emacs editor will become the SQL*Plus default text editor.
B. The emacs editor will start running immediately.
C. The emacs editor will no longer be used by SQL*Plus as the default text editor.
D. The emacs editor will be deleted from the system.
6. The user issues the following statement. What will be displayed if the EMPID selected is 60494?
SELECT DECODE(empid,38475, "Terminated",60494, "LOA", "ACTIVE") FROM emp;
A. 60494
B. LOA
C. Terminated
D. ACTIVE
7. SELECT (TO_CHAR(NVL(SQRT(59483), "INVALID")) FROM DUAL is a valid SQL statement.
A. TRUE
B. FALSE
8. The appropriate table to use when performing arithmetic calculations on values defined within the SELECT statement (not pulled from a table column) is
A. EMP
B. The table containing the column values
C. DUAL
D. An Oracle-defined table
9. Which of the following is not a group function?
A. avg( )
B. sqrt( )
C. sum( )
D. max( )
10. Once defined, how long will a variable remain so in SQL*Plus?
A. Until the database is shut down
B. Until the instance is shut down
C. Until the statement completes
D. Until the session completes
11. The default character for specifying runtime variables in SELECT statements is
A. Ampersand
B. Ellipses
C. Quotation marks
D. Asterisk
12. A user is setting up a join operation between tables EMP and DEPT. There are some employees in the EMP table that the user wants returned by the query, but the employees are not assigned to departments yet. Which SELECT statement is most appropriate for this user?
A. select e.empid, d.head from emp e, dept d;
B. select e.empid, d.head from emp e, dept d where e.dept# = d.dept#;
C. select e.empid, d.head from emp e, dept d where e.dept# = d.dept# (+);
D. select e.empid, d.head from emp e, dept d where e.dept# (+) = d.dept#;
13. Developer ANJU executes the following statement: CREATE TABLE animals AS SELECT * from MASTER.ANIMALS; What is the effect of this
statement?
A. A table named ANIMALS will be created in the MASTER schema with the same data as the ANIMALS table owned by ANJU.
B. A table named ANJU will be created in the ANIMALS schema with the same data as the ANIMALS table owned by MASTER.
C. A table named ANIMALS will be created in the ANJU schema with the same data as the ANIMALS table owned by MASTER.
D. A table named MASTER will be created in the ANIMALS schema with the same data as the ANJU table owned by ANIMALS.
14. User JANKO would like to insert a row into the EMPLOYEE table, which has three columns: EMPID, LASTNAME, and SALARY. The user would
like to enter data for EMPID 59694, LASTNAME Harris, but no salary. Which statement would work best?
A. INSERT INTO employee VALUES (59694,'HARRIS', NULL);
B. INSERT INTO employee VALUES (59694,'HARRIS');
C. INSERT INTO employee (EMPID, LASTNAME, SALARY) VALUES (59694,'HARRIS');
D. INSERT INTO employee (SELECT 59694 FROM 'HARRIS');
15. Which three of the following are valid database datatypes in Oracle? (Choose three.)
A. CHAR
B. VARCHAR2
C. BOOLEAN
D. NUMBER
16. Omitting the WHERE clause from a DELETE statement has which of the following effects?
A. The delete statement will fail because there are no records to delete.
B. The delete statement will prompt the user to enter criteria for the deletion
C. The delete statement will fail because of syntax error.
D. The delete statement will remove all records from the table.
17. Creating a foreign-key constraint between columns of two tables defined with two different datatypes will produce an error.
A. TRUE
B. FALSE
18. Dropping a table has which of the following effects on a nonunique index created for the table?
A. No effect.
B. The index will be dropped.
C. The index will be rendered invalid.
D. The index will contain NULL values.
19. To increase the number of nullable columns for a table,
A. Use the alter table statement.
B. Ensure that all column values are NULL for all rows.
C. First increase the size of adjacent column datatypes, then add the column.
D. Add the column, populate the column, then add the NOT NULL constraint.
20. Which line of the following statement will produce an error?
A. CREATE TABLE goods
B. (good_no NUMBER,
C. good_name VARCHAR2 check(good_name in (SELECT name FROM avail_goods)),
D. CONSTRAINT pk_goods_01
E. PRIMARY KEY (goodno));
F. There are no errors in this statement.
21. MAXVALUE is a valid parameter for sequence creation.
A. TRUE
B. FALSE
22. Which of the following lines in the SELECT statement below contain an error?
A. SELECT DECODE(empid, 58385, "INACTIVE", "ACTIVE") empid
B. FROM emp
C. WHERE SUBSTR(lastname,1,1) > TO_NUMBER('S')
D. AND empid > 02000
E. ORDER BY empid DESC, lastname ASC;
F. There are no errors in this statement.
23. Which function below can best be categorized as similar in function to an IF-THEN-ELSE statement?
A. SQRT
B. DECODE
C. NEW_TIME
D. ROWIDTOCHAR
24. Which two of the following orders are used in ORDER BY clauses? (choose two)
A. ABS
B. ASC
C. DESC
D. DISC
25. You query the database with this command
SELECT name FROM employee WHERE name LIKE `_a%';
Which names are displayed?
A. Names starting with "a"
B. Names starting with "a" or "A"
C. Names containing "a" as second character
D. Names containing "a" as any letter except the first
PL/SQL
26. Which of the following statements is true about implicit cursors?
A. Implicit cursors are used for SQL statements that are not named.
B. Developers should use implicit cursors with great care.
C. Implicit cursors are used in cursor for loops to handle data processing.
D. Implicit cursors are no longer a feature in Oracle.
27. Which of the following is not a feature of a cursor FOR loop?
A. Record type declaration.
B. Opening and parsing of SQL statements.
C. Fetches records from cursor.
D. Requires exit condition to be defined.
28. A developer would like to use referential datatype declaration on a variable. The variable name is EMPLOYEE_LASTNAME, and the corresponding table and column is EMPLOYEE, and LNAME, respectively. How would the developer define this variable using referential datatypes?
A. Use employee.lname%type.
B. Use employee.lname%rowtype.
C. Look up datatype for EMPLOYEE column on LASTNAME table and use that.
D. Declare it to be type LONG.
29. Which three of the following are implicit cursor attributes?
A. %found
B. %too_many_rows
C. %notfound
D. %rowcount
E. %rowtype
30. If left out, which of the following would cause an infinite loop to occur in a simple loop?
A. LOOP
B. END LOOP
C. IF-THEN
D. EXIT
31. Which line in the following statement will produce an error?
A. cursor action_cursor is
B. select name, rate, action
C. into action_record
D. from action_table;
E. There are no errors in this statement.
32. The command used to open a CURSOR FOR loop is
A. open
B. fetch
C. parse
D. None, cursor for loops handle cursor opening implicitly.
33. What happens when rows are found using a FETCH statement
A. It causes the cursor to close
B. It causes the cursor to open
C. It loads the current row values into variables
D. It creates the variables to hold the current row values
34. CREATE OR REPLACE PROCEDURE find_cpt
(v_movie_id {Argument Mode} NUMBER, v_cost_per_ticket {argument
mode} NUMBER)
IS
BEGIN
IF v_cost_per_ticket > 8.5 THEN
SELECT cost_per_ticket
INTO v_cost_per_ticket
FROM gross_receipt
WHERE movie_id = v_movie_id;
END IF;
END;
Which mode should be used for V_COST_PER_TICKET?
A. IN
B. OUT
C. RETURN
D. IN OUT
35. CREATE OR REPLACE TRIGGER update_show_gross
{trigger information}
BEGIN
{additional code}
END;
The trigger code should only execute when the column, COST_PER_TICKET, is greater than $3.75. Which trigger information will you add?
A. WHEN (new.cost_per_ticket > 3.75)
B. WHEN (:new.cost_per_ticket > 3.75
C. WHERE (new.cost_per_ticket > 3.75)
D. WHERE (:new.cost_per_ticket > 3.75)
36. What is the maximum number of handlers processed before the PL/SQL block is exited when an exception occurs?
A. Only one
B. All that apply
C. All referenced
D. None
37. For which trigger timing can you reference the NEW and OLD qualifiers?
A. Statement and Row
B. Statement only
C. Row only
D. Oracle Forms trigger
38. CREATE OR REPLACE FUNCTION get_budget(v_studio_id IN NUMBER)RETURN number IS v_yearly_budget NUMBER;
BEGIN
SELECT yearly_budget
INTO v_yearly_budget
FROM studio
WHERE id = v_studio_id;
RETURN v_yearly_budget;
END;
Which set of statements will successfully invoke this function within SQL*Plus?
A. VARIABLE g_yearly_budget NUMBER EXECUTE g_yearly_budget := GET_BUDGET(11);
B. VARIABLE g_yearly_budget NUMBER EXECUTE :g_yearly_budget := GET_BUDGET(11);
C. VARIABLE :g_yearly_budget NUMBER EXECUTE :g_yearly_budget := GET_BUDGET(11);
D. VARIABLE g_yearly_budget NUMBER :g_yearly_budget := GET_BUDGET(11);
39.CREATE OR REPLACE PROCEDURE update_theater(v_name IN VARCHAR2, v_theater_id IN NUMBER) IS
BEGIN
UPDATE theater
SET name = v_name
WHERE id = v_theater_id;
END update_theater;
When invoking this procedure, you encounter the error:ORA-00001: Unique constraint(SCOTT.THEATER_NAME_UK) violated.How should you modify the function to handle this error?
A. An user defined exception must be declared and associated with the error code and handled in the EXCEPTION section.
B. Handle the error in EXCEPTION section by referencing the error code directly.
C. Handle the error in the EXCEPTION section by referencing the UNIQUE_ERROR predefined exception.
D. Check for success by checking the value of SQL%FOUND immediately after the UPDATE statement.
40.CREATE OR REPLACE PROCEDURE calculate_budget IS v_budget studio.yearly_budget%TYPE;
BEGIN
v_budget := get_budget(11);
IF v_budget < 30000000 THEN
set_budget(11,30000000);
END IF;
END;
You are about to add an argument to CALCULATE_BUDGET. What effect will this have?
A. The GET_BUDGET function will be marked invalid and must be recompiled before the next execution.
B. The SET_BUDGET function will be marked invalid and must be recompiled before the next execution.
C. Only the CALCULATE_BUDGET procedure needs to be recompiled.
D. All three procedures are marked invalid and must be recompiled.
41. Which procedure can be used to create a customized error message?
A. RAISE_ERROR
B. SQLERRM
C. RAISE_APPLICATION_ERROR
D. RAISE_SERVER_ERROR
42. The CHECK_THEATER trigger of the THEATER table has been
disabled. Which command can you issue to enable this trigger?
A. ALTER TRIGGER check_theater ENABLE;
B. ENABLE TRIGGER check_theater;
C. ALTER TABLE check_theater ENABLE check_theater;
D. ENABLE check_theater;
43. Examine this database trigger
CREATE OR REPLACE TRIGGER prevent_gross_modification
{additional trigger information}
BEGIN
IF TO_CHAR(sysdate,'DY') = `MON' THEN
RAISE_APPLICATION_ERROR(-20000,'Gross receipts cannot be ` ||
`deleted on Monday');
END IF;
END;
This trigger must fire before each DELETE of the GROSS_RECEIPT table. It should fire only once for the entire DELETE statement. What additional information must you add?
A. BEFORE DELETE ON gross_receipt
B. AFTER DELETE ON gross_receipt
C. BEFORE (gross_receipt DELETE)
D. FOR EACH ROW DELETED FROM gross_receipt
44. Examine this function
CREATE OR REPLACE FUNCTION set_budget
(v_studio_id IN NUMBER, v_new_budget IN NUMBER) IS
BEGIN
UPDATE studio
SET yearly_budget = v_new_budget
WHERE id = v_studio_id;
IF SQL%FOUND THEN
RETURN TRUEl;
ELSE
RETURN FALSE;
END IF;
COMMIT;
END;
Which code must be added to successfully compile this function?
A. Add "RETURN;" right before the "IS" keyword.
B. Add "RETURN number" right before the "IS" keyword.
C. Add "RETURN boolean" right after the "IS" keyword.
D. Add "RETURN boolean" right before the "IS" keyword.
45. Under which circumstance must you recompile the package body after recompiling the package specification?
A. Altering the argument list of one of the package constructs
B. Any change made to one of the package constructs
C. Any SQL statement change made to one of the package constructs
D. Removing a local variable from the DECLARE section of one of the package constructs
46. Procedure and Functions are explicitly executed. This is different from a database trigger. When is a database trigger executed?
A. When the transaction is committed
B. During the data manipulation statement
C. When an Oracle supplied package references the trigger
D. During a data manipulation statement and when the transaction is committed
47. Which Oracle supplied package can you use to output values and messages from database triggers, stored procedures and functions within SQL*Plus?
A. DBMS_DISPLAY
B. DBMS_OUTPUT
C. DBMS_LIST
D. DBMS_DESCRIBE
48. What occurs if a procedure or function terminates with failure without being handled?
A. Any DML statements issued by the construct are still pending and can be committed or rolled back.
B. Any DML statements issued by the construct are committed
C. Unless a GOTO statement is used to continue processing within the BEGIN section, the construct terminates.
D. The construct rolls back any DML statements issued and returns the unhandled exception to the calling environment.
49. Examine this code
BEGIN
theater_pck.v_total_seats_sold_overall :=
theater_pck.get_total_for_year;
END;
For this code to be successful, what must be true?
A. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist only in the body of the
THEATER_PCK package.
B. Only the GET_TOTAL_FOR_YEAR variable must exist in the specification of the THEATER_PCK package.
C. Only the V_TOTAL_SEATS_SOLD_OVERALL variable must exist in the specification of the THEATER_PCK package.
D. Both the V_TOTAL_SEATS_SOLD_OVERALL variable and the GET_TOTAL_FOR_YEAR function must exist in the specification of the
THEATER_PCK package.
50. A stored function must return a value based on conditions that are determined at runtime. Therefore, the SELECT statement cannot be hard-coded and must be created dynamically when the function is executed. Which Oracle supplied package will enable this feature?
A. DBMS_DDL
B. DBMS_DML
C. DBMS_SYN
D. DBMS_SQL
No comments:
Post a Comment