[go: up one dir, main page]

0% found this document useful (0 votes)
52 views3 pages

PLSQL Test 25-1

The document contains questions about PL/SQL concepts like stored procedures, exceptions, cursors, triggers, and packages. A stored procedure is stored in compiled form in the database, can be called from all client environments, and is a sequence of SQL or PL/SQL statements that performs a specific function. Exceptions in PL/SQL are used to handle runtime errors, and user-defined exceptions must be declared and raised explicitly. Cursors hold temporary query results and are used to retrieve multiple rows. Packages in PL/SQL encapsulate and organize code, making it more modular and maintainable.

Uploaded by

spider14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
52 views3 pages

PLSQL Test 25-1

The document contains questions about PL/SQL concepts like stored procedures, exceptions, cursors, triggers, and packages. A stored procedure is stored in compiled form in the database, can be called from all client environments, and is a sequence of SQL or PL/SQL statements that performs a specific function. Exceptions in PL/SQL are used to handle runtime errors, and user-defined exceptions must be declared and raised explicitly. Cursors hold temporary query results and are used to retrieve multiple rows. Packages in PL/SQL encapsulate and organize code, making it more modular and maintainable.

Uploaded by

spider14
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 3

1.

A Database Procedure is stored in the Database


a) In compiled form
b) As source code
c) Both A & B
d) Not stored

2. What does a COMMIT statement do to a CURSOR


a) Open the Cursor
b) Fetch the Cursor
c) Close the Cursor
d) None of the above

3. Which of the following is TRUE


1) Host variables are declared anywhere in the program
2) Host variables are declared in the DECLARE section

a) Only 1 is TRUE
b) Only 2 is TRUE
c) Both 1 & 2are TRUE
d) Both are FALSE

4. Which of the following is NOT VALID is PL/SQL


a) Bool boolean;
b) NUM1, NUM2 number;
c) deptname dept.dname%type;
d) date1 date := sysdate

5. Which of the following is not correct about an Exception ?


a) Raised automatically / Explicitly in response to an ORACLE_ERROR
b) An exception will be raised when an error occurs in that block
c) Process terminates after completion of error sequence.
d) A Procedure or Sequence of statements may be processed.

6. Which of the following is not correct about User_Defined Exceptions ?


a) Must be declared
b) Must be raised explicitly
c) Raised automatically in response to an Oracle error
d) None of the above

7. A Stored Procedure is a
a) Sequence of SQL or PL/SQL statements to perform specific function
b) Stored in compiled form in the database
c) Can be called from all client environmets
d) All of the above

8. Which of the following statement is false


a) Any procedure can raise an error and return an user message and error number
b) Error number ranging from 20000 to 20999 are reserved for user defined messages
c) Oracle checks Uniqueness of User defined errors
d) Raise_Application_error is used for raising an user defined error.

9. Which of the following is not correct about Cursor ?


a) Cursor is a named Private SQL area
b) Cursor holds temporary results
c) Cursor is used for retrieving multiple rows
d) SQL uses implicit Cursors to retrieve rows

10. Which of the following is NOT VALID in PL/SQL ?


a) Select ... into
b) Update
c) Create
d) Delete

11. Is it possible to open a cursor which is in a Package in another procedure ?


a) Yes
b) No

12. Is it possible to use Transactional control statements in Database Triggers ?


a) Yes
b) No

13. Is it possible to Enable or Disable a Database trigger ?


a) Yes
b) No

14. PL/SQL supports datatype(s)


a) Scalar datatype
b) Composite datatype
c) All of the above
d) None of the above

15. Declare
a number := 5; b number := null; c number := 10;
Begin
if a > b AND a < c then
a := c * a;
end if;
End;

What will be the value of ‘a’ after execution ?

a) 50
b) NULL
c) 5
d) None of the above

16. Does the Database trigger will fire when the table is TRUNCATED ?
a) Yes
b) No

17. What are the different events in Triggers ?


a) Define, Create
b) Drop, Comment
c) Insert, Update, Delete
d) All of the above

18. What is the purpose of the RAISE statement in PL/SQL?

a) To raise an error automatically.


b) To raise a user-defined exception.
c) To execute a SELECT statement.
d) To exit a loop.

19. How do you define a parameterized cursor in PL/SQL?

a) CURSOR cursor_name IS SELECT * FROM table_name;


b) CURSOR cursor_name(parameter_type) IS SELECT * FROM table_name;
c) CURSOR cursor_name(parameter_type data_type) IS SELECT * FROM table_name;
d) CURSOR cursor_name(parameter_type data_type) FOR SELECT * FROM table_name;

20. What is the difference between a stored procedure and a stored function in
PL/SQL?

a) A stored procedure can return a value, while a stored function cannot.


b) A stored function can execute DML statements, while a stored procedure cannot.
c) A stored procedure must return a value, while a stored function is optional.
d) A stored function can return a value, while a stored procedure cannot.

21. What is the purpose of the PRAGMA EXCEPTION_INIT in PL/SQL?

a) To handle predefined exceptions.


b) To associate an exception with a user-defined error code.
c) To define the data type of an exception.
d) To suppress error messages in the output.

22. Which PL/SQL loop is used to iterate over a range of values using a numeric
index?

a) FOR loop
b) WHILE loop
c) DO WHILE loop
d) LOOP loop

23. Which of the following is true about a package body in PL/SQL?

a) It contains only private procedures and functions.


b) It is optional and not required for a package to work.
c) It defines the public interface of the package.
d) It contains the actual implementation of the procedures and functions defined
in the package specification.

24. What is the primary advantage of using a package in PL/SQL?

a) It simplifies the SQL syntax.


b) It allows for the creation of temporary tables.
c) It provides data encryption.
d) It encapsulates code, making it more modular and maintainable.

25. How can you log errors to a custom error log table in PL/SQL?

a) By using the RAISE statement with a custom error code.


b) By using the INSERT statement within an EXCEPTION block.
c) By using the DBMS_OUTPUT.PUT_LINE procedure.
d) By using the PRINT statement.

You might also like