Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

PL/SQL Quiz

Total questions: 60

Worksheet time: 30mins

Name
Class
Date
1.

PL/SQL is an extension of:

a)

Java

b)

C++

c)

SQL

d)

Python

2.

What is the correct order of a PL/SQL block?

a)

DECLARE, BEGIN, EXCEPTION, END

b)

BEGIN, DECLARE, END

c)

DECLARE, BEGIN, END, EXCEPTION

d)

EXCEPTION, BEGIN, DECLARE, END

3.

The symbol for assignment in PL/SQL is:

a)

==

b)

=

c)

:=

d)

=>

4.

Single-line comment in PL/SQL is indicated by:

a)

--

b)

/*

c)

//

5.

BOOLEAN datatype can store:

a)

Numbers

b)

Characters

c)

TRUE, FALSE, NULL

d)

Dates

6.

The operator for concatenation in PL/SQL is:

a)

&

b)

||

7.

To print output in PL/SQL, which built-in package is used?

a)

PUT_LINE

b)

PRINT

c)

DBMS_OUTPUT

d)

OUTPUT_DBMS

8.

The keyword to end a PL/SQL block is:

a)

STOP

b)

EXIT

c)

END

d)

CLOSE

9.

Conditional checking in PL/SQL is performed using:

a)

LOOP

b)

IF-ELSE

c)

SWITCH

d)

CASE-ELSE

10.

%TYPE attribute is used to:

a)

Declare new types

b)

Match datatype of existing table columns

c)

Create new tables

d)

Delete columns

11.

A PL/SQL variable must start with:

a)

Letter

b)

Digit

c)

Symbol

d)

Underscore

12.

Which statement terminates loops?

a)

CLOSE

b)

STOP

c)

EXIT

d)

END LOOP

13.

The keyword to declare a constant in PL/SQL:

a)

FIXED

b)

STATIC

c)

CONSTANT

d)

DEFINE

14.

Which is a valid CASE statement syntax?

a)

CASE THEN END

b)

IF CASE END

c)

CASE WHEN THEN ELSE END CASE

d)

CASE IF ELSE END

15.

In PL/SQL, exception handling is done by:

a)

IGNORE

b)

TRY

c)

HANDLE

d)

EXCEPTION

16.

Character set symbols in PL/SQL can include:

a)

Letters only

b)

Digits only

c)

Symbols like @, #, %, etc.

d)

Spaces only

17.

Multi-line comments are enclosed in:

a)

-- and --

b)

// and //

c)

/* and */

d)

and

18.

Which is true about PL/SQL blocks?

a)

It supports only procedural statements

b)

It supports only SQL

c)

Combines SQL with procedural statements

d)

None of the above

19.

PL/SQL's advantage is that it:

a)

Increases network traffic

b)

Reduces network traffic

c)

Does not handle errors

d)

Is not portable

20.

What keyword defines a variable scope in a nested block?

a)

NEST

b)

LOCAL

c)

DECLARE

d)

PRIVATE

21.

Cursor is essentially:

a)

A database

b)

A pointer to result set

c)

A table

d)

An array

22.

%ROWTYPE is used for:

a)

Declaring a record type

b)

Creating new rows

c)

Deleting rows

d)

Counting rows

23.

Explicit cursors must be:

a)

Automatically opened

b)

Manually created by Oracle

c)

Manually opened and closed

d)

Automatically closed

24.

Implicit cursors handle:

a)

Only SELECT statements

b)

INSERT, UPDATE, DELETE, single-row SELECT

c)

Multiple-row SELECT only

d)

None of the above

25.

Cursor attribute to check cursor open status:

a)

%FOUND

b)

%NOTFOUND

c)

%ISOPEN

d)

%ROWCOUNT

26.

Cursor is declared with:

a)

DECL cursor IS query;

b)

CURSOR cursorname IS select_query;

c)

CREATE CURSOR;

d)

OPEN CURSOR;

27.

Parameterized cursors:

a)

Can be opened once

b)

Can be opened multiple times with different parameters

c)

Cannot accept parameters

d)

Do not use parameters

28.

FOR UPDATE clause is used to:

a)

Open cursor

b)

Fetch cursor data

c)

Close cursor

d)

Lock rows for updates or deletions

29.

WHERE CURRENT OF clause:

a)

References first row of cursor

b)

References current row of cursor

c)

References last row of cursor

d)

Does not reference rows

30.

Cursor FOR LOOP automatically:

a)

Declares cursor

b)

Opens and closes cursor

c)

Handles exceptions

d)

Updates cursor

31.

Closing cursors improperly:

a)

Frees resources immediately

b)

Keeps resources allocated until session ends

c)

Does not affect resources

d)

Frees resources after transaction ends

32.

To fetch data from a cursor:

a)

FETCH FROM cursor

b)

SELECT FROM cursor

c)

FETCH cursor INTO variables

d)

GET cursor data

33.

Cursor attribute returning number of rows processed:

a)

%ISOPEN

b)

%FOUND

c)

%NOTFOUND

d)

%ROWCOUNT

34.

Explicit cursors must NOT be used for:

a)

SELECT statements

b)

DML operations

c)

Complex queries

d)

Multiple-row operations

35.

Cursor operations sequence:

a)

OPEN, DECLARE, FETCH, CLOSE

b)

FETCH, OPEN, CLOSE, DECLARE

c)

DECLARE, OPEN, FETCH, CLOSE

d)

CLOSE, OPEN, FETCH, DECLARE

36.

Cursor is a reserved:

a)

Function

b)

Method

c)

Procedure

d)

Work area

37.

Implicit cursor attribute after UPDATE:

a)

CSR%FOUND

b)

CSR%ROWCOUNT

c)

CSR%NOTFOUND

d)

SQL%ROWCOUNT

38.

Explicit cursors can:

a)

Automatically fetch data

b)

Explicitly fetch data

c)

Only handle single row

d)

Cannot fetch data

39.

Cursor attribute indicating no data fetched:

a)

%FOUND

b)

%NOTFOUND

c)

%ISOPEN

d)

%ROWCOUNT

40.

Cursor data is known as:

a)

Table

b)

Set

c)

Active data set

d)

Active table

41.

Exceptions handle:

a)

Logical errors only

b)

Runtime errors

c)

Syntax errors only

d)

Compilation errors

42.

RAISE statement:

a)

Ends block execution

b)

Raises exception

c)

Declares exception

d)

Prevents exceptions

43.

User-defined exceptions require:

a)

Automatic raising

b)

No declaration

c)

Explicit declaration

d)

None

44.

Oracle built-in error NO_DATA_FOUND is:

a)

ORA-06501

b)

ORA-01476

c)

ORA-06502

d)

ORA-01403

45.

SQLCODE returns:

a)

Negative error code

b)

Positive code

c)

Message text

d)

No value

46.

PRAGMA EXCEPTION_INIT binds:

a)

Error number to exception

b)

Variable to exception

c)

Cursor to exception

d)

Table to exception

47.

General name for unnamed errors:

a)

ALL_ERRORS

b)

ERROR_LIST

c)

OTHERS

d)

NONE

48.

Error ORA-01476 indicates:

a)

Invalid number

b)

No data found

c)

Zero divide

d)

Rowtype mismatch

49.

Built-in exceptions:

a)

Must be manually raised

b)

Are raised automatically by Oracle

c)

Have no error number

d)

Cannot be caught

50.

PL/SQL error messages returned by:

a)

ERRMSG

b)

SQLERROR

c)

SQLERRM

d)

ERRORMSG

51.

What occurs when an exception happens in PL/SQL?

a)

PL/SQL immediately terminates without a message.

b)

Control passes to the calling program.

c)

Control passes to the exception handler.

d)

Program continues executing normally.

52.

Which built-in exception is raised if no rows are returned by a SELECT INTO statement?

a)

TOO_MANY_ROWS

b)

PROGRAM_ERROR

c)

ACCESS_INTO_NULL

d)

NO_DATA_FOUND

53.

Which attribute returns the error message associated with the error code?

a)

SQLCODE

b)

SQLMESSAGE

c)

SQLERROR

d)

SQLERRM

54.

Which error code range can be used for user-defined unnamed exceptions?

a)

-10000 to -19999

b)

-20000 to -20999

c)

-21000 to -21999

d)

-22000 to -22999

55.

What is used to explicitly raise a user-defined exception?

a)

EXCEPTION_INIT

b)

PRAGMA_EXCEPTION

c)

RAISE

d)

SQLERRM

56.

PRAGMA EXCEPTION_INIT binds an error number to which of the following?

a)

Cursor names

b)

Built-in exceptions

c)

Variables

d)

User-defined exceptions

57.

Which keyword is used to handle exceptions not explicitly named?

a)

SQLERRM

b)

SQLCODE

c)

OTHERS

d)

DEFAULT

58.

What statement is correct regarding user-defined exceptions?

a)

Cannot be named.

b)

Automatically handled by Oracle.

c)

Must be explicitly declared by the user.

d)

Only used for built-in errors.

59.

When are built-in errors automatically raised by Oracle?

a)

When a user explicitly raises them.

b)

During normal execution without issues.

c)

Whenever Oracle encounters a predefined error condition.

d)

Only during database shutdown.

60.

How is the error message displayed for unnamed user-defined exceptions?

a)

Using the SQLCODE attribute.

b)

Automatically displayed without any function.

c)

Using built-in exception handlers only.

d)

Using RAISE_APPLICATION_ERROR.