Midterm Part3
Midterm Part3
v_count PLS_INTEGER:=0;
college_name VARCHAR2(20):='Harvard';
Correct Correct
A table name.
3. 1. Null
2. False
3. True
4. 0
2 and 3
2, 3 and 4
1, 2 and 3 (*)
1, 2, 3 and 4
Correct Correct
BEGIN
INSERT INTO countries (id, name)
VALUES ('XA', 'Xanadu');
INSERT INTO countries (id, name)
VALUES ('NV','Neverland');
COMMIT;
COMMIT;
ROLLBACK;
END;
You have nothing new; the last ROLLBACK undid the INSERTs.
You have the rows added twice; there are four new rows.
Full Name
students_street_address (*)
v_code (*)
#hours
completion_%
Correct Correct
yesterday (*)
yesterday's date
number_of_students_in_the_class
v$testresult (*)
#students
Identifiers (*)
Table Columns
Anonymous Blocks
SQL Workshop
Correct Correct
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
My
My name (*)
My name is
My name is Zeynep
Correct Correct
The inner block must be labeled, the outer block can be labeled.
DECLARE
x VARCHAR2(6) := 'Chang';
BEGIN
DECLARE
x VARCHAR2(12) := 'Susan';
BEGIN
x := x || x;
END;
DBMS_OUTPUT.PUT_LINE(x);
END;
Mark for Review
(1) Points
Susan
Chang (*)
ChangChang
SusanChang
Correct Correct
<<outer_block>>
DECLARE
v_myvar NUMBER;
BEGIN
<<inner_block>>
DECLARE
v_myvar NUMBER := 15;
BEGIN
-- Line A
END;
END;
Mark for Review
(1) Points
v_myvar := 22;
<<outer_block>>.v_myvar := 22;
v_myvar(outer_block) := 22;
(*)
Correct Correct
DECLARE
v_salary employees.salary%TYPE;
BEGIN
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;
Correct Correct
17. 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. (*)
DESCRIBE employees;
UPDATE employees
SET last_name='Smith';
(*)
DECLARE
maxsalary NUMBER(7) = 5000;
Mark for Review
(1) Points
Correct.
Correct Correct
True (*)
False
Correct Correct
True (*)
False
Correct Correct
To comment code.
Correct Correct
True (*)
False
Correct Correct
True
False (*)
Correct Correct
declarative
nondeclarative
procedural (*)
low level
Correct Correct
PL/SQL and SQL can be used with many types of databases, including
Oracle.
DECLARE (*)
BEGIN
EXCEPTION (*)
END;
Correct Correct
Correct Correct
Oracle Jdeveloper
Oracle iSQL*Plus
1. END;
2. EXCEPTION
3. DECLARE
4. BEGIN
2,1,4,3
3,4,2,1 (*)
3,2,4,1
4,3,2,1
Correct Correct
True
False (*)
Correct Correct
Correct Correct
True (*)
False
Correct Correct
Application Builder
Utilities
Object Browser
Correct Correct
Variables
LOBs (*)
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
Scalar (*)
Identifier
Delimiter
Composite (*)
LOB (*)
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
DECLARE
v_mydate DATE;
BEGIN
V_MYDATE := '29-Feb-04'; -- Point A
END;
Mark for Review
(1) Points
TO_CHAR(sysdate)
TO_DATE(sysdate)
True
False (*)
Correct Correct
DECLARE
v_myvar NUMBER;
BEGIN
v_myvar := 1 + 2 * 3;
v_myvar := v_myvar * 2;
END;
Mark for Review
(1) Points
81
49
14 (*)
18
Correct Correct
v_string = 'Hello';
v_string := Hello;
v_date := 28-DEC-06;
Correct Correct
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
Correct Correct
1 DECLARE
2 x NUMBER;
3 BEGIN
4 x:= '300';
5 END;
'300'
300 (*)
NULL
Character functions
Operators
Incorrect Incorrect. Refer to Section 2.
UPDATE employees
SET salary=salary*1.1;
Mark for Review
(1) Points
An error message is displayed because you must use the INTO clause
to hold the new salary.
True
False (*)
False (*)
Null