Monday, March 17, 2008

Oracle Recent Placement Paper 3

See Oracle All Recent and Previous Papers 1 to 7

SQL AND SQL*Plus

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';

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.

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

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;

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.

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. Terminatedd. ACTIVE

SELECT (TO_CHAR(NVL(SQRT(59483), "INVALID")) FROM DUAL is a valid SQL statement.
a. TRUE
b. FALSE

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. DUALD. An Oracle-defined table

Which of the following is not a group function?
a. avg( )
c. sqrt( )
c. sum( )
d. max( )

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

The default character for specifying runtime variables in SELECT statements is
a. Ampersand
b. Ellipses
c. Quotation marks
d. Asterisk

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#;

Developer ANJU executes the following statement: CREATE TABLE animals AS SELECT * fromMASTER.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.

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');

Which three of the following are valid database datatypes in Oracle? (Choose three.)
a. CHAR
b. VARCHAR2
c. BOOLEAN
d. NUMBER

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.

Creating a foreign-key constraint between columns of two tables defined with two different datatypes will produce an error.
a. TRUE
b. FALSE

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.

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.

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.

MAXVALUE is a valid parameter for sequence creation.
a. TRUE
b. FALSE

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.

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

Which two of the following orders are used in ORDER BY clauses? (choose two)
a. ABS
b. ASC
c. DESC
d. DISC

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 firs

PL/SQL

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.

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.

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.

Which three of the following are implicit cursor attributes?
a. %found
b. %too_many_rows
c. %notfound
d. %rowcount
e. %rowtype

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

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.

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

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

CREATE OR REPLACE PROCEDURE find_cpt (v_movie_id {ArgumentMode}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

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)

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

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

CREATE OR REPLACE FUNCTION get_budget(v_studio_id IN NUMBER) RETURN number
ISv_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);

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 UPDAT statement.

CREATE OR REPLACE PROCEDURE calculate_budget IS v_budget studio.yearly_budget%TYPE;
BEGIN
v_budget := get_budget(11);
IF v_budget < yearly_budget =" v_new_budget" id =" v_studio_id;">

No comments: