wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PL/SQL Concepts Quiz

Total questions: 20

Worksheet time: 10mins

Name
Class
Date
1.

What is the benefit of using a FOR loop with a cursor in PL/SQL?

a)

Requires manual fetch and close

b)

Better for DDL statements

c)

Automatically opens, fetches, and closes the cursor

d)

Supports dynamic SQL

2.

Why use a REF cursor in PL/SQL?

a)

To return static result sets only

b)

To return dynamic result sets from queries

c)

For use with DDL only

d)

To optimize exception handling

3.

Which statement is true about stored procedures?

a)

They must return a value

b)

They are only executed from SQL*Plus

c)

They can accept IN, OUT, IN OUT parameters

d)

They cannot contain exception handling

4.

Which of the following is true about PL/SQL functions?

a)

They return multiple values

b)

They cannot use parameters

c)

They must return a single value

d)

They cannot include SQL queries

5.

What should be ensured when performing DML operations inside overloaded procedures or functions?

a)

Avoid transactions

b)

Only SELECT statements are allowed

c)

Proper logic separation and use of autonomous transactions if needed

d)

DML is not supported in overloaded functions

6.

What is one key feature of PL/SQL packages?

a)

They store binary data

b)

They compile on every call

c)

They encapsulate procedures, functions, and variables

d)

They cannot have global variables

7.

What is the difference between a package specification and a body?

a)

The spec is not visible to users

b)

The body defines the implementation

c)

The spec includes logic

d)

There is no difference

8.

What does PRAGMA AUTONOMOUS_TRANSACTION do?

a)

Makes transaction dependent on the caller

b)

Rolls back after completion

c)

Allows the block to commit or rollback independently

d)

Prevents DML operations

9.

Which trigger type allows data validation before insert?

a)

AFTER INSERT

b)

BEFORE INSERT

c)

INSTEAD OF INSERT

d)

DDL Trigger

10.

What is a typical use case of an INSTEAD OF trigger?

a)

Preventing SQL injection

b)

Allowing DML on views

c)

Logging DDL changes

d)

Handling compilation errors

11.

How can the mutating table error be resolved in row-level triggers?

a)

Using INSTEAD OF triggers

b)

By disabling the trigger

c)

Writing all logic in SQL

d)

Committing inside the trigger

12.

What is a PL/SQL record?

a)

A database table

b)

A single variable

c)

A user-defined composite data type

d)

A system-defined array

13.

Which collection type allows string-based indexing?

a)

VARRAY

b)

Nested Table

c)

Associative Array

d)

CLOB

14.

What is the use of BULK COLLECT in PL/SQL?

a)

To slow down data fetches

b)

To fetch multiple rows into collections in a single context switch

c)

To validate data types

d)

To group multiple exceptions

15.

FORALL is used with BULK COLLECT for:

a)

Reading CLOB data

b)

DDL execution

c)

Improving performance in DML operations

d)

Declaring cursors

16.

What is the purpose of WHEN OTHERS THEN in PL/SQL?

a)

To catch no exceptions

b)

To catch user-defined exceptions only

c)

To catch all raised exceptions

d)

To stop function execution

17.

What package is commonly used to execute dynamic SQL in PL/SQL?

a)

DBMS_SQL

b)

UTL_FILE

c)

DBMS_RANDOM

d)

DBMS_ALERT

18.

What's the main purpose of using bind variables in dynamic SQL?

a)

For styling output

b)

For logging SQL

c)

For performance and avoiding SQL injection

d)

For enabling row locks

19.

What differentiates a PL/SQL function from a procedure?

a)

Procedures are only for triggers

b)

Functions can't be reused

c)

Functions return a value; procedures don't

d)

Functions are always slower

20.

Which of the following is true about global temporary tables in Oracle?

a)

Data persists after the session ends

b)

Structure and data are both temporary

c)

Data is session or transaction-specific

d)

They can't be used in PL/SQL blocks