|
Placement
Papers
>>
Database
>>
Linux Admin
Interview
Questions
1.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.
2.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.
3.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.
4.Which three of
the following are implicit cursor attributes?
a.%found
b.%too_many_rows
c.%notfound
d.%rowcount
e.%rowtype
5.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
6.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.
7.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.
8.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
9.Read the
following code:
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
10.Read the following code:
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. 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)
11.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
12.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
13.Read the
following code:
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);
14.CREATE OR
REPLACE PROCEDURE update_theater
(v_name IN VARCHAR 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-000: 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.
15.Read the following code:
CREATE OR REPLACE PROCEDURE calculate_budget IS
v_budget studio.yearly_budget%TYPE;
BEGIN
v_budget := get_budget(11);
IF v_budget < 30000
THEN
set_budget(11,30000000);
END IF;
END;
a.You are about to add an argument to CALCULATE_BUDGET. What
effect will this have?
b.The GET_BUDGET
function will be marked invalid and must be recompiled before
the next execution.
c.The SET_BUDGET function will be marked invalid and must be
recompiled before the next execution.
d.Only the CALCULATE_BUDGET procedure needs to be recompiled.
All three procedures are marked invalid and must be
recompiled.
16.Which
procedure can be used to create a customized error message?
a.RAISE_ERROR
b.SQLERRM
c.RAISE_APPLICATION_ERROR
d.RAISE_SERVER_ERROR
17.The
CHECK_THEATER trigger of the THEATER table has been disabled.
Which command can you issue to enable this trigger?
1.ALTER TRIGGER check_theater ENABLE;
2.ENABLE TRIGGER check_theater;
3.ALTER TABLE check_theater ENABLE check_theater;
4.ENABLE check_theater;
18.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
19.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.
20.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
21.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
22.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
23.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 d.BEGIN section, the construct terminates.
The construct rolls back any DML statements issued and
returns the unhandled exception to the calling environment.
24.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.
25.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
|