Wednesday, April 30, 2008

New Oracle Placements PL/SQL

New Oracle Placements PL/SQL

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.

0 comments: