NEW
Font size
WorksheetsPL/SQL Quiz
Total questions: 60
Worksheet time: 30mins
What does PL/SQL stand for?
Programming Language for SQL
Procedural Language/SQL
Process Language for SQL
Primary Language/SQL
PL/SQL is used with which database?
MongoDB
MySQL
PostgreSQL
Oracle
Which keyword starts a PL/SQL block?
BEGIN
DECLARE
END
START
What keyword ends a PL/SQL block?
FINISH
EXIT
END
DONE
Which symbol is used for assignment?
=
==
:=
=>
Which of the following is a valid PL/SQL comment?
// Comment
/* Comment */
-- Comment
Comment
PL/SQL allows you to define:
Tables only
Variables
Columns only
Users only
Which is a Boolean value in PL/SQL?
YES
NO
TRUE
ZERO
What does DBMS_OUTPUT.PUT_LINE do?
Writes to a file
Reads input
Displays output
Deletes data
What must be done before using PUT_LINE?
Compile code
Use SELECT
Set SERVEROUTPUT ON
Connect database
Which datatype holds character data?
NUMBER
VARCHAR2
BOOLEAN
INT
What does %TYPE provide?
Datatype of column
Table name
Row count
New variable
Which is a loop type in PL/SQL?
UNTIL
FOR
DO-WHILE
NEXT
What does IF check?
Syntax
Tables
Conditions
Procedures
How do you concatenate strings?
&
||
,
Which operator is used for exponentiation?
^
pow
**
**
A constant is declared using:
FINAL
STATIC
CONSTANT
FIXED
Which statement is used to select data?
INSERT
UPDATE
SELECT
DELETE
A CASE statement is used for:
Multiple conditions
Loops
Declaring variables
Connecting databases
Which loop executes at least once?
FOR
WHILE
LOOP
REPEAT
Which clause is used to lock rows in a cursor?
LOCK
FOR UPDATE
WITH LOCK
SECURE
What does an implicit cursor handle?
Single row SELECT
Multiple rows only
Joins only
None
What attribute gives number of rows processed?
FOUND
NOTFOUND
ROWCOUNT
ISOPEN
Which is NOT a cursor attribute?
ISOPEN
FOUND
INSERTED
NOTFOUND
Parameterized cursors accept:
Tables
Values
Records
Queries
Cursor FOR loop handles:
Errors only
Cursor operations automatically
Only WHERE clauses
Only SELECT
User-defined exceptions are:
Ignored
Declared by user
Built-in
Avoided
Built-in exceptions are:
User-defined
Ignored
Predefined by Oracle
Manual
Exception block starts with:
START
BEGIN
EXCEPTION
RAISE
SQLCODE returns:
Error number
Error name
Error line
Error variable
SQLERRM returns:
Error number
Error message
Error table
Error code
NO_DATA_FOUND is raised when:
Row exists
No row found
Too many rows
Data is NULL
TOO_MANY_ROWS is raised when:
Multiple rows returned in SELECT INTO
Table is empty
Too many tables
Value too long
Which operator checks equality?
:=
==
=
!=
Which loop has a known iteration range?
WHILE
FOR
DO WHILE
LOOP
What is the keyword to define a block inside another?
INSIDE
DECLARE
NESTED
SUBBLOCK
RAISE_APPLICATION_ERROR is used for:
User-defined error message
System error
Restart code
Skip error
Which clause refers to current cursor row?
OF CURRENT
WHERE CURRENT OF
CURRENT ROW
ROW_CURSOR
A valid Boolean value:
1
0
FALSE
NULL only
A valid data type:
INTEGER(2,2)
BOOLEAN(2)
NUMBER(3)
STR(5)
Which part handles runtime errors?
EXCEPTION
OUTPUT
RUNTIME
LOGIC
%ROWTYPE gives:
Table name
Structure of table row
Datatype
Value
Which PL/SQL block part is optional?
BEGIN
END
DECLARE
EXCEPTION
A FOR loop ends with:
DONE
FINISH
END LOOP
END
Variables in PL/SQL must be:
Declared in table
Declared before use
Created by Oracle
Auto-generated
Which displays the message?
OUTPUT
ECHO
PUT_LINE
PRINTLN
Nested blocks allow:
Loops only
Single statements
Smaller executable blocks
Errors only
Cursor is opened using:
FETCH
OPEN
SELECT
START
Cursor is closed using:
END
CLOSE
STOP
TERMINATE
FETCH retrieves:
Data from cursor
Tables
Loops
Constants
You can define multiple:
Tables
Variables
Servers
Keywords
Loop that checks condition before executing:
DO
FOR
WHILE
CASE
EXIT is used in:
Loops
SELECT
DECLARE
EXCEPTION
CONSTANT value:
Can be changed
Cannot be changed
Must be NULL
Changes every run
SELECT INTO raises error if:
Data exists
More than one row returned
One row returned
None
%FOUND returns TRUE if:
No row found
Row found
Error
Table missing
%ISOPEN returns:
TRUE if cursor closed
TRUE if cursor open
Error if open
Nothing
An unnamed exception is caught with:
SQLCODE
SQLERRM
WHEN OTHERS
WHEN UNKNOWN
A variable name can start with:
Number
Symbol
Letter
Operator
DECLARE section is used to:
Define variables
Run program
Print data
Handle error
