Selasa, 27 Oktober 2015

Test: Mid Term Exam Semester 1



Test: Mid Term Exam Semester 1
-
Part I
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Mid Term Exam Semester 1
-
Part 1
1. Variables can be used in the following ways in a P
L/SQL block.
(Choose two.) Mark for Review
(1) Points
(Choose all correct answers)
To store data values. (*)
To rename tables and columns.
To refer to a single data value several times. (*)
To co
mment code.
Correct
2. Is the following variable declaration correct or not ?
DECLARE
display_qty CONSTANT NUMBER;
Mark for Review
(1) Points
Correct.
Not correct. (*)
Correct
3. Assignment statements can continue over several lines in PL/SQL.
True or False? Mark for Review
(1) Points
True (*)
False
Correct
4. 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
5. Identify which of the following assignment statements are
valid.
(Choose three.) Mark for Review
(1) Points
(Choose all correct answers)
v_last_name := Chandra;
v_blackout_date := '31
-
DEC
-
2006'; (*)
v_population := 333444; (*)
v_music_type := 'ROCK'; (*
)
Correct
Page 1 of 10
Test: Mid Term Exam Semester 1
-
Part I
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Mid Term Exam Semes
ter 1
-
Part 1
6. 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
Ne
sted blocks cannot be labeled
The outer block must be labeled if it is to be referred to in the
inner block. (*)
Correct
7. What will be displayed when the following code is executed?
DECLARE
varA NUM
BER := 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
8. In the following code, Line A causes an exception. What value will
be displayed when the code is executed?
DECLARE
outer_var VARCHAR2(50) := 'My';
BEGI
N
outer_var := outer_var || ' name';
DECLARE
inner_var NUMBER;
BEGIN
inner_var := 'Mehmet';
--
Line A
outer_var := outer_var || ' is';
END;
outer_var := outer_var || ' Zeynep';
EXCEPTION
WHEN
OTHERS THEN
DBMS_OUTPUT.PUT_LINE(outer_var);
END;
Mark for Review
(1) Points
My
My name (*)
My name is
My name is Zeynep
Correct
9. An exception occurs withi
n 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
The excepti
on is propagated to the outer block (*)
Oracle automatically tries to re
-
execute the inner block
The user's database session is automatically disconnected
Correct
10. 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
Correct
Page 2 of 10
Test: Mid Term Exam Semester 1
-
Part I
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Mid Term Exam Semester 1
-
Part 1
11. Which of these are PL/SQL data types? (Choose t
hree.) Mark for
Review
(1) Points
(Choose all correct answers)
Scalar (*)
Identifier
Delimiter
Composite (*)
LOB (*)
Correct
12. A collection is a
composite data type. True or False? Mark for
Review
(1) Points
True (*)
False
Correct
13. A movie is an example of which category of data type? Mark for
Review
(1) Points
Sca
lar
Composite
Reference
LOB (*)
Correct
14. A variable is declared as:
DECLARE
v_holdit employees.last_name%TYPE;
BEGIN ...
Which of the following is a correct use of the INT
O clause?
Mark for Review
(1) Points
SELECT *
INTO v_holdit
FROM employees;
SELECT last_name
INTO v_holdit
(1) Points
DELETE FROM employees
WHERE department_id=60;
(*)
SELECT salary FROM employees
WHERE department_id=60;
CREATE TABLE new_emps (last_name V
ARCHAR2(10), first_name
VARCHAR2(10));
DROP TABLE locations;
Correct
19. Assume there are 5 employees in Department 10. What happens when
the following statement is executed?
UPDATE employees
SET salar
y=salary*1.1;
Mark for Review
(1) Points
All employees get a 10% salary increase. (*)
No rows are modified because you did not specify "WHERE
department_id=10"
A TOO_MANY_ROWS exception is raised.
An error
message is displayed because you must use the INTO clause to
hold the new salary.
Correct
20. A PL/SQL block includes the following statement:
SELECT last_name INTO v_last_name
FROM employees
WHERE employee_id=1
00;
What is the value of SQL%ISOPEN immediately after the SELECT statement is
executed?
Mark for Review
(1) Points
True
False (*)
Null
Error. That attribute does not apply for implicit cursors.
Correct
Page 4 of 10
Test: Mid Term Exam Semester 1
-
Part I
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
Mid Term Exam Semester 1
-
Pa
rt 1
21. 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
Incorrect. Refer to Section 3.
22. 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
23. Every PL/SQL anonymous block must start with the keyword DECLARE.
True or False? Mark for Review
(1) Points
True
False (*)
Correct
24. What kind of block is defined by the following PL/SQL code?
BEGIN
DBMS_OUTPUT.PUT_LINE('My first quiz');
END;
Mark for Review
(1) Points
procedure
subroutine
function
anonymous (*)
Correct
25. Errors are handled in the Exception part of the PL/SQL block. True
or False? Mark for Review
(1) Points
True (*)
False
Correct
Page 5 of 10
Test: Mid Term Exam Semester 1
-
Part I
Review your answers, feedback, and question scores below. An asterisk (*)
indicates a correct answer.
"Satrio Pinandito Sinisihan Wahyu"