PL/SQL Questions and Answers – PL/SQL Basics

This set of PL/SQL Multiple Choice Questions & Answers (MCQs) focuses on “PL/SQL Basics”.

1. What is the full form of PL in PL/SQL?
a) Programming Language
b) Procedural Language
c) Programming Logic
d) Procedural Logic
View Answer

Answer: b
Explanation: PL in PL/SQL stands for Procedural Language. It is a block structured language that enables developers to combine the power of SQL with procedural language.

2. PL/SQL can execute a number of queries in one single block using a single command.
a) True
b) False
View Answer

Answer: a
Explanation: Yes, PL/SQL can execute a number of queries in one single block using a single command. All the statements in the block are passed to the oracle engine all at once to increase the processing speed and reduce traffic.

3. Which of the following feature is provided by PL/SQL to handle the exceptions occurred in the PL/SQL block?
a) Error Handling Block
b) Error Removing Block
c) Exception Handling Block
d) Exception Removing Block
View Answer

Answer: c
Explanation: The Exception handling block is the feature that helps the user to find and remove any exceptions that are found in the PL/SQL block.
advertisement
advertisement

4. PL/SQL cannot contain SQL code inside it.
a) True
b) False
View Answer

Answer: b
Explanation: Since, PL/SQL is an extension of SQL so it can contain the SQL code inside it. But, the vice-versa is not true as SQL cannot contain the PL/SQL code inside it.

5. Which of the following option represent the correct structure of a block in PL/SQL?
a)

DECLARE
EXCEPTIONS
BEGIN
END

b)

advertisement
EXCEPTIONS
DECLARE
BEGIN
END

c)

advertisement
BEGIN
DECLARE
EXCEPTIONS
END

d)

DECLARE
BEGIN
EXCEPTIONS
END
View Answer
Answer: d
Explanation: The basic unit in PL/SQL is a block. A block has the following structure –
DECLARE – declaration statements
BEGIN – executable statements
EXCEPTIONS – exception handling statements
END

6. Which of the following pair of block structures is mandatory to include in a PL/SQL block?
a) BEGIN, END
b) DECLARE, END
c) EXCEPTIONS, BEGIN
d) EXCEPTIONS, END
View Answer

Answer: a
Explanation: The BEGIN and END keywords are mandatory to include in a PL/SQL block. They are included within the execution section of the block which is a mandatory section to write. In this section the program logic is written to perform any task like loops and conditional statements.

7. Which of the following operator is used to assign values to a variable in PL/SQL?
a) =
b) ==
c) :=
d) =:
View Answer

Answer: c
Explanation: In PL/SQL, := operator, also known as assignment operator, is used to assign values to a variable. It is different from the assignment operator for SQL which is =.

8. Which of the following command is used to direct the PL/SQL output to a screen?
a) dbms_output.put_line
b) dbms_output.put_line
c) dbms_output.put_line
d) dbms_output.put_line
View Answer

Answer: b
Explanation: The command dbms_output.put_line is used to direct the PL/SQL output to a screen. The variable that has to be printed is passed inside the brackets like – dbms_output.put_line (var).

9. “PL/SQL procedure successfully completed” is printed when the code is compiled and executed successfully.
a) True
b) False
View Answer

Answer: a
Explanation: “PL/SQL procedure successfully completed” is printed every time when the code is compiled and executed successfully. Even if there is no additional output or there is an additional output, this statement is always displayed at last.

10. Which of the following symbol is used to denote a single line comment in PL/SQL?
a) /* – – – */
b) */ – – – */
c) //
d) – –
View Answer

Answer: d
Explanation: The – – symbol is used to start any single line comment in PL/SQL. /* – – – */ is used to write any multi line comment.

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.