1.
Which of
the Mark for
following Review
is NOT a (1) Points
good
guideline
for
declaring
variables
?
Declare one identifier per line
Use NOT NULL when the variable must have a value
Use column names as identifiers (*)
Correct
2. Which of the following can be assigned to a BOOLEAN variable?
1. Null Mark for
2. False Review
3. True (1) Points
4. 0
2, 3 and 4
1, 2 and 3 (*)
1, 2, 3 and 4
2 and 3
Correct
3. 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? Mark for
Review
<<outer_block>> (1) Points
DECLARE
v_myvar NUMBER;
BEGIN
<<inner_block>>
DECLARE
v_myvar NUMBER := 15;
BEGIN
-- Line A
END;
END;
We cannot reference the outer block's variable because both variables
have the same name
outer_block.v_myvar := 22; (*)
v_myvar(outer_block) := 22;
v_myvar := 22;
<<outer_block>>.v_myvar := 22;
Incorrect. Refer to Section 2 Lesson 6.
4. If an outer block is labeled, the inner block must be labeled also. True or
False? Mark for
Review
(1) Points
True
False (*)
Correct
5. Is the following variable declaration correct or not?
Mark for
DECLARE Review
display_qty CONSTANT NUMBER; (1) Points
Correct.
Not correct. (*)
Correct
Test: Section 2 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 2 Quiz
(Answer all questions in this section)
11. PL/SQL statements must be written on a single line.
Mark for Review
(1) Points
True
False (*)
Correct
12. The TO_CHAR function is used for explicit data type conversions. True or False?
Mark for Review
(1) Points
True (*)
False
Correct
13. Explicit conversions can be slower than implicit conversions. True or False?
Mark for Review
(1) Points
True
False (*)
Correct
14. Which of the following is an example of using a case convention for good
programming practice? Mark for Review
(1) Points
Declare variables in the DECLARE section.
Assign variables by using functions.
Include an exception handler in every PL/SQL block.
Declare data types in uppercase. (*)
Incorrect. Refer to Section 2 Lesson 7.
15. Which of the following will help to make code easier to read?
Mark for Review
(1) Points
Including comments in the code. (*)
Naming variables.
Using %Type.
Correct
Previous Page 3 of 3 Summary
Test: Section 2 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 2 Quiz
(Answer all questions in this section)
6. After they are declared, variables can be used only once in an application. True or
False? Mark for Review
(1) Points
True
False (*)
Correct
7. Type of a variable determines the range of values the variable can have and the set of
operations that are defined for values of the type. Mark for Review
(1) Points
True (*)
False
Correct
8. A datatype may specify a valid range of values. True or False?
Mark for Review
(1) Points
True (*)
False
Correct
9. Delimiters are _____ that have special meaning to the Oracle database.
Mark for Review
(1) Points
identifiers
variables
symbols (*)
Correct
10. Which of the following are valid identifiers? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
completion_%
#hours
Full Name
v_code (*)
students_street_address (*)
Incorrect. Refer to Section 2 Lesson 2.
Previous Page 2 of 3 Next Summary
Test: Section 1 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1 Quiz
(Answer all questions in this section)
1. PL/SQL is an Oracle proprietary, procedural, fourth-generation programming language.
True or False? Mark for Review
(1) Points
True
False (*)
Correct
2. In which three ways does PL/SQL extend the SQL programming language? (Choose
three) Mark for Review
(1) Points
(Choose all correct answers)
By adding procedural constructs. (*)
By adding compound constructs.
By adding conditional control. (*)
By adding iterative control. (*)
Correct
3. The P in PL/SQL stands for:
Mark for Review
(1) Points
Processing
Procedural (*)
Primary
Proprietary
Correct
4. Which of the following statements is true?
Mark for Review
(1) Points
You can embed PL/SQL statements within SQL code.
You can embed procedural constructs within SQL code.
None of these are correct.
5. SQL is a
common Mark for
access Review
language (1) Points
for many
types of
databases,
including
Oracle.
True or
False?
True (*)
False
Correct
Test: Section 1 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1 Quiz
(Answer all questions in this section)
6. Which of the following can be done using PL/SQL?
Mark for Review
(1) Points
All of these can be done (*)
Create custom reports
Retrieve and modify data in Oracle database tables
Create complex applications
Manage database tasks such as security
Correct
7. The fact that PL/SQL is portable is a good thing because:
Mark for Review
(1) Points
Blocks can be sent to the operating system.
PL/SQL code can be run on any operating system without a database
PL/SQL code can be developed on one platform and deployed on another (*)
Exceptions can be ported to different operating systems
Correct
8. Using Oracle Application Express, you can create Web applications that include
PL/SQL. True or False? Mark for Review
(1) Points
TRUE (*)
FALSE
Correct
9. PL/SQL differs from C and Java in which of the following ways? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
It is the most efficient language to use with an Oracle database. (*)
It does not support object-oriented programming.
It is the most complex programming language to learn.
It is not portable to other operating systems.
It requires an Oracle database or tool. (*)
Correct
10. You can create a Web site application written entirely in PL/SQL. True or False?
Mark for Review
(1) Points
True
False (*)
Incorrect. Refer to Section 1 Lesson 2.
Previous Page 2 of 3 Next Summary
Test: Section 1 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 1 Quiz
(Answer all questions in this section)
11. What is the purpose of using DBMS_OUTPUT.PUT_LINE in a PL/SQL block?
Mark for Review
(1) Points
To display results to check if our code is working correctly (*)
To allow a set of statements to be executed repeatedly
To perform conditional tests
To store new rows in the database
Correct
12. Which lines of code will correctly display the message "Hello World" ? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
DBMS_OUTPUT('Hello World');
DBMS_OUTPUT.PUT_LINE('Hello' || ' ' || 'World'); (*)
DBMS_OUTPUT.PUT_LINE('Hello World'); (*)
DBMS_OUTPUT.PUT_LINE('Hello' || 'World');
Correct
13. Which PL/SQL block type must return a value?
Mark for Review
(1) Points
Procedure
Function (*)
Package
Anonymous
Correct
14. What are the characteristics of a PL/SQL stored subprogram? (Choose two.)
Mark for Review
(1) Points
(Choose all correct answers)
Not stored in the database
Named (*)
Can be invoked at any time (*)
Do not exist after they are executed
Incorrect. Refer to Section 1 Lesson 3.
15. This PL/SQL anonymous block will execute successfully. True or False?
Mark for Review
DECLARE (1) Points
v_date DATE := SYSDATE;
DBMS_OUTPUT.PUT_LINE(v_date);
END;
True
False (*)
Correct
Previous Page 3 of 3 Summary
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
1. Does PL/SQL allow you to have a variable with the same name as a database column?
Mark for Review
(1) Points
Yes (*)
No
Correct
2. Which rows will be deleted from the EMPLOYEES table when the following code is
executed? Mark for Review
(1) Points
DECLARE
salary employees.salary%TYPE := 12000;
BEGIN
DELETE FROM employees
WHERE salary > salary;
END;
All rows whose SALARY column value is greater than 12000.
No rows. (*)
All rows whose SALARY column value is equal to 12000.
All rows in the table.
Incorrect. Refer to Section 3 Lesson 2.
3. What will happen when the following block is executed?
Mark for Review
DECLARE (1) Points
v_last employees.last_name%TYPE;
v_first employees.first_name%TYPE;
v_salary employees.salary%TYPE;
BEGIN
SELECT first_name, last_name
INTO v_first, v_last, v_salary
FROM employees WHERE employee_id=100;
END
The block will fail because V_LAST was declared before V_FIRST.
The block will fail because the SELECT is trying to read two columns into three
PL/SQL variables. (*)
The block will fail because the SELECT statement returns more than one row.
The block will execute successfully, and the V_SALARY variable will be set to NULL.
Correct
4. Which one of these SQL statements can be directly included in a PL/SQL executable
block? Mark for Review
(1) Points
SELECT salary FROM employees
WHERE department_id=60;
DELETE FROM employees
WHERE department_id=60;
(*)
CREATE TABLE new_emps (last_name VARCHAR2(10), first_name
VARCHAR2(10));
DROP TABLE locations;
Correct
5. A variable is declared as:
Mark for Review
DECLARE (1) Points
v_salary employees.salary%TYPE;
BEGIN
Which of the following is a correct use of the INTO clause?
SELECT salary
FROM employees
WHERE employee_id=100
INTO v_salary;
SELECT salary
INTO v_salary
FROM employees
WHERE employee_id=100;
(*)
SELECT salary
FROM employees
INTO v_salary;
SELECT v_salary
INTO salary
FROM employees
WHERE employee_id=100;
Correct
Page 1 of 3 Next Summary
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
6. Which implicit cursor attribute identifies the number of rows updated in the following
statement? Mark for Review
(1) Points
…
DBMS_OUTPUT.PUT_LINE(__________ || ' rows updated.');
…
SQLROW%COUNT
SQL%NUMBER
SQL%COUNT
SQL%ROWCOUNT (*)
Correct
7. There are three employees in department 90. What will be displayed when the
following code is executed? Mark for Review
(1) Points
DECLARE
v_open CHAR(3) := 'NO';
BEGIN
UPDATE employees SET job_id = 'ST_CLERK'
WHERE department_id = 90;
IF SQL%FOUND THEN
v_open := 'YES';
END IF;
DBMS_OUTPUT.PUT_LINE(v_open || ' ' || SQL%ROWCOUNT);
END;
YES 3 (*)
YES 1
NO 3
Nothing will be displayed. The block will fail because you cannot use implicit
cursor attributes directly in a call to DBMS_OUTPUT.PUT_LINE.
Correct
8. Which of the following SQL DML commands can be used inside a PL/SQL block?
Mark for Review
(1) Points
UPDATE and DELETE only.
INSERT and UPDATE only.
INSERT, UPDATE, and DELETE only.
INSERT, UPDATE, DELETE, and MERGE. (*)
Correct
9. You want to modify existing rows in a table. Which of the following are NOT needed in
your SQL statement? Mark for Review
(1) Points
The name of the table.
The name of the column(s) you want to modify.
A new value for the column you want to modify (this can be an expression or a
subquery).
An UPDATE clause.
A MODIFY clause. (*)
Correct
10. What would be the result of the following statement: DELETE FROM employees;
Mark for Review
(1) Points
The statement will fail because it contains a syntax error.
All rows in the employees table will be deleted. (*)
The row with EMPOYEE_ID=100 will be deleted.
Nothing, no data will be changed.
Incorrect. Refer to Section 3 Lesson 1.
Previous Page 2 of 3 Next Summary
Test: Section 3 Quiz
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
Section 3 Quiz
(Answer all questions in this section)
11. If a DELETE statement does not include a WHERE clause, all rows in the table are
deleted. True or False? Mark for Review
(1) Points
True (*)
False
Correct
12. What is wrong with the following statement?
DELETE from employees WHERE salary > (SELECT AVG(salary) FROM employees); Mark for Review
(1) Points
You cannot code a subquery inside a DELETE statement.
You cannot use inequality operators such as "<" and ">" inside a DELETE
statement.
Nothing is wrong, the statement will execute correctly. (*)
Correct
13. What will happen when the following statement is executed?
Mark for Review
UPDATE employees (1) Points
SET salary = 5000, commission_pct = NULL WHERE department_id = 50; ;
Assume there are no integrity constraint issues.
The statement fails because you cannot modify more than one column in a single
UPDATE statement.
All employees who have a salary of 5000 have their commission percentage set
to NULL.
All employees in department 50 have their salary changed to 5000 and their
commission percentage set to NULL. (*)
The statement fails because you cannot use NULL in the SET clause.
Correct
14. The following anonymous block of code is run:
Mark for Review
BEGIN (1) Points
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?
No data is inserted and an error occurs.
No data is inserted.
One record of data is inserted.
Two rows are inserted. (*)
Correct
15. How many INSERTs can you have in one transaction?
Mark for Review
(1) Points
As many as you want until a different DML statement (UPDATE, DELETE or
MERGE) is executed.
One
As many as you want until you do a COMMIT or ROLLBACK. (*)
As many as you can execute before the database does an AUTOSAVE.
Correct
Previous Page 3 of 3 Summary