PL SQL MCQ Questions

PL SQL MCQ Questions. These 100 Multiple Choice Questions on PL/SQL will help you score full marks in your exam & interview.

1. Introduction to PL/SQL

1.1 What is PL/SQL?

Show Explanation

Correct Answer: B. Procedural Language/Structured Query Language (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. Increased code complexity. PL/SQL actually reduces code complexity by allowing for modularization and code reuse. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: D. All of the above (PL SQL MCQ Questions by Top100MCQ.com)

   

1.2 PL/SQL Architecture

Show Explanation

Correct Answer: B. It sends SQL statements to the SQL engine for execution. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Compilation, Execution (PL SQL MCQ Questions by Top100MCQ.com)

   

1.3 PL/SQL Block Structure

Show Explanation

Correct Answer: C. EXCEPTION (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. To handle runtime errors (PL SQL MCQ Questions by Top100MCQ.com)

   

1.4 Lexical Units

Show Explanation

Correct Answer: C. Variable. While variables are important in PL/SQL, they are not considered lexical units. Lexical units are the basic building blocks of the language’s syntax, such as identifiers, delimiters, literals, and comments. (PL SQL MCQ Questions by Top100MCQ.com)

   

2. Data Types and Variables

2.1 Scalar Data Types

Show Explanation

Correct Answer: B. NUMBER (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: D. 32767 characters (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. BOOLEAN (PL SQL MCQ Questions by Top100MCQ.com)

   

2.2 Composite Data Types

Show Explanation

Correct Answer: C. A structured data type that groups together related variables of different data types (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Using dot notation (.) (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. To improve the performance of queries that access the table (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Their size is fixed at the time of declaration. (PL SQL MCQ Questions by Top100MCQ.com)

   

PL SQL MCQ Questions

2.3 LOB Datatypes

Show Explanation

Correct Answer: C. CLOB (PL SQL MCQ Questions by Top100MCQ.com)

   

2.4 Variable Declaration and Initialization

Show Explanation

Correct Answer: A. To assign a default value to the variable (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. By using the `NOT NULL` keyword in the variable declaration (PL SQL MCQ Questions by Top100MCQ.com)

   

3. Operators and Expressions

3.1 Arithmetic Operators

Show Explanation

Correct Answer: A. 20. Multiplication (`*`) has higher precedence than addition (`+`). (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. **. (PL SQL MCQ Questions by Top100MCQ.com)

   

3.2 Relational Operators

Show Explanation

Correct Answer: B. != and C. Both are valid ways to express “not equal to” in PL/SQL. (PL SQL MCQ Questions by Top100MCQ.com)

   

3.3 Logical Operators

Show Explanation

Correct Answer: A. TRUE. Both conditions (`x 5`) are true, and the `AND` operator requires both conditions to be true for the entire expression to be true. (PL SQL MCQ Questions by Top100MCQ.com)

   

3.4 String Operators

Show Explanation

Correct Answer: C. || (PL SQL MCQ Questions by Top100MCQ.com)

   

3.5 Operator Precedence

Show Explanation

Correct Answer: D. `NOT`. Logical NOT has the highest precedence in this expression. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. 9.  Following order of operations: `3 * 2 = 6`, `4 / 2 = 2`, `5 + 6 = 11`, `11 – 2 = 9`. (PL SQL MCQ Questions by Top100MCQ.com)

   

4. Control Structures

4.1 Conditional Statements

Show Explanation

Correct Answer: D. All of the above.  Both `IF-THEN-ELSIF-ELSE` and `CASE` statements allow for testing multiple conditions. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. To execute a block of code if the initial IF condition is false (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. A simple CASE statement compares an expression to specific values, while a searched CASE statement evaluates a series of boolean conditions. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. END CASE (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. Only one (PL SQL MCQ Questions by Top100MCQ.com)

   

4.2 Loops

Show Explanation

Correct Answer: A. LOOP. The basic `LOOP` statement executes the code within its block before checking the condition for exiting the loop. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. FOR loop.  The `FOR loop` is designed for iterating over a predefined sequence of numbers. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. To immediately terminate the loop (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. To skip the current iteration and proceed to the next (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. A loop that contains another loop within its code block (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Cursor FOR loop (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. This will result in a syntax error. A `WHEN` condition is required to specify the condition for exiting the loop. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. GOTO. While some languages use `GOTO` for loop control, PL/SQL does not. It relies on `EXIT`, `CONTINUE`, and `EXIT WHEN`. (PL SQL MCQ Questions by Top100MCQ.com)

   

5. Working with Cursors

5.1 What are Cursors?

Show Explanation

Correct Answer: B. A mechanism for retrieving and processing multiple rows from a quer (PL SQL MCQ Questions by Top100MCQ.com)

  y

Show Explanation

Correct Answer: D. To process data one row at a time (PL SQL MCQ Questions by Top100MCQ.com)

   

5.2 Implicit Cursors

Show Explanation

Correct Answer: B. A cursor that is automatically created by PL/SQL for DML statements (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. `%ROWCOUNT` (PL SQL MCQ Questions by Top100MCQ.com)

   

5.3 Explicit Cursors

Show Explanation

Correct Answer: C. Declaring the cursor (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. `USING` (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. To retrieve data from the cursor (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. An exception is raised (PL SQL MCQ Questions by Top100MCQ.com)

   

6. Procedures and Functions

6.1 Creating Procedures

Show Explanation

Correct Answer: C. To modularize code and improve reusabilit (PL SQL MCQ Questions by Top100MCQ.com)

  y

Show Explanation

Correct Answer: B. `OUT` (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. The procedure in which it is declared (PL SQL MCQ Questions by Top100MCQ.com)

   

6.2 Creating Functions

Show Explanation

Correct Answer: B. A function must return a value, while a procedure does not have to. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. `RETURN` (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. No, a function cannot have OUT parameters. Functions are primarily designed to return a single value using the `RETURN` statement. (PL SQL MCQ Questions by Top100MCQ.com)

   

6.3 Calling Procedures and Functions

Show Explanation

Correct Answer: B. By using the procedure’s name followed by a semicolon (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. By using the function’s name in the `SELECT` list (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. It is perfectly acceptable to call a procedure from within a function. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. A variable.  IN OUT parameters require a variable so that the procedure can modify the value and return it to the calling block. (PL SQL MCQ Questions by Top100MCQ.com)

   

7. Exception Handling

7.1 Predefined Exceptions

Show Explanation

Correct Answer: A. An exception raised when a SELECT statement returns no rows (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. `TOO_MANY_ROWS` (PL SQL MCQ Questions by Top100MCQ.com)

   

7.2 User-defined Exceptions

Show Explanation

Correct Answer: A. Using the `EXCEPTION` keyword in the `DECLARE` section (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. `RAISE` (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. To create custom error conditions specific to your application logic (PL SQL MCQ Questions by Top100MCQ.com)

   

7.3 Exception Handling Blocks

Show Explanation

Correct Answer: A. `WHEN OTHERS` (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. To re-raise the exception in a higher-level block (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. The program terminates with an error message. (PL SQL MCQ Questions by Top100MCQ.com)

   

8. Packages

8.1 What are Packages?

Show Explanation

Correct Answer: A. A collection of related procedures, functions, and variables (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: D. All of the above (PL SQL MCQ Questions by Top100MCQ.com)

   

8.2 Package Specification

Show Explanation

Correct Answer: C. To declare the public interface of the package (PL SQL MCQ Questions by Top100MCQ.com)

   

8.3 Package Body

Show Explanation

Correct Answer: B. To provide the implementation for the procedures and functions declared in the package specification (PL SQL MCQ Questions by Top100MCQ.com)

   

8.4 Using Packages

Show Explanation

Correct Answer: A. By using the package name followed by the procedure or function name, separated by a dot (.) (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. It will result in a compilation error. Private elements are intentionally hidden and can only be accessed from within the package itself. (PL SQL MCQ Questions by Top100MCQ.com)

   

9. Triggers

9.1 What are Triggers?

Show Explanation

Correct Answer: C. A block of code that is automatically executed in response to a database event (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: D. All of the above (PL SQL MCQ Questions by Top100MCQ.com)

   

9.2 Trigger Types

Show Explanation

Correct Answer: A. DML trigger (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. To replace the default action of a DML statement (PL SQL MCQ Questions by Top100MCQ.com)

   

9.3 Triggering Events

Show Explanation

Correct Answer: A. `BEFORE` (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. The trigger will fire once for each row affected by the DML statement. (PL SQL MCQ Questions by Top100MCQ.com)

   

9.4 Creating Triggers

Show Explanation

Correct Answer: D. `ON COMMIT`. While `ON COMMIT` is a valid concept in database systems, it’s not directly associated with the trigger types in PL/SQL. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. The original values of the row before the DML statement (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. The new values of the row after the DML statement (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Yes, triggers can call stored procedures. (PL SQL MCQ Questions by Top100MCQ.com)

   

10. Collections and Records

10.1 Nested Tables

Show Explanation

Correct Answer: B. A collection that can store a variable number of elements of the same data type (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. Using the `TABLE OF` clause (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. A nested table can be resized dynamically, while a VARRAY has a fixed size. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Using array indices enclosed in parentheses (PL SQL MCQ Questions by Top100MCQ.com)

   

10.2 VARRAYS

Show Explanation

Correct Answer: B. A collection that can store a fixed number of elements of the same data type (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Using the `VARRAY` keyword followed by the size and data type of the elements (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. A runtime exception is raised. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Using the `SIZE` attribute (PL SQL MCQ Questions by Top100MCQ.com)

   

10.3 Associative Arrays (Index-By Tables)

Show Explanation

Correct Answer: B. A collection that uses strings or numbers as keys to access its elements (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: D. All of the above (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. `INDEX BY` (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. Both numeric and string values (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. By assigning a value to an element using its ke (PL SQL MCQ Questions by Top100MCQ.com)

  y

Show Explanation

Correct Answer:   C. `SUBSCRIPT_BEYOND_COUNT` (PL SQL MCQ Questions by Top100MCQ.com)

   

10.4 Records

Show Explanation

Correct Answer: B. A composite data type that groups together related variables of different data types (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: C. Using the `RECORD` keyword followed by the field definitions (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Using dot notation (.) (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: B. Yes, records can be nested to create complex data structures. (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: A. To declare a record with the same structure as a row in a database table (PL SQL MCQ Questions by Top100MCQ.com)

   

Show Explanation

Correct Answer: D. All of the above (PL SQL MCQ Questions by Top100MCQ.com)

   

Most Asked Important Questions on PL/SQL

What is PL/SQL?

PL/SQL (Procedural Language/Structured Query Language) is Oracle Corporation’s procedural extension for SQL. It’s a powerful language used to write application logic within the Oracle database.

What are some common data types in PL/SQL?

PL/SQL supports various data types, including:
NUMBER: For storing numeric values.
VARCHAR2: For storing character strings.
DATE: For storing date and time values.
BOOLEAN: For storing logical values (TRUE or FALSE).

What are the basic components of a PL/SQL block?

PL/SQL code is organized into blocks. A basic block has three parts:
Declaration: Defines variables, constants, and other elements.
Execution: Contains the actual code to be executed.
Exception Handling: Handles runtime errors.

What are the benefits of PL/SQL?

Improved performance: Reduces network traffic by sending blocks of code to the database server.
Increased productivity: Offers a wide range of built-in functions and features.
Integration with SQL: Seamlessly combines procedural and SQL statements.
Error handling: Provides robust exception handling mechanisms.

Read Also: Fundamentals of Computer MCQs

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top