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
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
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
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.
4. PL/SQL cannot contain SQL code inside it.
a) True
b) False
View Answer
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)
EXCEPTIONS DECLARE BEGIN END
c)
BEGIN DECLARE EXCEPTIONS END
d)
DECLARE BEGIN EXCEPTIONS END
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
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
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.line
b) dbms_output.put
c) dbms_output.put_line
d) utl_file.put_line
View Answer
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
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
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.