Академический Документы
Профессиональный Документы
Культура Документы
Which of
the Mark for Review
following (1) Points
is NOT a
good
guideline
for
retrieving
data in
PL/SQL?
The WHERE clause is optional in nearly all cases. (*)
Declare the receiving variables using %TYPE
Specify the same number of variables in the INTO clause as database
columns in the SELECT clause.
THE SELECT statement should fetch exactly one row.
Correct
(*)
SELECT salary
INTO v_result
FROM employees;
SELECT salary
INTO v_result
FROM employees
WHERE department_id = 80;
SELECT salary
INTO v_result
FROM employees
WHERE last_name ='Smith';
Correct
3. Which rows will be deleted from the EMPLOYEES table when the following code is
Mark for Review
executed?
(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.
All rows in the table.
No rows. (*)
All rows whose SALARY column value is equal to 12000.
Correct
SELECT *
INTO v_holdit
FROM employees;
SELECT last_name
INTO v_holdit
FROM employees
WHERE employee_id=100;
(*)
SELECT last_name
INTO v_holdit
FROM employees;
SELECT salary
INTO v_holdit
FROM employees
WHERE employee_id=100;
Correct
5. The following code will return the last name of the employee whose employee id
is equal to 100: True or False? Mark for Review
(1) Points
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;
True
False (*)
Section 3 Quiz
(Answer all questions in this section)
6. What will happen when the following statement is executed?
Mark for Review
(1) Points
UPDATE employees
SET salary = 5000, commission_pct = NULL WHERE department_id = 50; ;
Assume there are no integrity constraint issues.
All employees who have a salary of 5000 have their commission percentage set to
NULL.
The statement fails because you cannot use NULL in the SET clause.
All employees in department 50 have their salary changed to 5000 and their
commission percentage set to NULL. (*)
The statement fails because you cannot modify more than one column in a single
UPDATE statement.
Correct
(*)
INSERT INTO student_table
VALUES (143354, 'Roberts', 'Cameron', 6543);
Correct
8. When INSERTing a row, the NULL keyword can be included in the VALUES (....) list.
True or False? Mark for Review
(1) Points
True (*)
False
Correct
9. Which of the following will delete all employees who work in the Sales department?
Mark for Review
(1) Points
DELETE FROM employees
WHERE department_id =
SELECT department_id
FROM departments
WHERE department_name = 'Sales';
DELETE FROM employees e, departments d
WHERE e.department_id = d.department_id
AND department_name = 'Sales';
DELETE (SELECT department_id
FROM
WHEREdepartments
department_name = 'Sales')
FROM employees;
DELETE FROM employees
WHERE department_id =
(SELECT department_id
FROM departments
WHERE department_name = 'Sales');
(*)
Correct
10. The MERGE statement will INSERT or DELETE rows in a target table based on matching
Mark for Review
values in a source table. True or False?
(1) Points
True
False (*)
Section 3 Quiz
(Answer all questions in this section)
11. Which of the following SQL DML commands can be used inside a PL/SQL block?
Mark for Review
(1) Points
INSERT and UPDATE only.
INSERT, UPDATE, and DELETE only.
INSERT, UPDATE, DELETE, and MERGE. (*)
UPDATE and DELETE only.
Correct
12. Assume there are 5 employees in Department 10. What happens when the following
Mark for Review
statement is executed?
(1) Points
UPDATE employees
SET salary=salary*1.1;
No rows are modified because you did not specify "WHERE department_id=10"
A TOO_MANY_ROWS exception is raised.
All employees get a 10% salary increase. (*)
An error message is displayed because you must use the INTO clause to hold the
new salary.
Correct
13. Employee_id 999 does not exist. What will happen when the following code is
Mark for Review
executed? (1) Points
DECLARE
employee_id employees.employee_id%TYPE := 999;
BEGIN
UPDATE employees SET salary = salary * 1.1
WHERE employee_id = employee_id;
END;
An exception is raised because the UPDATE statement did not modify any rows.
Every employee row is updated. (*)
No rows are updated but the block completes successfully.
An exception is raised because you cannot give a variable the same name as a
table column.
Correct
transaction.
Correct
Correct
Section 1
1.Procedural constructs give you better control of your SQL statements and their execution.
Mark for Review
True or False?
(1) Points
True (*)
False
Correct
Correct
Unnamed (*)
Can be declared as procedures or as functions
Correct
4.In a PL/SQL block, which of the following should not be followed by a semicolon?
Mark for Review
(1) Points
END
DECLARE (*)
Correct
5.Which lines of code will correctly display the message "The cat sat on the mat"? (Choose
Mark for Review
two.) (1) Points
Correct
1529962878748 1 Y Y 1843475966
Section 1
EXCEPTION
BEGIN (*)
DECLARE
END; (*)
Correct
True
False (*)
Correct
Proprietary
Processing
Primary
Procedural (*)
Correct
Section 2
9. Which of these are PL/SQL data types? (Choose three.) Mark for Review
(1) Points
LOB (*)
Composite (*)
Delimiter
Scalar (*)
Identifier
Correct
10.A datatype specifies and restricts the possible data values that can be assigned to a
Mark for Review
variable. True or False?
(1) Points
True (*)
False
Correct
1529962878748 2 Y Y 1843475966
Section 2
11.A variable defined in an outer block is global to the outer block and local to the inner
Mark for Review
block. True or False?
(1) Points
True
False (*)
Correct
12.If a variable definition is not found in an inner block where it is being referenced, where
Mark for Review
does it look for it?
(1) Points
Correct
13.If an outer block is labeled, the inner block must be labeled also. True or False?
Mark for Review
(1) Points
True
False (*)
Correct
completion_%
students_street_address (*)
Full Name
#hours
v_code (*)
Correct
They are sequences of characters including letters, digits, tabs, returns and symbols
(*)
They are optional but can make a PL/SQL block execute faster
Correct
1529962878748 3 Y Y 1843475966
Section 2
Code containing implicit conversions typically runs faster than code containing
explicit conversions. (*)
Code containing implicit conversions may not work in the future if Oracle changes
the conversion rules.
Correct
17.If today's date is 14th June 2007, which statement will correctly convert today's date to
Mark for Review
the value: June 14, 2007 ?
(1) Points
TO_CHAR(sysdate, 'Month DD, YYYY') (*)
TO_DATE(sysdate)
TO_CHAR(sysdate)
Correct
18.PL/SQL can implicitly convert a CHAR to a NUMBER, provided the CHAR contains a
Mark for Review
numeric value, for example '123'. True or False?
(1) Points
True (*)
False
Correct
19.The TO_CHAR function is used for explicit data type conversions. True or False?
Mark for Review
(1) Points
True (*)
False
Correct
20.Code is easier to read if you declare one identifier per line. True or False?
Mark for Review
(1) Points
True (*)
False
Correct
1529962878748 4 Y Y 1843475966
Section 2
21.If you are using the %TYPE attribute, you can avoid hard coding the:
Mark for Review
(1) Points
Column name
Table name
Constraint
Correct
Correct
23.Which good programming practice guideline would make this code easier to read?
Mark for Review
(1) Points
DECLARE
v_sal NUMBER(8,2);
BEGIN
Correct
Correct. (*)
Not correct.
Correct
25.Which of the following are required when declaring a variable? (Choose two.)
Mark for Review
(1) Points
NOT NULL
Correct
Review your answers, feedback, and question scores below. An asterisk (*) indicates a correct answer.
1529962878748 5 Y Y 1843475966
Section 2
(Answer all questions in this section)
26.When a variable is defined using the NOT NULL keywords, the variable must contain a
Mark for Review
value. True or False?
(1) Points
True (*)
False
Correct
Section 3
(Answer all questions in this section)
27.How many DML statements can be included in a single transaction?
Mark for Review
(1) Points
None. A transaction cannot include DML statements.
As many as needed (*)
A maximum of four DML statements
Only one
Correct
A DELETE statement
A SELECT statement that returns multiple rows (*)
A SELECT statement that returns one row
Correct
30.There are three employees in department 90. What will be displayed when the following
Mark for Review
code is executed?
(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 1
Nothing will be displayed. The block will fail because you cannot use implicit cursor
attributes directly in a call to DBMS_OUTPUT.PUT_LINE.
YES 3 (*)
NO 3
Correct
1529962878748 6 Y Y 1843475966
Section 3
(Answer all questions in this section)
31.Assume there are 5 employees in Department 10. What happens when the following
Mark for Review
statement is executed?
(1) Points
UPDATE employees
SET salary=salary*1.1;
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.
Correct
32.When INSERTing a row, the NULL keyword can be included in the VALUES (....) list. True
Mark for Review
or False?
(1) Points
True (*)
False
Correct
33.You want to modify existing rows in a table. Which of the following are NOT needed in
Mark for Review
your SQL statement?
(1) Points
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
34.Which one of these SQL statements can be directly included in a PL/SQL executable
Mark for Review
block?
(1) Points
(*)
DROP TABLE locations;
Correct
35.Which one of these SQL statements can be directly included in a PL/SQL executable
Mark for Review
block?
(1) Points
IF... THEN...;
SHOW USER;
1529962878748 7 Y Y 1843475966
Section 3
36.When used in a PL/SQL block, which SQL statement must return exactly one row?
Mark for Review
(1) Points
MERGE
UPDATE
SELECT (*)
DELETE
INSERT
Correct
Section 4
No lines
The block will fail because you cannot use DBMS_OUTPUT.PUT_LINE inside a loop.
Two lines
When the controlling condition must be evaluated at the start of each iteration
Correct
Correct
40.You can use a control structure to change the logical flow of the execution of SQL
Mark for Review
statements. True or False?
(1) Points
True (*)
False
Your browser does not support JavaScript. Please turn on JavaScript to use the features of this
web page.
1529962878748 8 Y Y 1843475966
Section 4
SELECT statements
EXCEPTIONS
Correct
ELSE is missing
Correct
43.What type of control structures are repetition statements that enable you to execute
statements in a PLSQL block repeatedly? Mark for Review
(1) Points
Loops (*)
CASE expressions
IF statements
CASE statements
Correct
44.What will be the value of variable c after the following code is executed?
Mark for Review
(1) Points
DECLARE
a BOOLEAN := TRUE;
b BOOLEAN := NULL;
c NUMBER;
BEGIN
IF a AND b THEN c := 2;
ELSIF a OR b THEN c := 0;
ELSE c := 1;
END IF;
END;
0 (*)
Null
Correct
Undefined (*)
Unequal
Equal
Correct
1529962878748 9 Y Y 1843475966
Section 4
46.When coding two nested loops, both loops must be of the same type. For example, you
Mark for Review
cannot code a FOR loop inside a WHILE loop. True or False?
(1) Points
True
False (*)
Correct
The outer loop must be labeled if you want to exit the outer loop from within the
inner loop. (*)
The outer loop must be labeled, but the inner loop need not be labeled.
Correct
48.Which one of these tasks is best done using a LOOP statement?
Mark for Review
(1) Points
Calculating and displaying the sum of all integers from 1 to 100 (*)
Correct
4 (*)
Correct
FOR loop
WHILE loop
Correct
Your browser does not support JavaScript. Please turn on JavaScript to use the features of this
web page.