This set of PL/SQL Multiple Choice Questions & Answers (MCQs) focuses on “PL/SQL Procedure”.
1. Which of the following method is defined as combining different sub-programs to make a larger program?
a) Modular Programming
b) Sub-program Programming
c) Brute Force Programming
d) Divide and Conquer Programming
View Answer
Explanation: The method of combining different sub-programs to form a larger program is known as Modular Programming. A sub-program is basically a part of the program that performs only a particular function.
2. Which of the following statement can be used to create a sub-program at a schema level?
a) CREATE TABLE
b) CREATE PROCEDURE
c) CREATE SUBPROGRAM
d) CREATE PROGRAM
View Answer
Explanation: The CREATE PROCEDURE or the CREATE FUNCTION statements are used to create a sub-program at a schema level. At schema level, a sub-program is created and stored in the database and can be deleted by using the DROP PROCEDURE or the DROP function statement.
3. What is a sub-program called when it is created inside a package?
a) Packaged program
b) Packaged sub-program
c) Packed program
d) Packed sub-program
View Answer
Explanation: A sub-program is called as a packaged sub-program when it is created inside a package. It is stored in the database and can be deleted only when the package is deleted using the DROP PACKAGE statement.
4. A sub-program is called as which of the following when it does not return any value directly?
a) Package
b) Functions
c) Modules
d) Procedures
View Answer
Explanation: Procedures are those sub-programs that does not directly return any value and are used to perform some action. Functions are those sub-programs that directly return any value and are used to perform some computation.
5. In how many parts does a PL/SQL sub-program is divided into?
a) 2
b) 3
c) 4
d) 5
View Answer
Explanation: Every PL/SQL sub-program has a name and every named block has the following 3 parts – Declarative Part, Executable Part and Exception handling Part. From these, only the Executable part is mandatory to write.
6. Which of the following are the 3 parameter modes for a procedure in PL/SQL?
a) IN, OUT, IN OUT
b) LOCAL, GLOBAL, LOCAL GLOBAL
c) READ, WRITE, APPEND
d) CUT, COPY, PASTE
View Answer
Explanation: Parameters are optional part of a procedure definition. IN represents the value that will be passed from inside and OUT represents the parameter that will be used to return a value outside of the procedure. IN OUT is a mixture of both.
7. Which of the following keyword is used to call a standalone procedure?
a) RUN
b) CALL
c) START
d) EXECUTE
View Answer
Explanation: A standalone procedure can be called using the EXECUTE keyword. Its syntax is – EXECUTE procedure_name. A standalone procedure can also be called from another PL/SQL block.
8. Which of the following is the correct syntax for deleting a procedure?
a) DELETE PROCEDURE procedure_name;
b) DELETE procedure_name;
c) DROP PROCEDURE procedure_name;
d) DROP procedure_name;
View Answer
Explanation: The correct syntax for deleting a procedure is –
DROP PROCEDURE procedure_name;
The DROP & PROCEDURE keyword is used followed by the name of the procedure that has to be deleted.
9. Which of the following is a default mode for a parameter when it’s mode is not specified?
a) IN
b) OUT
c) IN OUT
d) Parameter mode must always be specified
View Answer
Explanation: IN is the default mode of parameter passing. It lets you pass a value to the subprogram. It is a read-only parameter. We can pass a constant, literal, initialized variable, or expression as an IN parameter.
10. Which of the following symbol is used in the Named Notation method for passing parameters?
a) ==
b) =
c) =>
d) ⬄
View Answer
Explanation: The => symbol is used in the Named Notation method for passing parameters. The actual parameter is associated with the formal parameter using the arrow symbol ( => ). For Example –
Procedure_name(a => z, b => y, c => x);
Sanfoundry Global Education & Learning Series – PL/SQL.
To practice all areas of PL/SQL, here is complete set of 1000+ Multiple Choice Questions and Answers.