0% found this document useful (0 votes)
8 views4 pages

PLSQL MCQ

The document provides a 20-question PL/SQL Oracle practice quiz formatted for easy entry into online quiz tools. Each question includes multiple-choice options and indicates the correct answer. The quiz covers various core concepts of PL/SQL, including blocks, exceptions, cursors, and collections.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

PLSQL MCQ

The document provides a 20-question PL/SQL Oracle practice quiz formatted for easy entry into online quiz tools. Each question includes multiple-choice options and indicates the correct answer. The quiz covers various core concepts of PL/SQL, including blocks, exceptions, cursors, and collections.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

While I can't directly create a Google Form or a "Google Quiz," I can provide you with the 20 PL/SQL

questions in a clean, copy-and-paste format that you can easily use to create your quiz manually in
Google Forms or any other online quiz tool.
Here is your 20-question PL/SQL Oracle practice quiz reformatted for easy entry:
PL/SQL Oracle Core Concepts Quiz (20 Questions)
Question 1
Which of the following is the only mandatory section in a minimal anonymous PL/SQL block?
* A. DECLARE
* B. BEGIN and END
* C. EXCEPTION
* D. COMMENT
(Correct Answer: B)
Question 2
Which attribute is used to declare a variable with the exact data type and size of a specific column in a
database table?
* A. %ROWTYPE
* B. %TYPE
* C. TYPE
* D. COLUMN_TYPE
(Correct Answer: B)
Question 3
Which of the following PL/SQL predefined exceptions is raised when a SELECT INTO statement returns
no rows?
* A. TOO_MANY_ROWS
* B. NO_DATA_FOUND
* C. VALUE_ERROR
* D. DML_ERROR
(Correct Answer: B)
Question 4
What is the key functional difference between a PL/SQL Function and a Procedure?
* A. A Procedure can contain DML statements, but a Function cannot.
* B. A Function must return exactly one value to the calling environment, while a Procedure does not
have to.
* C. A Procedure can accept parameters, but a Function cannot.
* D. A Function is stored in the database, but a Procedure is not.
(Correct Answer: B)
Question 5
Which of the following is NOT a valid parameter mode for a PL/SQL stored program unit (Procedure or
Function)?
* A. IN
* B. OUT
* C. IN OUT
* D. RETURN
(Correct Answer: D)
Question 6
Which PL/SQL loop structure is guaranteed to execute its body at least once?
* A. WHILE loop
* B. FOR loop (numeric)
* C. Simple LOOP...END LOOP
* D. FOR loop (cursor)
(Correct Answer: C)
Question 7
What is the primary characteristic of an Implicit Cursor in PL/SQL?
* A. It is declared by the programmer in the DECLARE section.
* B. It is used for SELECT statements that return multiple rows.
* C. It is automatically managed by Oracle for all DML and single-row SELECT INTO statements.
* D. It must be explicitly opened and closed by the programmer.
(Correct Answer: C)
Question 8
How can a user-defined exception be associated with a specific Oracle error number (-20000 to -20999)
to provide a descriptive error message?
* A. By using the EXCEPTION_INIT pragma.
* B. By using the RAISE statement followed by the error number.
* C. By calling the procedure DBMS_ERROR.RAISE_ERROR.
* D. By calling the procedure RAISE_APPLICATION_ERROR.
(Correct Answer: D)
Question 9
In the context of Oracle PL/SQL, what is the primary purpose of a Package?
* A. To execute anonymous PL/SQL blocks as a single transaction.
* B. To force a database commit after every DML statement.
* C. To group related procedures, functions, variables, and cursors into a single named unit.
* D. To define the physical storage characteristics of a table or index.
(Correct Answer: C)
Question 10
Which component of a PL/SQL Package defines the interface (publicly accessible items) and is required?
* A. Package Body
* B. Package Specification
* C. Package Header
* D. Package Global Area
(Correct Answer: B)
Question 11
What is the name of the PL/SQL command used to execute a string that contains a DDL or DML
statement that cannot be parsed at compile time?
* A. RUN_SQL_STRING
* B. EXECUTE IMMEDIATE
* C. PARSE_AND_RUN
* D. OPEN CURSOR FOR
(Correct Answer: B)
Question 12
A BEFORE STATEMENT trigger fires:
* A. Once for every row affected by the DML statement, before the data is changed.
* B. Once after the entire DML statement has been processed and committed.
* C. Once per DML statement, before the statement is executed and regardless of the number of rows
affected.
* D. Only if the DML statement affects no rows.
(Correct Answer: C)
Question 13
When working with Explicit Cursors, which attribute would you check to determine if the last FETCH
statement successfully returned a row?
* A. cursor_name%ISOPEN
* B. cursor_name%ROWCOUNT
* C. cursor_name%FOUND
* D. cursor_name%ERROR
(Correct Answer: C)
Question 14
Which PL/SQL construct is best suited for storing and manipulating a collection of elements that are
sequentially indexed by integers, starting from 1, and whose size is fixed when declared?
* A. Nested Table
* B. Associative Array (Index-By Table)
* C. Varray (Variable-Size Array)
* D. PL/SQL Record
(Correct Answer: C)
Question 15
What happens if an unhandled exception occurs in the executable section of a PL/SQL stored function?
* A. The function returns a NULL value, and execution continues in the calling environment.
* B. The function automatically performs a database COMMIT and then terminates.
* C. The function is aborted, and the exception is propagated to the calling environment, halting its
execution.
* D. The function simply prints the error message to the console and continues execution.
(Correct Answer: C)
Question 16
What is the purpose of the SET SERVEROUTPUT ON; command in a client environment like SQL*Plus or
SQL Developer?
* A. To enable the output of DML statements like '1 row updated'.
* B. To allow the PL/SQL engine to use system resources for compilation.
* C. To display any data written using the DBMS_OUTPUT.PUT_LINE procedure.
* D. To start a new database transaction.
(Correct Answer: C)
Question 17
Which of the following describes the key benefit of using a Cursor FOR Loop over an Explicit Cursor with
manual OPEN, FETCH, and CLOSE statements?
* A. It automatically performs a database COMMIT after every iteration.
* B. It avoids the need to declare the cursor record variable and automatically manages the cursor
lifecycle.
* C. It can be used with DML statements (INSERT, UPDATE, DELETE) to process multiple rows faster.
* D. It is the only type of loop that can handle more than 1000 rows of data.
(Correct Answer: B)
Question 18
What is the correct way to declare a PL/SQL variable named v_total of data type NUMBER, initialized to
100?
* A. v_total NUMBER := 100;
* B. v_total NUMBER = 100;
* C. v_total := NUMBER 100;
* D. DECLARE v_total NUMBER DEFAULT 100;
(Correct Answer: A)
Question 19
When defining a PL/SQL Constant, which of the following keywords must be used?
* A. IMMUTABLE
* B. CONST
* C. CONSTANT
* D. READONLY
(Correct Answer: C)
Question 20
If you need to define a collection of objects that are indexed by a non-sequential, alphanumeric key (like
a country code or name), which collection type is the most appropriate?
* A. Varray
* B. Associative Array (Index-by Table)
* C. Nested Table
* D. PL/SQL Table
(Correct Answer: B)

You might also like