PL/SQL Questions and Answers – PL/SQL Procedure

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

Answer: a
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

Answer: b
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

Answer: b
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.
advertisement
advertisement

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

Answer: d
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

Answer: b
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

Answer: a
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

Answer: d
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.
advertisement

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

Answer: c
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.

advertisement

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

Answer: a
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

Answer: c
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.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.