0% found this document useful (0 votes)
116 views

PL - SQL Interview and Exam Questions

1. An anonymous block of PL/SQL can be used in a trigger, procedure, function, or package. 2. In a nested if statement using elsif, there will be as many end if statements as there are if/elsif statements. 3. In a PL/SQL block, DML, DDL, and DCL statements can be used. The document discusses various aspects of PL/SQL including anonymous blocks, nested if statements, allowed statements, cursors, exceptions, procedures, functions, packages and triggers.

Uploaded by

Shruthi
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
116 views

PL - SQL Interview and Exam Questions

1. An anonymous block of PL/SQL can be used in a trigger, procedure, function, or package. 2. In a nested if statement using elsif, there will be as many end if statements as there are if/elsif statements. 3. In a PL/SQL block, DML, DDL, and DCL statements can be used. The document discusses various aspects of PL/SQL including anonymous blocks, nested if statements, allowed statements, cursors, exceptions, procedures, functions, packages and triggers.

Uploaded by

Shruthi
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 6

1.

An anonymous block of PL/SQL may be used in


a) A trigger
b) A procedure
c) A function
d) A package
2. In a nested if statement using elsif there will be
a) As many end if s as there are if/elsif s
b) Only one endif
c) Only one end if
d) Two end if s
3. In a PL/SQL block we may not use
a) Select with into option
b) DML statements
c) DDL statements
d) DCL statements
4. A cursor in PL/SQL defined to
a) Hold result of query of multiple rows
b) Save memory wastage
c) Optimise disk usage
d) Reserve memory for future use
5. A cursor when declared, the area is reserved in
a) Disk
b) Table space
c) Data dictionary
d) Memory
6. A user defined exception in a PL/SQL block is
a) Automatically declared and raised
b) To be declared and raised
c) To be declared only
d) To be raised only
7. The iterative statement not defined in PL/SQL is
a) Numeric for loop
b) While
c) Do While
d) Loop
8. A procedure created using create procedure command is stored in
a) User default table space
b) The table space specified by the user
c) Data dictionary
d) Home directory of the user
9. Which of the following statement is true with procedures and functions
a) A procedure does not return a value
b) A function does not return a value
c) A value is attached to the procedure name
d) A value is attached to the function name
10. The OUT parameter of a procedure may be a
a) PL/SQL variable
b) Form variable
c) Column of a table
d) None of the above
11. When an extension is raised after executing the error handler the
a) Control remains in the current block
b) Control comes out of the current block
c) Control goes back to the block where error occurred
d) Program gets terminated.
12. Which of the following statement is true about package
a) Packages can be nested
b) You can pass parameters to package
c) A package is loaded into memory each time it is invoked
d) The contents of package can be shared by many applications
13. Which two programming constructs can be grouped within a package
a) Cursors,Constants
b) Triggers, Cursors
c) Sequence,Views
d) Constants,Views
14. Which two statements describe the state of a package variable after executing
the package in which it is declared
a) It persists across transactions with in a session
b) It persists from session to session for the same user
c) It does not persist across transaction within a session
d) It persists from user to user when the package is invoked
15. Choose the TRUE statements
a) Few triggers needs to be called explicitly
b) Procedures can be used in arithmetic expressions
c) If errors occur during the compilation of a trigger, the trigger is still
created
d) If errors occur during the compilation of a function the function is still
created.
16. Which of the following determines the number of times the trigger body
executes
a) Trigger Type
b) Trigger Body
c) Trigger Event
d) Trigger Timing
17. Which of the following is true about Package
a) Both the specification and body are required components of package
b) The package specification is optional, but the package body is required
c) The package specification is required , but the package body is
optional
d) The specification and body of the package are stored together in the
database.
18. Which statement about Triggers is true
a) You use an application trigger to fire when a DELETE statement occurs
b) You use a database trigger to fire when an INSERT statement occurs
c) You use a system event trigger to fire when an UPDATE statement occurs
d) You use INSTEAD OF trigger to fire when a SELECT statement occurs.
19. A CALL statement inside a trigger body allows you to call
a) A package
b) A stored function
c) A stored Procedure
d) A database trigger
20. A variable declaration with %type allows the creation of a variable that is of
a) same type as a specified column in a table
b) same type as a row in a table
c) Array
d) Any record type
21.OLD and NEW qualifiers can be used in which type of trigger
a)Row level System trigger
b)Row level DML trigger
c) Statement level DML trigger
d) Statement level application trigger
22. Which of the following is not a part of PL/SQLs block structure
a) a declarative part
b) a definition part
c) an executable part,
d) an exception-handling part
23. What are the components of a PL/SQL block ?
a. Define, Start , Exception , End
b. Declare, Begin, Exception, End
c. Declare, Start, Exception , End.
d. Declare, Begin , Excecution , End.
24. The % TYPE provides the data type of
a. row of a table
b. row of a view
c. columns selected in the cursor
d. variable or database column
e. row in a cursor
25. An implicit cursor is the one which is automatically
a. created by Oracle cursor
b. maintained by oracle server
c. created when the database is created
d. maintained by the application program
e. defined and created when a view is created.
26. A named private SQL area is called as
a. Work area
b. Cursor
c. Data bench
d. Sql stage
e. Data stage
27. The %ISOPEN is
a. Property of explicit cursor
b. Method of implicit cursor
c. Attribute of a cursor
d. attribute of explicit cursor
e. attribute of implicit cursor
28. The cursors created by the user are called as
a. Implicit cursors
b. Explicit cursors
c. User cursors
d. Exclusive cursors
e. Custom cursors

29. A PL/SQL procedure can have the parameters in one of the following modes.

a. INNER
b. INOUT
c. OUTER
d. INT
e. INTOUT

30. The PL/SQL statement that is used to get the records from the database with
a query is
a. OPEN statement
b. GETRECORD statement
c. READRECORD statement
d. RECORDFETCH statement
e. FETCH statement

31. Which of the following attribute of a cursor represents the number of the
records processed?
a. %RECORDCOUNT
b. % ROWSIZE
c. % ROWSCOUNT
d. % ROWCOUNT
e. % TABLEROWCOUNT
32. The cursor attribute used to check if rows are fetched
a. %FOUND
b. %NOTFOUND
c. %FETCHED
d. %ROWSFOUND
e. %ROWSFETCHED
33. Read the following PL/SQL code
declare
cursor c1 is select ename from emp;
employee c1%rowtype;
x number(2) := 0;
begin
open c1;
fetch c1 into employee;
while x < 40 loop
dbms_output.put_line (employee.ename);
fetch c1 into employee;
x := x + 1;
end loop;
end;
The data type of the variable employee is same as that of the
a. Row of the %rowtype
b. Ename in the emp table
c. Column of the emp table
d. Row of the emp table
e. RecordType of the emp table
34. A cursor is defined in the
a. Code block
b. Begin component
c. Declare component
d. Exception component
e. Procedure component
35. When there is no corresponding handler for an Exception
a. The PL/SQL block regenerates the exception
b. Oracle server handles the Exception
c. The PL/SQL block terminates and exception propagated to
calling environment
d. Terminates the application program
e. Default exception handlers handle the exception
36. Read the following PL/SQL code
DECLARE
CURSOR product_cur IS
SELECT * FROM products FOR UPDATE OF price;
BEGIN
FOR product_rec IN product_cur
LOOP
UPDATE products SET product_price = (product_rec.price = 0.97)
WHERE CURRENT OF product_cur
END LOOP;
END;
The product_rec is of the data type of a
a. %ROWTYPE of products
b. %ROWTYPE of product_cur
c. %ROWTYPE of product_record
d. %RECORD type of products table
e. row of the products table

37. Which of the following is most commonly handled exception


a. NO_ROWS_FOUND
b. NO_DATA_FOUND
c. FEW_ROWS
d. NO_TABLE_FOUND
e. NO_VIEW_FOUND
38. Read the following PL/SQL code
DECLARE
CURSOR books_cursor IS SELECT * FROM BOOKS;
BEGIN
FOR book_rec IN books_cursor
LOOP
UPDATE books SET price = (book_rec.price = 0.34)
WHERE CURRENT OF book_cursor`
END LOOP;
END;
The book_cursor is
a. explicit cursor
b. Implicit cursor
c. Custom cursor
d. Default cursor
e. Exclusive cursor
39. The OTHERS part in the EXCEPTION block is processed
a. Every time
b. When all the other exceptions fail to handle the exception
c. When no exception handler is defined for the exception
d. irrespective of whether there is a handler defined
e. every exception handler
40. Which of the following gets executed automatically?
a. Procedure
b. Function
c. Trigger
d. Anonymous Pl/SQL block
Answers
1. A
2. C
3. D
4. A
5. D
6. B
7. C
8. C
9. D
10. A
11. B
12. D
13. A
14. A
15. C
16. A
17. C
18. B
19. C
20. A
21. B
22. C
23. B
24. D
25. B
26. B
27. E
28. B
29. B
30. E
31. D
32. A
33. D
34. C
35. C
36. E
37. A
38. A
39. C
40. C

You might also like