Unit 5: Pl-SQL - Practice Quiz
1 What does PL/SQL stand for?
2 Which organization developed PL/SQL?
3 PL/SQL is primarily associated with which database system?
4 Which programming style does PL/SQL add to SQL?
5 Which task can be performed using PL/SQL?
6 Which statement correctly describes SQL?
7 Which capability is directly supported by PL/SQL but not by basic SQL alone?
8 How are SQL statements commonly executed inside PL/SQL?
9 Which language supports variables and conditional statements?
10 Which statement best compares SQL and PL/SQL?
11 Which PL/SQL feature is used to respond to runtime errors?
12 Which PL/SQL feature repeats a set of statements?
13 How can PL/SQL help reduce communication between an application and a database?
14 Which feature helps organize reusable PL/SQL code?
15 Which is a benefit of storing PL/SQL program units in the database?
16 Which section of a PL/SQL block is mandatory?
17 Which keyword starts the executable section of a PL/SQL block?
BEGIN
EXCEPTION
DECLARE
CREATE
18 In which section are PL/SQL variables normally defined?
19 Which keyword introduces error-handling code in a PL/SQL block?
BEGIN
DECLARE
EXCEPTION
RETURN
20 Which keyword marks the conclusion of a PL/SQL block?
CLOSE
END
STOP
FINISH
21 An application must increase employee salaries, apply different rules based on department, and record failures. Why is PL/SQL more suitable than a single SQL statement?
22 A developer wants to create a named PL/SQL program that performs an action and can accept parameters without returning a value directly. Which program unit is most appropriate?
23
When a PL/SQL block contains both an IF statement and an UPDATE statement, how are they generally processed by Oracle?
IF is processed by SQL and UPDATE by PL/SQL
IF is processed by PL/SQL and UPDATE by SQL
24 A block is written and executed directly in a development tool without being saved as a database object. What type of PL/SQL unit is it?
25
A PL/SQL variable must store values from the employees.salary column while remaining compatible if the column's datatype later changes. Which declaration is most appropriate?
v_salary employees%ROWTYPE;
v_salary NUMBER(8,2);
v_salary VARCHAR2(100);
v_salary employees.salary%TYPE;
26 Which task specifically requires PL/SQL rather than standalone SQL?
27 Which comparison between SQL and PL/SQL is accurate?
28
A standalone query returns several rows. The same query is used as SELECT ... INTO v_name in PL/SQL, where v_name is scalar. What is the likely result?
29 Why can a PL/SQL block send several SQL operations to the database more efficiently than an application issuing each operation separately?
30 A requirement says: retrieve a balance, test whether it is below zero, and insert an alert only when needed. Which distinction makes PL/SQL appropriate?
31 A company wants all applications to use the same validated process for transferring funds. Which PL/SQL feature best supports this requirement?
32 How can stored PL/SQL improve security when users need to perform an approved operation but should not manipulate its tables directly?
33 A batch process must continue after a duplicate-key error and record information about the failed item. Which PL/SQL feature directly supports this behavior?
34 A query returns many rows that must be processed individually using procedural logic. Which PL/SQL feature is designed to manage the query result set?
35 A large application groups related procedures, functions, variables, and cursors under one database object. Which PL/SQL feature is being used?
36 A PL/SQL block needs local variables but no error handlers. Which section order is valid?
DECLARE → END → BEGIN
BEGIN → DECLARE → END
EXCEPTION → DECLARE → END
DECLARE → BEGIN → END
37
Where must an EXCEPTION section appear within a standard PL/SQL block?
END
END and the terminating semicolon
38 A block has no variables, constants, cursors, or local subprograms. Which section may be omitted?
DECLARE section
END statement
BEGIN section
39
In tools such as SQL*Plus, what is the usual role of / on a line after END;?
40
Consider the block: DECLARE v_num NUMBER := 10; BEGIN DECLARE v_num NUMBER := 20; BEGIN DBMS_OUTPUT.PUT_LINE(v_num); END; DBMS_OUTPUT.PUT_LINE(v_num); END;. What values are printed, assuming output is enabled?
20 followed by 20
20 followed by 10
10 followed by 10
10 followed by 20
41
Consider the following block:
BEGIN
NULL;
END;
/
Which statement correctly distinguishes the final two symbols?
END; submits the block, while / is processed by the PL/SQL engine.
END; terminates the PL/SQL block, while / asks a client tool to submit the buffered block.
END; closes the session, while / recompiles the block before execution.
END; commits the block, while / terminates the current database transaction.
42 Which is the smallest structurally valid anonymous PL/SQL block?
BEGIN NULL; END;
DECLARE NULL; END;
DECLARE BEGIN END;
BEGIN EXCEPTION END;
43
What happens when this block is executed?
BEGIN
DECLARE
v NUMBER := 1 / 0;
BEGIN
NULL;
EXCEPTION
WHEN ZERO_DIVIDE THEN NULL;
END;
END;
v is first referenced in the body.
ZERO_DIVIDE and execution completes normally.
44 An exception is raised in a block's executable section. Its matching handler then raises a different exception. Where is the new exception searched for?
45
Given the following nested block, which expression inside the inner block refers specifically to the outer variable?
<<outer_block>>
DECLARE
total NUMBER := 10;
BEGIN
DECLARE
total NUMBER := 20;
BEGIN
-- expression here
NULL;
END;
END;
outer_block.total
total
DECLARE.total
parent.total
46 Which ordering of sections is syntactically valid for a complete PL/SQL block?
DECLARE → BEGIN → EXCEPTION → END
DECLARE → EXCEPTION → BEGIN → END
BEGIN → EXCEPTION → DECLARE → END
BEGIN → DECLARE → EXCEPTION → END
47 A query must retrieve one employee salary and branch according to its value. Which design best reflects the roles of SQL and PL/SQL?
SELECT ... INTO for retrieval and a PL/SQL IF statement for branching.
SELECT for retrieval and a SQL IF clause for branching.
48 Which operation generally cannot appear directly as static SQL inside a PL/SQL executable section and therefore usually requires dynamic SQL?
COMMIT
DELETE FROM employees WHERE status = 'I'
CREATE TABLE audit_copy AS SELECT * FROM audit_log
UPDATE employees SET salary = salary * 1.1
49 Which statement most accurately compares the usual processing models of SQL and PL/SQL?
50
What is the outcome if a static SELECT ... INTO statement returns more than one row?
TOO_MANY_ROWS is raised.
51
After an UPDATE affects zero rows, which behavior distinguishes DML from a scalar SELECT ... INTO?
UPDATE assigns NULL to every target column.
UPDATE raises NO_DATA_FOUND automatically.
UPDATE raises TOO_MANY_ROWS automatically.
UPDATE completes and SQL%ROWCOUNT is zero.
52
Which assignment correctly places the value 5 into a PL/SQL variable named v_count?
v_count = 5;
SET v_count = 5;
v_count := 5;
LET v_count := 5;
53 A client currently sends 500 individual DML statements and conditional requests to the database. Which redesign most directly reduces client-server round trips?
54
A variable should automatically use the datatype of employees.salary without duplicating its declared precision. Which declaration best supports maintainability?
v_salary COLUMN employees.salary;
v_salary employees%ROWTYPE.salary;
v_salary TYPE OF employees.salary;
v_salary employees.salary%TYPE;
55 Which claim about exception handling is correct when a PL/SQL block catches an error after earlier DML has succeeded?
56 Which statement best characterizes the benefit of a stored PL/SQL procedure compared with repeatedly submitting an anonymous block?
57 Which architecture statement most accurately describes execution of a PL/SQL block containing embedded SQL?
58 Which description most precisely defines PL/SQL?
59 A block performs three related updates and must apply custom recovery logic if the second update fails. Which PL/SQL capability is central to this design?
60
What value is displayed by this block?
DECLARE
x NUMBER := 3;
BEGIN
DECLARE
x NUMBER := x + 2;
BEGIN
DBMS_OUTPUT.PUT_LINE(x);
END;
END;
5
2
3
Did this save you a night before the exam?
LPU Notes is free, and it stays free. Ads cover part of the server bill. The rest comes out of a student's own pocket: the domain, the storage, and keeping the site up through the weeks everyone needs it at once.
The payment button didn't load. An ad blocker or a filtered network is the usual reason. to try again.
Nothing here is ever locked, and nothing unlocks. Chip in only if it was worth it. What it pays for →