wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

PL/SQL Quiz

Total questions: 60

Worksheet time: 30mins

Name
Class
Date
1.

What does PL/SQL stand for?

a)

Programming Language for SQL

b)

Procedural Language/SQL

c)

Process Language for SQL

d)

Primary Language/SQL

2.

PL/SQL is used with which database?

a)

MongoDB

b)

MySQL

c)

PostgreSQL

d)

Oracle

3.

Which keyword starts a PL/SQL block?

a)

BEGIN

b)

DECLARE

c)

END

d)

START

4.

What keyword ends a PL/SQL block?

a)

FINISH

b)

EXIT

c)

END

d)

DONE

5.

Which symbol is used for assignment?

a)

=

b)

==

c)

:=

d)

=>

6.

Which of the following is a valid PL/SQL comment?

a)

// Comment

b)

/* Comment */

c)

-- Comment

d)

Comment

7.

PL/SQL allows you to define:

a)

Tables only

b)

Variables

c)

Columns only

d)

Users only

8.

Which is a Boolean value in PL/SQL?

a)

YES

b)

NO

c)

TRUE

d)

ZERO

9.

What does DBMS_OUTPUT.PUT_LINE do?

a)

Writes to a file

b)

Reads input

c)

Displays output

d)

Deletes data

10.

What must be done before using PUT_LINE?

a)

Compile code

b)

Use SELECT

c)

Set SERVEROUTPUT ON

d)

Connect database

11.

Which datatype holds character data?

a)

NUMBER

b)

VARCHAR2

c)

BOOLEAN

d)

INT

12.

What does %TYPE provide?

a)

Datatype of column

b)

Table name

c)

Row count

d)

New variable

13.

Which is a loop type in PL/SQL?

a)

UNTIL

b)

FOR

c)

DO-WHILE

d)

NEXT

14.

What does IF check?

a)

Syntax

b)

Tables

c)

Conditions

d)

Procedures

15.

How do you concatenate strings?

a)

&

b)

||

c)

,

16.

Which operator is used for exponentiation?

a)

^

b)

pow

c)

**

d)

**

17.

A constant is declared using:

a)

FINAL

b)

STATIC

c)

CONSTANT

d)

FIXED

18.

Which statement is used to select data?

a)

INSERT

b)

UPDATE

c)

SELECT

d)

DELETE

19.

A CASE statement is used for:

a)

Multiple conditions

b)

Loops

c)

Declaring variables

d)

Connecting databases

20.

Which loop executes at least once?

a)

FOR

b)

WHILE

c)

LOOP

d)

REPEAT

21.

Which clause is used to lock rows in a cursor?

a)

LOCK

b)

FOR UPDATE

c)

WITH LOCK

d)

SECURE

22.

What does an implicit cursor handle?

a)

Single row SELECT

b)

Multiple rows only

c)

Joins only

d)

None

23.

What attribute gives number of rows processed?

a)

FOUND

b)

NOTFOUND

c)

ROWCOUNT

d)

ISOPEN

24.

Which is NOT a cursor attribute?

a)

ISOPEN

b)

FOUND

c)

INSERTED

d)

NOTFOUND

25.

Parameterized cursors accept:

a)

Tables

b)

Values

c)

Records

d)

Queries

26.

Cursor FOR loop handles:

a)

Errors only

b)

Cursor operations automatically

c)

Only WHERE clauses

d)

Only SELECT

27.

User-defined exceptions are:

a)

Ignored

b)

Declared by user

c)

Built-in

d)

Avoided

28.

Built-in exceptions are:

a)

User-defined

b)

Ignored

c)

Predefined by Oracle

d)

Manual

29.

Exception block starts with:

a)

START

b)

BEGIN

c)

EXCEPTION

d)

RAISE

30.

SQLCODE returns:

a)

Error number

b)

Error name

c)

Error line

d)

Error variable

31.

SQLERRM returns:

a)

Error number

b)

Error message

c)

Error table

d)

Error code

32.

NO_DATA_FOUND is raised when:

a)

Row exists

b)

No row found

c)

Too many rows

d)

Data is NULL

33.

TOO_MANY_ROWS is raised when:

a)

Multiple rows returned in SELECT INTO

b)

Table is empty

c)

Too many tables

d)

Value too long

34.

Which operator checks equality?

a)

:=

b)

==

c)

=

d)

!=

35.

Which loop has a known iteration range?

a)

WHILE

b)

FOR

c)

DO WHILE

d)

LOOP

36.

What is the keyword to define a block inside another?

a)

INSIDE

b)

DECLARE

c)

NESTED

d)

SUBBLOCK

37.

RAISE_APPLICATION_ERROR is used for:

a)

User-defined error message

b)

System error

c)

Restart code

d)

Skip error

38.

Which clause refers to current cursor row?

a)

OF CURRENT

b)

WHERE CURRENT OF

c)

CURRENT ROW

d)

ROW_CURSOR

39.

A valid Boolean value:

a)

1

b)

0

c)

FALSE

d)

NULL only

40.

A valid data type:

a)

INTEGER(2,2)

b)

BOOLEAN(2)

c)

NUMBER(3)

d)

STR(5)

41.

Which part handles runtime errors?

a)

EXCEPTION

b)

OUTPUT

c)

RUNTIME

d)

LOGIC

42.

%ROWTYPE gives:

a)

Table name

b)

Structure of table row

c)

Datatype

d)

Value

43.

Which PL/SQL block part is optional?

a)

BEGIN

b)

END

c)

DECLARE

d)

EXCEPTION

44.

A FOR loop ends with:

a)

DONE

b)

FINISH

c)

END LOOP

d)

END

45.

Variables in PL/SQL must be:

a)

Declared in table

b)

Declared before use

c)

Created by Oracle

d)

Auto-generated

46.

Which displays the message?

a)

OUTPUT

b)

ECHO

c)

PUT_LINE

d)

PRINTLN

47.

Nested blocks allow:

a)

Loops only

b)

Single statements

c)

Smaller executable blocks

d)

Errors only

48.

Cursor is opened using:

a)

FETCH

b)

OPEN

c)

SELECT

d)

START

49.

Cursor is closed using:

a)

END

b)

CLOSE

c)

STOP

d)

TERMINATE

50.

FETCH retrieves:

a)

Data from cursor

b)

Tables

c)

Loops

d)

Constants

51.

You can define multiple:

a)

Tables

b)

Variables

c)

Servers

d)

Keywords

52.

Loop that checks condition before executing:

a)

DO

b)

FOR

c)

WHILE

d)

CASE

53.

EXIT is used in:

a)

Loops

b)

SELECT

c)

DECLARE

d)

EXCEPTION

54.

CONSTANT value:

a)

Can be changed

b)

Cannot be changed

c)

Must be NULL

d)

Changes every run

55.

SELECT INTO raises error if:

a)

Data exists

b)

More than one row returned

c)

One row returned

d)

None

56.

%FOUND returns TRUE if:

a)

No row found

b)

Row found

c)

Error

d)

Table missing

57.

%ISOPEN returns:

a)

TRUE if cursor closed

b)

TRUE if cursor open

c)

Error if open

d)

Nothing

58.

An unnamed exception is caught with:

a)

SQLCODE

b)

SQLERRM

c)

WHEN OTHERS

d)

WHEN UNKNOWN

59.

A variable name can start with:

a)

Number

b)

Symbol

c)

Letter

d)

Operator

60.

DECLARE section is used to:

a)

Define variables

b)

Run program

c)

Print data

d)

Handle error