Deck 2: Basic PL/SQL Block Structures
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/81
Play
Full screen (f)
Deck 2: Basic PL/SQL Block Structures
1
With respect to processing efficiency, the less code that has to be processed, the faster the program runs.
True
2
The LOOP statement is a mechanism that allows the checking of a condition to determine if statements should or should not be processed.
False
3
The following code fragment is a correct example of the use of a basic loop.
BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
False
4
Even though the EXIT clause can be used in any type of loop, it is considered good form to use the EXIT clause only in basic loops.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
5
When an IF statement checks only one condition and performs actions only if the condition is True, it is referred to as a simple IF condition.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
6
The keyword DEFAULT can be used in place of the := symbol to assign initial values to the variables within the declaration statement.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
7
The only required sections of a PL/SQL block are DECLARE and END.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
8
The CASE statement begins with the keyword CASE followed by a selector that is typically a variable name.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
9
The BEGIN section of a PL/SQL block contains code that creates variables, cursors, and types. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
10
The syntax of the following code fragment is correct:
IF rec_order.state = 'VA' THEN
lv_tax_num := rec_order.sub * .06;
ELSEIF rec_order.state = 'ME' THEN
lv_tax_num := rec_order.sub * .05;
ELSE
lv_tax_num := rec_order.sub * .04;
END IF
IF rec_order.state = 'VA' THEN
lv_tax_num := rec_order.sub * .06;
ELSEIF rec_order.state = 'ME' THEN
lv_tax_num := rec_order.sub * .05;
ELSE
lv_tax_num := rec_order.sub * .04;
END IF
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
11
The following code fragment is a correct example of the use of a WHILE loop.
BEGIN
WHILE lv_cnt_num <= 5
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
BEGIN
WHILE lv_cnt_num <= 5
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
12
The term anonymous blocks refers to blocks of code that are not stored for reuse and do not exist after being executed.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
13
An infinite loop causes a program to loop indefinitely, disrupting the ability of the code to continue with any processing beyond the loop.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
14
The EXIT WHEN clause ensures that a basic loop runs at least once.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
15
The BEGIN section of a PL/SQL block contains code that creates variables, cursors, and types.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
16
Assignment statements are used to put or change the values of variables.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
17
The following code fragment is a correct example of the use of a FOR loop.
BEGIN
FOR i IN 1..5
DBMS_OUTPUT.PUT_LINE( i );
END LOOP;
END;
BEGIN
FOR i IN 1..5
DBMS_OUTPUT.PUT_LINE( i );
END LOOP;
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
18
The following loop terminates when the lv_cnt_num variable holds a value of 6.
BEGIN
WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
BEGIN
WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
19
The following loop iterates four times.
BEGIN
WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
BEGIN
WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
20
The syntax of the following code fragment is correct.
IF rec_order.state = 'VA' THEN
lv_tax_num := rec_order.sub * .06;
ELS IF rec_order.state = 'ME' THEN
lv_tax_num := rec_order.sub * .05;
END IF
IF rec_order.state = 'VA' THEN
lv_tax_num := rec_order.sub * .06;
ELS IF rec_order.state = 'ME' THEN
lv_tax_num := rec_order.sub * .05;
END IF
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
21
If the WHERE clause is not included the basic loop, the result is the programmer's nightmare of the infinite loop. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
22
Variables are named memory areas that hold values to allow retrieval and manipulation of values within your programs. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
23
The only required sections of a PL/SQL block are the ____ sections.
A) BEGIN & DECLARE
B) DECLARE & EXCEPTION
C) BEGIN & END
D) EXCEPTION & END
A) BEGIN & DECLARE
B) DECLARE & EXCEPTION
C) BEGIN & END
D) EXCEPTION & END
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
24
The EXCEPTION section of a PL/SQL block contains handlers that allow you to control what the application will do if an error occurs. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
25
Which of the following lines of code is syntactically correct?
A) DECLARE
Order NUMBER;
Departure DATE;
BEGIN
---- executable statements ---
END
B) DECLARE
Order NUMBER;
Departure DATE
BEGIN
---- executable statements ---
END
C) DECLARE
Order NUMBER(2);
Departure DATE;
BEGIN;
---- executable statements ---
END
D) DECLARE
Order NUMBER(3);
Departure DATE;
BEGIN
---- executable statements ---
END;
A) DECLARE
Order NUMBER;
Departure DATE;
BEGIN
---- executable statements ---
END
B) DECLARE
Order NUMBER;
Departure DATE
BEGIN
---- executable statements ---
END
C) DECLARE
Order NUMBER(2);
Departure DATE;
BEGIN;
---- executable statements ---
END
D) DECLARE
Order NUMBER(3);
Departure DATE;
BEGIN
---- executable statements ---
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
26
When an IF statement checks only one condition and performs actions only if the condition is True, it is referred to as a(n) simple IF condition. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
27
A(n) CASE expression evaluates conditions and returns a value in an assignment statement. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
28
The ____ section of a PL/SQL block contains handlers that allow you to control what the application will do if an error occurs when the executable statements are processed.
A) EXCEPTION
B) BEGIN
C) DECLARE
D) END
A) EXCEPTION
B) BEGIN
C) DECLARE
D) END
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
29
____ are named memory areas that hold values to allow the retrieval and manipulation of values in a program.
A) Loops
B) Assignment statements
C) Blocks
D) Variables
A) Loops
B) Assignment statements
C) Blocks
D) Variables
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
30
The Searched CASE statement does not use a selector but individually evaluates conditions that are placed in the WHERE clauses. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
31
The DECLARE section of the PL/SQL block contains all the processing action, or programming logic. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
32
The basic loop dictates exactly how many times the loop should run in the opening LOOP clause. ____________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
33
A(n) scalar variable can hold only a single value. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
34
The ____ section of a PL/SQL block contains code that creates variables, cursors, and types.
A) DECLARE
B) BEGIN
C) EXCEPTION
D) END
A) DECLARE
B) BEGIN
C) EXCEPTION
D) END
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
35
Which of the following initializes the variable order?
A) DECLARE
Order NUMBER(2);
Departure DATE;
BEGIN
---- executable statements ---
END;
B) DECLARE
Order NUMBER(2) = 0;
Departure DATE;
BEGIN
---- executable statements ---
END;
C) DECLARE
Order NUMBER(2) =: 0;
Departure DATE;
BEGIN
---- executable statements ---
END;
D) DECLARE
Order NUMBER(2) := 0;
Departure DATE;
BEGIN
---- executable statements ---
END;
A) DECLARE
Order NUMBER(2);
Departure DATE;
BEGIN
---- executable statements ---
END;
B) DECLARE
Order NUMBER(2) = 0;
Departure DATE;
BEGIN
---- executable statements ---
END;
C) DECLARE
Order NUMBER(2) =: 0;
Departure DATE;
BEGIN
---- executable statements ---
END;
D) DECLARE
Order NUMBER(2) := 0;
Departure DATE;
BEGIN
---- executable statements ---
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
36
The basic loop uses the LOOP and END LOOP markers to begin and end the loop code. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
37
Loops are used for situations in which we need to repeat a line or lines of code within our block. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
38
The common data types used for cursor variables include character, numeric, date, and Boolean. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
39
To keep code efficient and minimize statement processing, any statements that are dynamic in nature should be placed outside a loop. _________________________
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
40
____ are used to change the values of variables.
A) Loops
B) Assignment statements
C) Exceptions
D) Blocks
A) Loops
B) Assignment statements
C) Exceptions
D) Blocks
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
41
Which of the following PL/SQL blocks requires the variable to always contain a particular value within the block?
A) DECLARE
Order NUMBER(2) := 0;
Departure DATE;
BEGIN
---- executable statements ---
END;
B) DECLARE
Order NUMBER(2,2) := .06;
Departure DATE;
BEGIN
---- executable statements ---
END;
C) DECLARE
Order CONSTANT NUMBER(2,2) := .02;
Departure DATE;
BEGIN
---- executable statements ---
END;
D) DECLARE
Order NUMBER(2) CONSTANT := .03;
Departure DATE;
BEGIN
---- executable statements ---
END;
A) DECLARE
Order NUMBER(2) := 0;
Departure DATE;
BEGIN
---- executable statements ---
END;
B) DECLARE
Order NUMBER(2,2) := .06;
Departure DATE;
BEGIN
---- executable statements ---
END;
C) DECLARE
Order CONSTANT NUMBER(2,2) := .02;
Departure DATE;
BEGIN
---- executable statements ---
END;
D) DECLARE
Order NUMBER(2) CONSTANT := .03;
Departure DATE;
BEGIN
---- executable statements ---
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
42
BEGIN WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
According to the code fragment above, how many times does the loop iterate?
A) 3
B) 4
C) 5
D) 6
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
According to the code fragment above, how many times does the loop iterate?
A) 3
B) 4
C) 5
D) 6
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
43
Which of the following statements is correct?
A) IF order > 5
Prize = 'yes';
END IF;
B) IF order > 5 THEN
Prize = 'yes';
ENDIF
C) IF order > 5 THEN;
Prize = 'yes';
END IF;
D) IF order > 5 THEN
Prize := 'yes';
END IF;
A) IF order > 5
Prize = 'yes';
END IF;
B) IF order > 5 THEN
Prize = 'yes';
ENDIF
C) IF order > 5 THEN;
Prize = 'yes';
END IF;
D) IF order > 5 THEN
Prize := 'yes';
END IF;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
44
FOR i IN 1..tbl_roast.COUNT LOOP lv_tot_num := lv_tot_num + tbl_roast(i);
END LOOP;
In the above code fragment, which of the following holds the value of the current iteration number?
A) tbl_roast
B) i
C) COUNT
D) lv_tot_num
END LOOP;
In the above code fragment, which of the following holds the value of the current iteration number?
A) tbl_roast
B) i
C) COUNT
D) lv_tot_num
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
45
The ____ uses the LOOP and END LOOP markers to begin and end the loop code.
A) basic loop
B) cursor
C) index-by table
D) general loop
A) basic loop
B) cursor
C) index-by table
D) general loop
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
46
Which of the following statement blocks correctly uses a scalar variable in an assignment statement?
A) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Total_amt = 12;
END;
B) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Total_amt := 12 * order;
END;
C) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Order := total_amt *12;
END;
D) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Total_amt := total_amt *12;
END;
A) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Total_amt = 12;
END;
B) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Total_amt := 12 * order;
END;
C) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Order := total_amt *12;
END;
D) DECLARE
Order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Total_amt := total_amt *12;
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
47
Which of the following dictates exactly how many times the loop should run in the opening LOOP clause?
A) CASE
B) WHILE loop
C) FOR loop
D) Basic loop
A) CASE
B) WHILE loop
C) FOR loop
D) Basic loop
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
48
DECLARE order NUMBER(2) := 4;
Total_amt NUMBER(2);
BEGIN
Total_amt := order * 8;
END;
According to the statement block above, what value is stored in the variable total_amt?
A) 4
B) 8
C) 12
D) 32
Total_amt NUMBER(2);
BEGIN
Total_amt := order * 8;
END;
According to the statement block above, what value is stored in the variable total_amt?
A) 4
B) 8
C) 12
D) 32
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
49
Which of the following does not use a selector, but individually evaluates conditions that are placed in WHEN clauses?
A) Control statements
B) Searched CASE
C) Loops
D) CASE expression
A) Control statements
B) Searched CASE
C) Loops
D) CASE expression
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
50
The statements that are used to control the flow of logic processing in your programs are commonly referred to as ____.
A) exceptions
B) control structures
C) pragma statements
D) index-by tables
A) exceptions
B) control structures
C) pragma statements
D) index-by tables
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
51
Which of the following statements is True?
A) The WHEN clause of a CASE statement ends with a semicolon.
B) The WHEN clause of a CASE statement ends with "END CASE;".
C) The WHEN clause of a CASE expression does not end with a semicolon.
D) The WHEN clause of a CASE statement ends with "ENDCASE".
A) The WHEN clause of a CASE statement ends with a semicolon.
B) The WHEN clause of a CASE statement ends with "END CASE;".
C) The WHEN clause of a CASE expression does not end with a semicolon.
D) The WHEN clause of a CASE statement ends with "ENDCASE".
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
52
Which of the following evaluates conditions and returns a value in an assignment statement?
A) Searched CASE
B) Basic loop
C) CASE expression
D) Control statement
A) Searched CASE
B) Basic loop
C) CASE expression
D) Control statement
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
53
BEGIN LOOP
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
EXIT WHEN lv_cnt_num >= 5;
END LOOP;
END;
Which of the statements in the code fragment above ensures that the loop executes at least once?
A) LOOP
B) lv_cnt_num := lv_cnt_num + 1;
C) EXIT WHEN lv_cnt_num >= 5;
D) DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
EXIT WHEN lv_cnt_num >= 5;
END LOOP;
END;
Which of the statements in the code fragment above ensures that the loop executes at least once?
A) LOOP
B) lv_cnt_num := lv_cnt_num + 1;
C) EXIT WHEN lv_cnt_num >= 5;
D) DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
54
Which of the following code fragments would not raise an error?
A) BEGIN
WHILE lv_cnt_num <= 5
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
B) BEGIN
WHILE lv_cnt_num <= 5
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END;
C) BEGIN
WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
D) BEGIN
WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
A) BEGIN
WHILE lv_cnt_num <= 5
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
B) BEGIN
WHILE lv_cnt_num <= 5
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END;
C) BEGIN
WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
D) BEGIN
WHILE lv_cnt_num <= 5 LOOP
DBMS_OUTPUT.PUT_LINE(lv_cnt_num);
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
55
Which of the following code fragments would not raise an error?
A) IF rec.state = 'VA' OR 'PA' THEN
A := b * .06;
ELSE
A := b * .04;
END IF;
B) IF rec.state = 'VA' OR rec.state = 'PA' THEN
A := b * .06;
ELSE
A := b * .04;
END IF;
C) IF rec.state = 'VA' OR rec.state = 'PA'
A := b * .06;
ELSE
A := b * .04;
END IF;
D) IF rec.state = 'VA' OR rec.state = 'PA' THEN
A := b * .06;
ELSE
A := b * .04;
END IF
A) IF rec.state = 'VA' OR 'PA' THEN
A := b * .06;
ELSE
A := b * .04;
END IF;
B) IF rec.state = 'VA' OR rec.state = 'PA' THEN
A := b * .06;
ELSE
A := b * .04;
END IF;
C) IF rec.state = 'VA' OR rec.state = 'PA'
A := b * .06;
ELSE
A := b * .04;
END IF;
D) IF rec.state = 'VA' OR rec.state = 'PA' THEN
A := b * .06;
ELSE
A := b * .04;
END IF
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
56
Which of the following code fragments would not raise an error?
A) BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
B) BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
EXIT WHEN lv_cnt_num >= 5;
Lv_cnt_num := lv_cnt_num + 1;
END;
C) BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
EXIT WHEN lv_cnt_num >= 5;
Lv_cnt_num := lv_cnt_num + 1
END LOOP
END
D) BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
EXIT WHEN lv_cnt_num >= 5;
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
A) BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
B) BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
EXIT WHEN lv_cnt_num >= 5;
Lv_cnt_num := lv_cnt_num + 1;
END;
C) BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
EXIT WHEN lv_cnt_num >= 5;
Lv_cnt_num := lv_cnt_num + 1
END LOOP
END
D) BEGIN
LOOP
DBMS_OUTPUT.PUT_LINE( lv_cnt_num );
EXIT WHEN lv_cnt_num >= 5;
Lv_cnt_num := lv_cnt_num + 1;
END LOOP;
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
57
Which of the following allow us to repeat the processing of a desired portion of code?
A) Functions
B) Looping constructs
C) IF statements
D) CASE expressions
A) Functions
B) Looping constructs
C) IF statements
D) CASE expressions
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
58
Which of the following code fragments would not raise an error?
A) IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELSEIF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
B) IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELSE IF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
C) IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELSIF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
D) IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELS IF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
A) IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELSEIF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
B) IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELSE IF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
C) IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELSIF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
D) IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELS IF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
59
If the EXIT WHEN clause is not included in a basic loop, then the result is a(n) ____.
A) infinite loop
B) exception
C) RAISE_APPLICATION_ERROR
D) SQLCODE error
A) infinite loop
B) exception
C) RAISE_APPLICATION_ERROR
D) SQLCODE error
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
60
Which of the following clauses ensures that a basic loop runs at least once?
A) EXIT WHEN
B) WHERE
C) CASE
D) LOOP
A) EXIT WHEN
B) WHERE
C) CASE
D) LOOP
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
61
The ____________________ section of the PL/SQL block contains code that creates variables, cursors, and types.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
62
Which of the following code fragments would not raise an error?
A) BEGIN
FOR i IN 1..10 LOOP
DBMS_OUTPUT.PUT_LINE(i);
END LOOP;
END;
B) BEGIN
FOR i IN 1..10 LOOP
DBMS_OUTPUT.PUT_LINE(c)
END LOOP
END;
C) BEGIN
FOR i IN 1..10
DBMS_OUTPUT.PUT_LINE(i);
END LOOP;
END;
D) BEGIN
FOR i IN 1..10 LOOP
DBMS_OUTPUT.PUT_LINE
END LOOP
END;
A) BEGIN
FOR i IN 1..10 LOOP
DBMS_OUTPUT.PUT_LINE(i);
END LOOP;
END;
B) BEGIN
FOR i IN 1..10 LOOP
DBMS_OUTPUT.PUT_LINE(c)
END LOOP
END;
C) BEGIN
FOR i IN 1..10
DBMS_OUTPUT.PUT_LINE(i);
END LOOP;
END;
D) BEGIN
FOR i IN 1..10 LOOP
DBMS_OUTPUT.PUT_LINE
END LOOP
END;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
63
The code order NUMBER(2) := 6; is an example of a(n) ____________________.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
64
____________________ are used for situations in which we need to repeat a line or lines of code within our block.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
65
_____________________ statements are used to put or change values in variables.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
66
IF rec_order.state = 'VA' THEN lv_tax_num := rec_order.sub * .06;
ELSIF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
Which of the clauses in the code fragment above would not cause the IF statement to raise an error if it were excluded?
A) ELSE
B) IF
C) END IF
D) THEN
ELSIF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
Which of the clauses in the code fragment above would not cause the IF statement to raise an error if it were excluded?
A) ELSE
B) IF
C) END IF
D) THEN
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
67
The ____________________ section of a PL/SQL block contains handlers that allow you to control what the application will do if an error occurs during the executable statements in the BEGIN section.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
68
A(n) ____________________ variable can hold only a single value.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
69
By indicating a numeric range, the ____________________ dictates exactly how many times the loop should run in the opening LOOP clause.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
70
What is the purpose of the BEGIN section of a PL/SQL block?
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
71
The simple IF statement performs an action only if the condition is ____________________.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
72
The ____________________ loop is constructed with conditions in the LOOP statement to determine when the looping action begins and ends.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
73
A(n) ____________________ statement does not use a selector but individually evaluates conditions that are placed in the WHEN clauses.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
74
If the EXIT WHEN clause is not included in the basic loop, the result is the programmer's nightmare of a(n) ____________________.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
75
To declare a variable, you must supply a variable name and ____________________.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
76
Which of the following code fragments is correct?
A) FOR i IN 1..tbl.COUNT
Lv_tot_num := lv_tot_num + tbl_roast(i);
END LOOP;
B) FOR i IN 1..tbl.COUNT LOOP
Lv_tot_num := lv_tot_num + tbl_roast(i)
END LOOP
C) FOR i IN 1..tbl.COUNT LOOP
Lv_tot_num = lv_tot_num + tbl_roast(i);
END LOOP;
D) FOR i IN 1..tbl.COUNT LOOP
Lv_tot_num := lv_tot_num + tbl_roast(i);
END LOOP;
A) FOR i IN 1..tbl.COUNT
Lv_tot_num := lv_tot_num + tbl_roast(i);
END LOOP;
B) FOR i IN 1..tbl.COUNT LOOP
Lv_tot_num := lv_tot_num + tbl_roast(i)
END LOOP
C) FOR i IN 1..tbl.COUNT LOOP
Lv_tot_num = lv_tot_num + tbl_roast(i);
END LOOP;
D) FOR i IN 1..tbl.COUNT LOOP
Lv_tot_num := lv_tot_num + tbl_roast(i);
END LOOP;
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
77
Which of the following can be referenced in the loop but cannot be assigned a value because it is controlled by the loop?
A) The counter variable
B) The IN clause
C) The INSERT INTO clause
D) The FOR clause
A) The counter variable
B) The IN clause
C) The INSERT INTO clause
D) The FOR clause
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
78
The ____________________ statement is a mechanism that allows the checking of a condition to determine whether or not statements should be processed.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
79
Why would the following code raise an error? IF rec_order.state = 'VA' THEN
Lv_tax_num := rec_order.sub * .06;
ELSEIF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
A) Semicolon after THEN is omitted
B) No space between ELSE and IF
C) ELSEIF is not a keyword
D) ":=" should be "="
Lv_tax_num := rec_order.sub * .06;
ELSEIF rec_order.state = 'ME' THEN
Lv_tax_num := rec_order.sub * .05;
ELSE
Lv_tax_num := rec_order.sub * .04;
END IF;
A) Semicolon after THEN is omitted
B) No space between ELSE and IF
C) ELSEIF is not a keyword
D) ":=" should be "="
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck
80
The ____________________ option can be added to the variable declaration to require the variable to always contain a particular value within the block.
Unlock Deck
Unlock for access to all 81 flashcards in this deck.
Unlock Deck
k this deck