Oracle PL SQL Final Exam
Oracle PL SQL Final Exam
Mark
Full Name
students_street_address (*)
v_code (*)
#hours
completion_%
Correct
Correct
2. Which of the following are PL/SQL lexical units? (Choose two.) Mark for Review (1) Points (Choose all correct answers)
Identifiers (*)
Table Columns
Anonymous Blocks
SQL Workshop
Incorrect
3. Which statements about lexical units are true? (Choose two.) Mark for Review (1) Points (Choose all correct answers)
They are optional but can make a PL/SQL block execute faster
They are sequences of characters including letters, digits, tabs, returns and symbols (*)
Correct
Correct
4. Which of the following statements about PL/SQL and SQL is true? Mark for Review (1) Points
PL/SQL and SQL can be used with many types of databases, including Oracle.
PL/SQL allows basic program logic and control flow to be combined with SQL statements. (*)
Incorrect
5. SQL is a common access language for many types of databases, including Oracle. True or False? Mark for Review (1) Points
True (*)
False
Correct
Correct
Page 1 of 10
Next Summary
Processing
Procedural (*)
Primary
Proprietary
Correct
Correct
7. When a variable is defined using the CONSTANT keyword, the value of the variable cannot change. True or False? Mark for Review (1) Points
True (*)
False
Correct
Correct
8. Variables can be assigned a value in both the Executable and Declaration sections of a PL/SQL program. True or False? Mark for Review (1) Points
True (*)
False
Incorrect
9. Assignment statements can continue over several lines in PL/SQL. True or False? Mark for Review (1) Points
True (*)
False
Correct
Correct
10. Variables can be used in the following ways in a PL/SQL block. (Choose two.) Mark for Review (1) Points (Choose all correct answers)
To comment code.
Incorrect Incorrect. Refer to Section 2. 11. Is the following variable declaration correct or not ? DECLARE display_qty CONSTANT NUMBER; Mark for Review (1) Points
Correct.
Incorrect
12. There are no employees in Department 77. What will happen when the following block is executed? BEGIN DELETE FROM employees WHERE department_id=77; DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT) END; Mark for Review (1) Points
A NULL is displayed.
An exception is raised because the block does not contain a COMMIT statement.
Incorrect
13. You declare an implicit cursor in the DECLARE section of a PL/SQL block. True or False? Mark for Review (1) Points
True
False (*)
Incorrect
14. Assume there are 5 employees in Department 10. What happens when the following statement is executed? UPDATE employees SET salary=salary*1.1; Mark for Review (1) Points
No rows are modified because you did not specify "WHERE department_id=10"
An error message is displayed because you must use the INTO clause to hold the new salary.
Incorrect
Which of the following should NOT be used as the name of Mark for Review
A table name.
Incorrect
v_count PLS_INTEGER:=0;
college_name VARCHAR2(20):='Harvard';
Correct
Correct
1. Null
Which of the above can be assigned to a Boolean variable? Mark for Review (1) Points
2 and 3
2, 3 and 4
1, 2 and 3 (*)
1, 2, 3 and 4
Correct
Correct
18. executed?
DECLARE varA NUMBER := 12; BEGIN DECLARE varB NUMBER := 8; BEGIN varA := varA + varB; END; DBMS_OUTPUT.PUT_LINE(varB); END; Mark for Review (1) Points
12
20
VarB
Correct
Correct
19. When an exception occurs within a PL/SQL block, the remaining statements in the executable section of the block are skipped. True or False? Mark for Review (1) Points
True (*)
False
Incorrect
20. When nested blocks are used, which blocks can or must be labeled? Mark for Review (1) Points
The inner block must be labeled, the outer block can be labeled.
The outer block must be labeled if it is to be referred to in the inner block. (*)
Incorrect Incorrect. Refer to Section 2. Examine the following code. Line A causes an exception. What will be displayed when the block is executed? DECLARE var_a NUMBER := 6; var_b DATE; BEGIN var_a := var_a * 2; var_b := '28 December 2006'; -- Line A var_a := var_a * 2; EXCEPTION WHEN OTHERS THEN DBMS_OUTPUT.PUT_LINE(var_a); END; Mark for Review (1) Points
12 (*)
24
Incorrect
22. An exception occurs within the inner block of two nested blocks. The inner block does not have an EXCEPTION section. What always happens? Mark for Review (1) Points
Both blocks fail and an error message is displayed by the calling environment
Correct
Correct
23. A movie is an example of which category of data type? Mark for Review (1) Points
Scalar
Composite
Reference
LOB (*)
Incorrect
24. Which of these are PL/SQL data types? (Choose three.) Mark for Review (1) Points (Choose all correct answers)
Scalar (*)
Identifier
Delimiter
Composite (*)
LOB (*)
Correct
Correct
25. Which statement most closely describes "data type"? Mark for Review (1) Points
It specifies a storage format, constraints, and a valid range of values for a variable. (*)
Incorrect Incorrect. Refer to Section 2. 26. Which of the following are disadvantages of implicit data type conversions? (Choose two.) Mark for Review (1) Points (Choose all correct answers)
If Oracle changes the conversion rules in the future, your code may not work any more (*)
Incorrect
Which of the following are valid assignment statements? Mark for Review
v_string = 'Hello';
v_string := Hello;
v_date := 28-DEC-06;
Incorrect
28. The DECODE function is available in PL/SQL procedural statements. True or False? Mark for Review (1) Points
True
False (*)
Incorrect
29. The implicit data type conversion at Point A may not work correctly. Why not? DECLARE v_mydate DATE; BEGIN V_MYDATE := '29-Feb-04'; -- Point A END; Mark for Review (1) Points
Oracle cannot implicitly convert a character string to a date, even if the string contains a valid date value
Incorrect
30. PL/SQL can convert a VARCHAR2 value containing alphabetic characters to a NUMBER value. True or False? Mark for Review (1) Points
True
False (*)
Incorrect
Previous
Page 6 of 10
Next Summary
31.
DECLARE v_mynumber NUMBER; v_mybool BOOLEAN ; BEGIN v_mynumber := 6; v_mybool := (v_mynumber BETWEEN 10 AND 20); v_mybool := NOT (v_mybool); END; Mark for Review (1) Points
True (*)
False
Incorrect
32. executed?
set serveroutput on DECLARE a VARCHAR2(10) := '333'; b VARCHAR2(10) := '444'; c PLS_INTEGER; d VARCHAR2(10); BEGIN c := TO_NUMBER(a) + TO_NUMBER(b); d := a || b; DBMS_OUTPUT.PUT_LINE(c); DBMS_OUTPUT.PUT_LINE(d); END; Mark for Review (1) Points
Correct
Correct
33. TO_NUMBER, TO_CHAR, and TO_DATE are all examples of: Mark for Review (1) Points
Character functions
Operators
Correct
Correct
34. If today's date is 14th June 2007, which statement will correctly convert today's date to the value: June 14, 2007 ? Mark for Review (1) Points
TO_CHAR(sysdate)
TO_DATE(sysdate)
Incorrect
After line 4, what is the value of x? Mark for Review (1) Points
'300'
300 (*)
NULL
Correct
Correct
Previous 36.
Page 7 of 10
Next Summary
How many DML statements can be included in a single transaction? Mark for Review (1) Points
Only one
Incorrect
37.
BEGIN INSERT INTO countries (id, name) VALUES ('XA', 'Xanadu'); INSERT INTO countries (id, name) VALUES ('NV','Neverland'); COMMIT; COMMIT; ROLLBACK; END; What happens when the block of code finishes? Mark for Review (1) Points
You have nothing new; the last ROLLBACK undid the INSERTs.
You have the rows added twice; there are four new rows.
Incorrect
38. Which of the following is NOT a good guideline for retrieving data in PL/SQL? Mark for Review (1) Points
Specify the same number of variables in the INTO clause as database columns in the SELECT clause.
Correct
Correct
39. Which rows will be deleted from the EMPLOYEES table when the following code is executed? DECLARE salary employees.salary%TYPE := 12000; BEGIN DELETE FROM employees WHERE salary > salary; END; Mark for Review (1) Points
No rows. (*)
Incorrect
40. Which one of these SQL statements can be directly included in a PL/SQL executable block? Mark for Review (1) Points
DESCRIBE employees;
Incorrect
DECLARE v_result employees.salary%TYPE; BEGIN Which statement will always return exactly one value? Mark for Review (1) Points
Incorrect
42.
DECLARE v_holdit employees.last_name%TYPE; BEGIN ... Which of the following is a correct use of the INTO clause? Mark for Review (1) Points
SELECT *
Incorrect
43. Errors are handled in the Exception part of the PL/SQL block. True or False? Mark for Review (1) Points
True (*)
False
Correct
Correct
44. In which part of the PL/SQL block are declarations of variables defined? Mark for Review (1) Points
Executable
Exception
Declarative (*)
Definition
Correct
Correct
45. code?
BEGIN DBMS_OUTPUT.PUT_LINE('My first quiz'); END; Mark for Review (1) Points
procedure
subroutine
function
anonymous (*)
Incorrect
46. Every PL/SQL anonymous block must start with the keyword DECLARE. True or False? Mark for Review (1) Points
True
False (*)
Correct
Correct
Correct
Correct
48. Which statements are optional in a PL/SQL block? (Choose two.) Mark for Review (1) Points (Choose all correct answers)
DECLARE (*)
BEGIN
EXCEPTION (*)
END;
Correct
Correct
Mark
Anonymous
Function (*)
Procedure
Correct
Correct
50. Which of the following tools can NOT be used to develop and test PL/SQL code? Mark for Review (1) Points
Oracle Jdeveloper
Oracle iSQL*Plus
Correct
Correct