|
SQL AND
SQL*Plus
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
ORACLE written will be of 60
questions.
30 Technical + 30 objective type (GRE pattern)
TEchnical part
===========
Mainly of C, C++, ORACLE
SQL, PL/SQL, DBMS, RDBMS and
symbolic representation of tables, column and its
relationship(its in our DBMS syllabus).
30 objective
=========
GRE pattern. All analytical & mathematical oriented
problems. Also comprehensions and little bit of verbal
ability.
Anyway, today I went to Oracle Walk-in (of course, not
to attend the test, but to accompany my friend..:-)) to
Krishnaswamy school where walk-in was scheduled.
Many people turned out there and the test was held (in 3
batches) in reasonably good manner.
They selected around 80 people for interviews to be held
in Taj.
My friend also got selected for interview tomorrow...:-)
Test was quite easy...
60 minutes
15 questions on Oracle
15 questions on C programming
30 questions on Aptitude
Oracle questions are mainly on Triggers, Cursors etc.
(Simple Questions like what is the output of "Select *
from dual" )
For selection, they followed the same procedure
mentioned in the mail sent.
But in addition to that, they wanted at least 70 % in 10
th and Intermediate also.
Hope this info will be useful for someone writing the
Oracle test in future.
1. precedence of PL/SQL
2.in an employee table consisting of empid and supid to
get
supervisor id for employee (something like this related
to ans. self
join) we would use
Intersect
union
join
subquery
3.The order of execution in corelated queries
Inner query executes first then outer query
Outer query executes first then inner query
each row of inner query is evaluated with outer query
each row of outer query is evaluated with inner query
4.declare
i Number
j Number
k Number
begin
i:=0
for j = 1..5
i:=i+1;
j:=j+1;k:=i+j+k;
..........
5.function of ROLLUP and CUBE
6.Based on Group by clause rule that it should contain
column found
in select clause
7.Can procedure in a package be overloaded
8.public void static main(String []args)
{
String s1=new String("test");
String s2=new String("test");
if(s1==s2)
System.out.println("Both are equal");
Boolean b1=new Boolean("true");
Boolean b2=new Boolean("false");
if(b1.equals(b2))
System.out.println("some message");
}
output=?
9.
x=7;
y=0;
if(x=y)y=7;
else
y=5;
what is the value of y
10.Threading in java a prg was given in which it had no
exceptions
and run function had string as its parameter
a.runtime error
b.compile time error
c.
d.
11.what fuction can be repeated instead of comment
....
{
public void aMethod(String S,int i);
//here
....
}
a.public void aMethod(int i ,String S);
b.public void aMethod(String myobj,int j);
c.public int aMethod(String S,int i);
d.public void AMethod(String S,int i);
12.Encapsulation is implemented by
a.private variables and public methods
b.private variables and private methods
c.public variables and public methods
d.protected members
13.Based on scope of a variable
14.Recursive fuction are used to
a.call itself
b.call other functions
c.return integers
d....
15.
int a[]={0,1,2,3,4,5}
int *pa=a;
which of the following is not the correct way to access
a.a[5]
b.*(a+5)
c.*(pa+5)
d.*(*pa+5)
16.
struct{
char emp[12];
int mpno;
}e;
struct e a[2]={{jack,2},{raj,8},{jill,2}}
struct e *p;
*p=a;p+=2
......
17.AVL tree is a balanced binary search tree
18.order of B+tree
19.Disadvantage of indexed sequential file
20.queue can be called as full even if its capacity
is'nt.
|