You are on page 1of 8

Practice Quiz #1

Question 1 2.5 out of 2.5 points A(n) ________ variable is one that exists in the application environment and can range from a field on an application screen to an SQL*Plus variable. Answer Selected Answer: b. host Correct Answer: b. host Question 2 2.5 out of 2.5 points

The ____ markers are used in PL/SQL to identify a label. Answer Selected Answer: c. << >> Correct Answer: c. << >> Question 3 2.5 out of 2.5 points

Which of the following code fragments tells the system to look up the data type of a database column and use it for the declared variable? Answer Selected Answer: b. DECLARE order.quantity%TYPE; total_amt NUMBER(2); BEGIN --- executable code --END; Correct Answer: b. DECLARE order.quantity%TYPE; total_amt NUMBER(2); BEGIN --- executable code --END; Question 4 2.5 out of 2.5 points

____ are named memory areas that hold values to allow the retrieval and manipulation of values in a program. Answer Selected Answer: d. Variables Correct Answer: d. Variables Question 5 2.5 out of 2.5 points

Examine the following anonymous block and choose the appropriate statement. DECLARE v_fname VARCHAR2(20); v_lname VARCHAR2(15) DEFAULT 'fernandez'; BEGIN DBMS_OUTPUT.PUT_LINE(v_fname ||' ' ||v_lname); END; Answer

Selected Answer: a. The block executes successfully and prints "fernandez". Correct Answer: a. The block executes successfully and prints "fernandez". Question 6 2.5 out of 2.5 points

Examine the following anonymous block and choose the appropriate statement. DECLARE v_text1 VARCHAR2(10) DEFAULT 'White'; v_text2 VARCHAR2(10) DEFAULT 'Rabbit'; BEGIN DBMS_OUTPUT.PUT_LINE('My ' || lower(v_text2) ||' is ' ||upper(v_text1)); END; / Answer Selected Answer: c. The block executes successfully and prints "My rabbit is WHITE". Correct Answer: c. The block executes successfully and prints "My rabbit is WHITE". Question 7 2.5 out of 2.5 points

The statements that are used to control the flow of logic processing in your programs are commonly referred to as ____. Answer Selected Answer: b. control structures Correct Answer: b. control structures Question 8 2.5 out of 2.5 points

Which of the following PL/SQL blocks requires the variable to always contain a particular value within the block? Answer Selected Answer: c. DECLARE order CONSTANT NUMBER(2,2) := .02; departure DATE; BEGIN ---- executable statements --END; Correct Answer: c. DECLARE order CONSTANT NUMBER(2,2) := .02; departure DATE; BEGIN ---- executable statements --END; Question 9 2.5 out of 2.5 points

What is the datatype of the resulting expression? xyz123 := sysdate - to_date('20-Jan-2011', 'DD-Mon-YYYY'); Answer Selected Answer: a. number Correct Answer: a. number Question 10 2.5 out of 2.5 points

The only required sections of a PL/SQL block are the ____ sections. Answer Selected Answer: c. BEGIN & END Correct Answer: c. BEGIN & END

Practice Quiz 2
Question 1 2.5 out of 2.5 points You can test the _________ attribute(s) in the executable section of a block to gather information after the appropriate DML command executes. Answer Selected Answer: d. all of the above. Correct Answer: d. all of the above. Question 2 2.5 out of 2.5 points

Which of the followings is true about PL/SQL blocks? Answer Selected Answer: b. You can nest blocks only in the executable part of a block. Correct Answer: b. You can nest blocks only in the executable part of a block. Question 3 2.5 out of 2.5 points

You can use a(n) ____________ to access the variables that have scope but are not visible. Answer Selected Answer: a. qualifier Correct Answer: a. qualifier Question 4 2.5 out of 2.5 points

Evaluate the following PL/SQL block. Which of the followings is correct value of variable v_weight at position 1 according to the rules of scoping? DECLARE v_weight NUMBER(3) := 600; v_message VARCHAR2(255) := 'Product 10012'; BEGIN DECLARE v_weight NUMBER(3) := 1; v_message VARCHAR2(255) := 'Product 11001'; v_new_locn VARCHAR2(50) := 'Europe'; BEGIN v_weight := v_weight + 1; v_new_locn := 'Western ' || v_new_locn; position 1-------------END; v_weight := v_weight + 1; v_message := v_message || ' is in stock'; v_new_locn := 'Western ' || v_new_locn; END; / Answer Selected Answer: b. 2

Correct Answer: b. 2 Question 5 2.5 out of 2.5 points

Evaluate the preceding PL/SQL block. DECLARE v_weight NUMBER(3) := 600; v_message VARCHAR2(255) := 'Product 10012'; BEGIN DECLARE v_weight NUMBER(3) := 1; v_message VARCHAR2(255) := 'Product 11001'; v_new_locn VARCHAR2(50) := 'Europe'; BEGIN v_weight := v_weight + 1; v_new_locn := 'Western ' || v_new_locn; END; v_weight := v_weight + 1; v_message := v_message || ' is in stock'; v_new_locn := 'Western ' || v_new_locn; Position 1 >>>>>>>>> END; / What is the value of v_new_locn at position 1? Answer Selected Answer: d. None of the above. The v_new_locn variable is not visible outside the subblock. Correct Answer: d. None of the above. The v_new_locn variable is not visible outside the subblock. Question 6 2.5 out of 2.5 points

Which of the following lines of code does not have a syntax error? Answer Selected Answer: d. DECLARE order NUMBER(3); departure DATE; BEGIN ---- executable statements --END; / Correct Answer: d. DECLARE order NUMBER(3); departure DATE; BEGIN ---- executable statements --END; /

Question 7

2.5 out of 2.5 points

Evaluate the preceding PL/SQL block. DECLARE v_customer VARCHAR2(50) := 'Womansport'; v_credit_rating VARCHAR2(50) := 'EXCELLENT'; BEGIN DECLARE v_customer NUMBER(7) := 201; v_name VARCHAR2(25) := 'Unisports'; BEGIN v_credit_rating :='GOOD'; ..... END; ..... END; / What is the value of v_customer in the nested block? Answer Selected Answer: b. 201 Correct Answer: b. 201 Question 8 2.5 out of 2.5 points Evaluate the following PL/SQL block. Which of the followings is correct value of variable v_weight at position 1 according to the rules of scoping? DECLARE v_weight NUMBER(3) := 600; v_message VARCHAR2(255) := 'Product 10012'; BEGIN DECLARE v_weight NUMBER(3) := 1; v_message VARCHAR2(255) := 'Product 11001'; v_new_locn VARCHAR2(50) := 'Europe'; BEGIN v_weight := v_weight + 1; v_new_locn := 'Western ' || v_new_locn; END; v_weight := v_weight + 1; v_message := v_message || ' is in stock'; v_new_locn := 'Western ' || v_new_locn; position 1-------------END; / Answer Selected Answer: c. 601 Correct Answer: c. 601 Question 9 2.5 out of 2.5 points Why does the following statement generate an error? Assume that employee id is not duplicated.

SELECT hire_date, salary, last_name INTO v_hire, v_sal FROM employees WHERE employee_id = 100; Answer Selected Answer: a. You must specify one variable in INTO clause for each item selected in the SELECT clause. Correct Answer: a. You must specify one variable in INTO clause for each item selected in the SELECT clause. Question 10 2.5 out of 2.5 points

The ________ statement selects rows from one table to update or insert into another table. Answer Selected Answer: d. MERGE Correct Answer: d. MERGE

Practice Quiz #3
Question 1 2.5 out of 2.5 points Which of the following attributes is available to enable movement through the index-by table data? Answer Selected Answer: c. PRIOR Correct Answer: c. PRIOR Question 2 2.5 out of 2.5 points

Which of the following code fragments correctly uses a record variable to hold the row of data queried for an employee? Answer Selected Answer: a. DECLARE rec_employee employees%ROWTYPE; BEGIN SELECT * INTO rec_employee FROM employees WHERE employee_id = :g_emp_id; DBMS_OUTPUT.PUT_LINE(rec_employee.last_name); DBMS_OUTPUT.PUT_LINE(rec_employee.first_name); DBMS_OUTPUT.PUT_LINE(rec_employee.email); END; Correct Answer: a. DECLARE rec_employee employees%ROWTYPE; BEGIN SELECT * INTO rec_employee FROM employees WHERE employee_id = :g_emp_id; DBMS_OUTPUT.PUT_LINE(rec_employee.last_name); DBMS_OUTPUT.PUT_LINE(rec_employee.first_name); DBMS_OUTPUT.PUT_LINE(rec_employee.email); END;

Question 3

2.5 out of 2.5 points

Assume that the initial value for the lv_cnt_num is 1. How many time(s) is the DBMS_OUTPUT statement executed? 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; Answer Selected Answer: c. 4 Correct Answer: c. 4 Question 4 2.5 out of 2.5 points

Which of the following can be referenced in the loop but cannot be assigned a value because it is controlled by the loop? Answer Selected Answer: a. The counter variable Correct Answer: a. The counter variable Question 5 2.5 out of 2.5 points

Which of the following statements is correct? Answer Selected Answer: c. The CONTINUE statement cannot appear outside a loop at all. Correct Answer: c. The CONTINUE statement cannot appear outside a loop at all. Question 6 2.5 out of 2.5 points

Which of the following statements is correct? Answer Selected Answer: d. IF order > 5 THEN prize := 'yes'; END IF; Correct Answer: d. IF order > 5 THEN prize := 'yes'; END IF; Question 7 2.5 out of 2.5 points

In the given code fragment below, which of the following holds the value of the current iteration number? FOR i IN 1..tbl_roast.COUNT LOOP lv_tot_num := lv_tot_num + tbl_roast(i); END LOOP; Answer Selected Answer: b. i Correct Answer: b. i Question 8 2.5 out of 2.5 points

Which of the following evaluates conditions and returns a value in an assignment statement? Answer Selected Answer: c. CASE expression Correct Answer: c. CASE expression Question 9 2.5 out of 2.5 points

Which of the clauses in the code fragment below would not cause the IF statement to raise an error if it were excluded? 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; Answer Selected Answer: a. ELSE Correct Answer: a. ELSE Question 10 2.5 out of 2.5 points

Which of the following code fragments would not raise an error? Answer Selected Answer: 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; Correct Answer: 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;

You might also like