Mid Exam Semester 1 Part 1
Mid Exam Semester 1 Part 1
Mark for
Review
(1) Points
Mark for
Review
(1) Points
True
False (*)
Incorrect. Refer to Section 1 Lesson 2.
3. Comparing PL/SQL with other languages such as C and Java, which of the
following statements is true?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Oracle Jdeveloper
Oracle Application Express
Mark for
Review
(1) Points
END;
EXCEPTION
DECLARE
BEGIN
Mark for
Review
(1) Points
2,1,4,3
3,4,2,1 (*)
3,2,4,1
4,3,2,1
Correct
7. What is the purpose of using DBMS_OUTPUT.PUT_LINE in a PL/SQL block?
Mark for
Review
(1) Points
Correct
8. Errors are handled in the Exception part of the PL/SQL block. True or False?
Mark for
Review
(1) Points
True (*)
False
Correct
9. Every PL/SQL anonymous block must start with the keyword DECLARE. True
or False?
Mark for
Review
(1) Points
True
False (*)
Correct
10. PL/SQL is an Oracle proprietary, procedural, 4GL programming language.
True or False?
Mark for
Review
(1) Points
True
False (*)
Correct
Section 1
(Answer all questions in this section)
11. A program which specifies a list of operations to be performed sequentially
to achieve the desired result can be called:
Mark for
Review
(1) Points
declarative
nondeclarative
procedural (*)
low level
Correct
12. The P in PL/SQL stands for:
Mark for
Review
(1) Points
Processing
Procedural (*)
Primary
Proprietary
Correct
Section 2
(Answer all questions in this section)
13. PL/SQL does not look _________ in the child blocks.
Mark for
Review
(1) Points
Inward
Upward
Outward
Downward (*)
Correct
14. 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.
Both blocks must be labeled
Nested blocks cannot be labeled
The outer block must be labeled if it is to be referred to in the inner
block. (*)
Correct
Mark for
Review
(1) Points
HelloWorld
Hello World
World
The code will fail since the inner variable is not within the scope of the
outer block. (*)
Correct
16. What will be displayed when the following code is 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
8
12
Nothing, the block will fail with an error (*)
20
VarB
Correct
17. Examine the following code. At Line A, we want to assign a value of 22 to
the outer block's variable v_myvar. What code should we write at Line A?
<<outer_block>>
DECLARE
v_myvar NUMBER;
BEGIN
Mark for
Review
(1) Points
<<inner_block>>
DECLARE
v_myvar NUMBER := 15;
BEGIN
-- Line A
END;
END;
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Mark for
Review
(1) Points
True (*)
False
Correct
22. 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
Correct
23. When a variable is defined using the NOT NULL keywords, the variable must
contain a value. True or False?
Mark for
Review
(1) Points
True (*)
False
Correct
24. 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
25. Which of the following are PL/SQL lexical units? (Choose two.)
Mark for
Review
(1) Points
Mark for
Review
(1) Points
True
False (*)
Correct
27. Which statements about lexical units are true? (Choose two.)
Mark for
Review
(1) Points
Mark for
Review
(1) Points
81
49
14 (*)
18
Correct
29. Examine the following code:
1
2
3
4
5
DECLARE
x NUMBER;
BEGIN
x:= '300';
END;
Mark for
Review
(1) Points
'300'
300 (*)
NULL
Correct
30. What is wrong with this assignment statement?
myvar :=
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Mark for
Review
(1) Points
True
False (*)
Correct
33. Which of the following are valid assignment statements? (Choose two.)
Mark for
Review
(1) Points
v_string = 'Hello';
v_string := Hello;
v_number := 17 + 34; (*)
v_string := 'Hello'; (*)
v_date := 28-DEC-06;
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)
TO_DATE(sysdate,'Month DD, YYYY')
TO_CHAR(sysdate, 'Month DD, YYYY') (*)
Correct
35. Single row character functions are valid SQL functions in PL/SQL. True or
False?
Mark for
Review
(1) Points
True (*)
False
Correct
36. Which of these are PL/SQL data types? (Choose three.)
Mark for
Review
(1) Points
Correct
37. ______ are meant to store large amounts of data.
Mark for
Review
(1) Points
Variables
Scalar data types
LOBs (*)
Correct
38. What is the data type of the variable V_DEPT_TABLE in the following
declaration?
DECLARE
TYPE dept_table_type IS TABLE OF departments%ROWTYPE INDEX BY
PLS_INTEGER; v_dept_table dept_table_type; ...
Mark for
Review
(1) Points
Scalar
Composite (*)
LOB
Correct
39. Which of the following declarations is invalid?
Mark for
Review
(1) Points
v_count PLS_INTEGER:=0;
college_name VARCHAR2(20):='Harvard';
v_pages CONSTANT NUMBER; (*)
v_start_date DATE := sysdate+1;
Correct
40. Which of the following can be assigned to a Boolean variable?
1. Null
2. False
3. True
4. 0
2 and 3
2, 3 and 4
Mark for
Review
(1) Points
1, 2 and 3 (*)
1, 2, 3 and 4
Correct
Section 2
(Answer all questions in this section)
41. You need to declare a variable to hold a value which has been read from the
SALARY column of the EMPLOYEES table. Which of the following is an
advantage of declaring the variable as: employees.salary%TYPE ?
Mark for
Review
(1) Points
Section 3
(Answer all questions in this section)
42. The following anonymous block of code is run:
BEGIN
INSERT INTO countries (id, name)
VALUES ('XA', 'Xanadu');
SAVEPOINT XA;
INSERT INTO countries (id, name)
VALUES ('NV','Neverland');
COMMIT;
ROLLBACK TO XA;
END;
What happens when the block of code finishes?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
Only one
None. A transaction cannot include DML statements.
A maximum of four DML statements
As many as needed (*)
Correct
44. Which SQL statement can NOT use an implicit cursor?
Mark for
Review
(1) Points
A DELETE statement
An UPDATE statement
A SELECT statement that returns multiple rows (*)
A SELECT statement that returns one row
Correct
45. A PL/SQL block includes the following statement:
SELECT last_name INTO v_last_name
FROM employees
WHERE employee_id=100;
Mark for
Review
(1) Points
True
False (*)
Null
Error. That attribute does not apply for implicit cursors.
Correct
46. You declare an implicit cursor in the DECLARE section of a PL/SQL block.
True or False?
Mark for
Review
(1) Points
True
False (*)
Correct
47. The following code will return the last name of the employee whose
employee id is equal to 100: True or False?
DECLARE
v_last_name employees.last_name%TYPE;
employee_id employees.employee_id%TYPE := 100;
BEGIN
SELECT last_name INTO v_last_name
FROM employees
WHERE employee_id = employee_id;
END;
Mark for
Review
(1) Points
True
False (*)
Correct
48. Which one of these SQL statements can be directly included in a PL/SQL
executable block?
Mark for
Review
(1) Points
Mark for
Review
(1) Points
SELECT salary
INTO v_salary
FROM employees
WHERE employee_id=100;
(*)
SELECT v_salary
INTO salary
FROM employees
WHERE employee_id=100;
SELECT salary
FROM employees
INTO v_salary;
SELECT salary
FROM employees
WHERE employee_id=100
INTO v_salary;
Incorrect. Refer to Section 3 Lesson 2.
50. 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