Week9 - Introduction to PL/SQL, Control Statements / Analyze

The questions can come in any order, so make sure you are selecting right option for all questions.

1. Which of the following statements is true?

(c) The WHEN clause of a CASE expression does not end with a semicolon.

2. ____ are named memory areas that hold values to allow the retrieval and manipulation of values in a program.

(d) Variables

3. 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?

(d) 32

4. The ____ uses the LOOP and END LOOP markers to begin and end the loop code.

(a) basic loop

5. Which of the following lines of code is syntactically correct?

(d)
DECLARE
order NUMBER(3);
departure DATE;
BEGIN
—- executable statements —
END

6. Which of the following code fragments would not raise an error?

(b)
IF rec.state = ’VA’ OR rec.state = ’PA’ THEN
a := b * .06;
ELSE
a := b * .04;
END IF;

7. The ____ section of a PL/SQL block contains code that creates variables, cursors, and types.

(a) DECLARE

8. Which of the following statements is correct?

(d)
IF order > 5 THEN
prize := ‘yes’;
END IF;

9. The only required sections of a PL/SQL block are the ____ sections.

(c) BEGIN & END

10. Which of the following initializes the variable order?

(d)
DECLARE
order NUMBER(2) := 0;
departure DATE;
BEGIN
—- executable statements —
END;

11. Which of the following clauses ensures that a basic loop runs at least once?

(a) EXIT WHEN

12. ____ are used to change the values of variables.

(b) Assignment Statements

13.
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?

(c) EXIT WHEN lv_cnt_num >= 5;

14. Which of the following statement blocks correctly uses a scalar variable in an assignment statement?

(b)
DECLARE
order NUMBER(2) := 4;
total_amt NUMBER(2);
BEGIN
total_amt := 12 * order;
END;

15. Which of the following evaluates conditions and returns a value in an assignment statement?

(c) CASE expression

16. Which of the following code fragments would not raise an error?

(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;

17. The statements that are used to control the flow of logic processing in your programs are commonly referred to as ____.

(b) control structures

18. Which of the following PL/SQL blocks requires the variable to always contain a particular value within the block?

(c)
DECLARE
order CONSTANT NUMBER(2,2) := .02;
departure DATE;
BEGIN
—- executable statements —
END;

Post a Comment

Cookie Consent
We serve cookies on this site to analyze traffic, remember your preferences, and optimize your experience.
Oops!
It seems there is something wrong with your internet connection. Please connect to the internet and start browsing again.
AdBlock Detected!
We have detected that you are using adblocking plugin in your browser.
The revenue we earn by the advertisements is used to manage this website, we request you to whitelist our website in your adblocking plugin.