MIDTERMS - Sheet1 Flashcards

1
Q

The ______ clause is used in DML statement to specify variable(s) that will hold the value(s) that SQL returns from the SELECT clause.

A

INTO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

The use of INTO clause in PL/SQL select statement is to specify the name of ________.

A

VARIABLE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The INTO clause occurs between the SELECT and _______ clauses.

A

FROM

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

The DML statement: INSERT, DELETE, ________ make changes to the database.

A

UPDATE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which SQL statements cannot be used directly in PL/SQL?
Group of answer choices

DDL, DCL

DML

TCL

DML, TCL

A

DDL, DCL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What could be the possible error of the given code below?

DECLARE

v_sal_increase employees.salary%TYPE := 800;

BEGIN

UPDATE copy_emp

SET salary = salary + v_sal_increase

WHERE job_id = ‘ST_CLERK’;

END;

Group of answer choices

WHERE section

Variable declaration

No error

SET section

A

No error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What could be the possible error of the given code below?

DECLARE

v_sal_increase employees.salary%TYPE = 800;

BEGIN

UPDATE copy_emp

SET salary = salary + v_sal_increase

WHERE job_id = ‘ST_CLERK’;

END;

Group of answer choices

SET section

No error

WHERE section

Variable declaration

A

Variable declaration

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

The memory area allocated by Oracle server to store the SQL statement and the data that it uses in known as:

A

Cursor

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

The use of CASE statement to test conditions such as <, >, >=, <= is know as case expression.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Applying the logical operator NOT to a null yields FALSE.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

The type of loop where the statement inside the loop must execute at least once.

A

BASIC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In BASIC and WHILE loop, the iteration will terminate when the counter is > than the upper bound.
Group of answer choices

True

False

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

In BASIC and WHILE loop, initialization of counter variable is necessary.

A

t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

The ______ is a Boolean attribute that evaluates to TRUE if the most recent SQL statement did not return even one row.

A

SQL%NOTFOUND

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The DDL and _______ SQL statements cannot be used directly in PL/SQL.

A

DCL

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

The _______cursor are automatically defined by Oracle.

A

IMPLICIT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What could be the possible error of the given code below?

DECLARE

v_salary employees.salary%TYPE;

BEGIN

SELECT salary INTO v_salary

FROM employees;

DBMS_OUTPUT.PUT_LINE(‘ Salary is : ‘ || v_salary);

END;

A

Query returns more than 1 row

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

The _______ statement selects rows from one table to update and/or insert into another table.
Group of answer choices

DML

COMBINE

MERGE

SELECT, INSERT, UPDATE

A

MERGE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

What is missing in the given code below?

DECLARE

v_salary employees.salary%TYPE;

BEGIN

SELECT salary INTO ________

FROM employees where employee_id = 100;

DBMS_OUTPUT.PUT_LINE(‘ Salary is : ‘ || v_salary);

END;

A

V_SALARY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What could be the possible error of the given code below?

DECLARE

v_sum_sal NUMBER(10,2);

v_deptno NUMBER NOT NULL := 60;

BEGIN

SELECT SUM(salary)

INTO v_sum_sal FROM employees WHERE department_id = v_deptno;

DBMS_OUTPUT.PUT_LINE(‘Dep #60 Salary Total: ‘ || v_sum_sal);

END;

A

No error

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Consider the given code fragment below. The condition will return a false value.

  A:=null; B:=null;

If A = B then . . . . .

A

t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

The BASIC LOOP control structures are statements that enable you to execute statements in a PL/SQL block repeatedly.
Group of answer choices

True

False

A

t

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

In for loop, counter must be explicitly declared.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

In BASIC and WHILE loop, the iteration will terminate when the counter is < than the upper bound.

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

The INTO clause occurs between the _______ and FROM clauses.

A

SELECT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

The memory area allocated by Oracle server to store the SQL statement and the data that it uses in known as __________.

A

IMPLICIT CURSOR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

Which DML statement make changes to the database?
Group of answer choices

INSERT

DELETE

All the options

UPDATE

A

All the options

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

The code below must print the number of rows updated, what is the missing part of the code?

Declare

v_cal_increase employees.salary%type := 800;

begin

update copy_emp

set salary = salary + v_sal_increase

where job_id = ‘ST_CLERK’;

dbms_output.put_line(_____________ || ‘ rows updated.’);

end;

A

SQL%ROWCOUNT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

The code below must print the number of rows updated. Which part of the code must be changed to satisfy the output?

Declare

v_sal_increase employees.salary%type := 800;

begin

update copy_emp

set salary = salary + v_sal_increase

where job_id = ‘ST_CLERK’;

dbms_output.put_line(SQL%FOUND || ‘ rows updated.’);

end;

A

SQL%FOUND

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Consider the given code fragment below. The condition will return a true value.

A:=null; B:=null;

If A = B then . . . . .

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

Applying the logical operator NOT to a null yields NULL.
Group of answer choices

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

In for loop, counter variable is declared _______.

A

IMPLICITLY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

Without the EXIT statement, the loop would never end (an infinite loop).

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
34
Q

All counter variables must be declared at the declaration section.
Group of answer choices

True

False

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
35
Q

An EXIT statement is used in order to come out of from the outer loop within an inner loop.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
36
Q

The _________ SQL Rule: queries must return only one row.

A

EMBEDDED

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
37
Q

The _____ is an integer value that represents the number of rows affected by the most recent SQL statement.

A

SQL%ROWCOUNT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
38
Q

The _____ statement selects rows from one table to update and/or insert into another table.

A

MERGE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
39
Q

The ______ are automatically declared variables that allow you to evaluate what happened when a cursor was last used.
Group of answer choices

Explicit attributes

Cursor attributes

Attributes

Implicit attributes

A

Cursor attributes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
40
Q

What could be the possible error of the given code below?

DECLARE

v_salary employees.salary%TYPE;

BEGIN

SELECT salary INTO v_salary

FROM employees where employee_id = 100;

DBMS_OUTPUT.PUT_LINE(‘ Salary is : ‘ || v_salary);

END;

Group of answer choices

VARIABLE ERROR

Query returns more than 1 row

TABLE ERROR

NO ERROR

A

NO ERROR

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
41
Q

A counter variable is an expression that returns true, false, or null.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
42
Q

What is missing in the given WHILE loop syntax? ________

WHILE condition

statement1;

statement2;

. . .

END ;

A

LOOP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
43
Q

A loop structure must have an exit clause.
Group of answer choices

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
44
Q

What could be the possible error of the given code below?

DECLARE

v_sum_sal NUMBER(10,2);

v_deptno NUMBER NOT NULL := 60;

BEGIN

SELECT SUM(salary) FROM employees WHERE department_id = v_deptno;

DBMS_OUTPUT.PUT_LINE(‘Dep #60 Salary Total: ‘ || v_sum_sal);

END;

Group of answer choices

Group function error

Query returns more than 1 row

Variable error

Missing INTO clause

A

Missing INTO clause

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
45
Q

Is there something missing in the given code?

DECLARE

 v_myage NUMBER := 31; 

BEGIN

IF v_myage < 11

DBMS_OUTPUT.PUT_LINE(‘I am a child’);

END IF;

END;

Group of answer choices

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
46
Q

A ________ is used in order to come out of from the outer loop within an inner loop.

A

LOOP LABELS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
47
Q

The lower and upper bound of a for loop must be a numeric literals.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
48
Q

The _________ cursors are defined by the PL/SQL programmer.

A

EXPLICIT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
49
Q

What is the output of the given code below?

DECLARE

v_deptno copy_emp.department_id%TYPE := 50;

BEGIN

DELETE FROM copy_emp

WHERE department_id = v_deptno;

DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ‘ rows deleted.’);

END;

A

Print the number of rows deleted

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
50
Q

Control structures are used to change the logical flow of statements within the PL/SQL block.
Group of answer choices

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
51
Q

Use the ______ loop when the statement inside the loop must execute at least once.

A

BASIC

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
52
Q

The use of INTO clause in PL/SQL select statement is to specify the name of: ____________.
Group of answer choices

VARIABLE

CURSOR

TABLE

VIEW

A

VARIABLE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
53
Q

The code below must print the number of rows deleted. What is missing in the given code to satisfy the output?

DECLARE

v_deptno copy_emp.department_id%TYPE := 50;

BEGIN

DELETE FROM copy_emp

WHERE _____________ = v_deptno;

DBMS_OUTPUT.PUT_LINE(SQL%ROWCOUNT || ‘ rows deleted.’);

END;

Group of answer choices

DEPARTMENT_ID

DEPARTMENTS

JOBS

JOB_ID

A

DEPARTMENT_ID

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
54
Q

Use a DO..WHILE loop when the statement inside the loop must execute at least once.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
55
Q

Start with the _____ keyword to define a user-defined record structure.

A

TYPE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
56
Q

Given:

        DECLARE

                  v_emp_record   \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_; 

What is missing in the declaration section if we want to declare v_emp_record as type record of EMPLOYEES table? __________

A

EMPLOYEES%ROWTYPE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
57
Q

The OPEN will populate the cursor’s active set with the result of the SELECT statement in the cursor’s definition?

True

False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
58
Q

The FETCH statement positions the cursor pointer at the first row.
Group of answer choices

True

False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
59
Q

What is missing in the given exception syntax? ____

EXCEPTION

     WHEN  exception1  [OR  exception2  .  .  .]

              statement1; statement2;
A

THEN

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
60
Q

Always add ________ whenever there is a possibility of an error occurring.

A

EXCEPTION HANDLERS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
61
Q

Handle named exceptions whenever possible, instead of using ______ in exception handlers.

A

OTHERS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
62
Q

Error in PL/SQL is known as ____________.

A

EXCEPTION

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
63
Q

Each ________ is consists of a WHEN clause, which specifies an exception name.

A

HANDLER

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
64
Q

When an exception is raised, control immediately shifts to the exception section and the appropriate handler in the exception section is executed.

True

False

A

t

65
Q

The term TRAP in exceptions is the same as handling any error by including corresponding exception handler.
Group of answer choices

True

False

A

True

66
Q

A block always terminates when PL/SQL raises an exception.
Group of answer choices

True

False

A

True

67
Q

An exception handler for a particular exception must contain only one statement.
Group of answer choices

True

False

A

True

68
Q

The RAISE keyword is used in user-defined exception for error notification.
Group of answer choices

True

False

A

True

69
Q

The PRAGMA clause is used in predefined exception to tell the compiler to associate an exception name with a specific Oracle error number.
Group of answer choices

True

False

A

False

70
Q

User-defined exceptions are declared within the declarative section and are raised explicitly.
Group of answer choices

True

False

A

t

71
Q

Non-predefined errors are raised explicitly.
Group of answer choices

True

False

A
72
Q

The RAISE statement can be used to raise either user-defined or non-predefined exception.
Group of answer choices

True

False

A

t

73
Q

The user-defined exceptions are declared within the declarative section and are raised implicitly.
Group of answer choices

True

False

A

False

74
Q

What is the first step in handing non-predefined exception?

Group of answer choices

Exception name declaration

Pragma declaration

A

Exception name declaration

75
Q

The RAISE statement can be used to raise either ________ or predefined exception.
Group of answer choices

USER-DEFINED

NON-PREDEFINED

A

USER-DEFINED

76
Q

The ________ clause is used in non-predefined exception to tell the compiler to associate an exception name with a specific Oracle error

Group of answer choices

PRAGMA EXCEPTION_INIT

SQLERRM

RAISE_APPLICATION_ERROR

SQLCODE

A

PRAGMA EXCEPTION_INIT

77
Q

Two methods for raising an exception:

Group of answer choices

Implicit, Explicit

Predefined, Non-predefined

A

Implicit, Explicit

78
Q

You can use the ________________ procedure to return user-defined error messages from stored subprograms.

Group of answer choices

RAISE_APPLICATION_ERROR

PRAGMA EXCEPTION_INIT

SQLCODE

SQLERRM

A

RAISE_APPLICATION_ERROR

79
Q

The following declaration is a PL/SQL syntax for defining a record.

Record_name table_name%rowtype;

Group of answer choices

True

False

A

t

80
Q

Type and record declared in the outer block are visible only in the outer block.
Group of answer choices

True

False

A

False

81
Q

A user-defined PL/SQL record contains one or more fields of scalar data type.
Group of answer choices

True

False

A

True

82
Q

The cursor defined in the code below is ____

DECLARE
CURSOR cur_emps IS
SELECT employee_id, last_name, salary FROM employees
WHERE department_id = 30;

Group of answer choices

IMPLICIT CURSOR

Explicit Cursor

A

Explicit Cursor

83
Q

Given the code below:

  1. DECLARE
  2. CURSOR cur_emps IS
  3. SELECT employee_id, last_name, salary FROM employees WHERE department_id = 30;
  4. v_empno employees.employee_id%TYPE;
  5. v_lname employees. last_name%TYPE;
  6. v_sal employees.salary%TYPE;
  7. BEGIN
  8. OPEN cur_emps;
  9. LOOP
  10. FETCH cur_emps INTO v_empno, v_lname;
  11. EXIT WHEN cur_emps%notfound;
  12. DBMS_OUTPUT.PUT_LINE( v_empno | | ‘ ‘ | | v_lname);
  13. END LOOP;
  14. END;

is line #12 valid or invalid

A

Valid

84
Q

The given code below declares an explicit cursor. What will cause an error in the code?

DECLARE

CURSOR cur_depts

SELECT * FROM departments WHERE location_id = 1700

ORDER BY department_name;

Group of answer choices

WHERE location_id = 1700

SELECT *

ORDER BY department_name;

IS

A

IS

85
Q

The block below will display the country name and the area of each country in a chosen region. The region_id should be passed to the cursor as a parameter.

  1. DECLARE
  2. CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
  3. SELECT country_name, area FROM ____ WHERE region_id = p_region_id;
  4. country_rec country_curs%ROWTYPE;
  5. BEGIN
  6. OPEN country_curs(____);
  7. LOOP
  8. FETCH country_curs INTO ______;
  9. EXIT WHEN ________%NOTFOUND;
  10. DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | 11. country_rec.area);
  11. END LOOP;
  12. CLOSE ______;
  13. END;

What is missing in line #3?

A

countries

86
Q

If you omit the ______ keyword, then the Oracle server waits indefinitely until the rows are available.

A

NOWAIT

87
Q

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

What is the parameter mode of the formal parameter?_____

A

IN

88
Q

The block below will display the country name and the area of each country in a chosen region. The region_id should be passed to the cursor as a parameter. The block is tested using region 5 (South America).

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

The missing element in in line 6 is Region_id.

A

False

89
Q

The NOWAIT keyword is optional in the FOR UPDATE clause.
Group of answer choices

True

False

A

True

90
Q
A

32/35

91
Q

What symbol is used to terminate the TYPE statement?

DECLARE

    TYPE person_dept IS . . . . . . . .
A

;

92
Q

What symbol is used to enclose the elements of the TYPE structure?

A

()

93
Q

Given the code below:

The closing of cursor is missing

True

False

A

True

94
Q

The OPEN statement positions the cursor pointer at the first row.

True

False

A

True

95
Q

The __________ keyword is used in user-defined exception for error notification.

A

RAISE

96
Q

Code that defines the recovery actions to be performed when execution-time errors occur.

A

EXCEPTION HANDLER

97
Q

The following statements are examples of ________________.

Entering an expiration date that has passed
Selecting more than one row into a single variable
Receiving “no rows returned” from a select statement

A

EXCEPTION

98
Q

The ___________ contains the exceptions handlers.

A

EXCEPTION SECTION

99
Q

The EXECUTE keyword is used in user-defined exception for error notification.
Group of answer choices

True

False

A

False

100
Q

When code does not work as expected, PL/SQL raises an exception handler.
Group of answer choices

True

False

A

False

101
Q

The OTHERS is an optional exception-handling clause that traps any exceptions that have not been explicitly handled.
Group of answer choices

True

False

A

True

102
Q

Names for predefined exceptions must be declared in the declaration section.
Group of answer choices

True

False

A
103
Q

The SQLCODE function returns the numeric value for the error code.
Group of answer choices

True

False

A

True

104
Q

You can use the RAISE_APPLICATION_ERROR procedure to return user-defined error messages from stored subprograms.
Group of answer choices

True

False

A

True

105
Q

Pragma declaration is used in declaring user-defined exceptions.
Group of answer choices

True

False

A

False

106
Q

What is the first parameter of the PRAGMA EXCEPTION_INIT function?

Group of answer choices

Oracle error number

EXCEPTION NAME

A

Oracle error number

107
Q

Each exception handler is consists of a _____ clause, which specifies an exception name.

Group of answer choices

IF

CONDITION

Not in the options

WHEN

A

WHEN

108
Q

In trapping a user-defined exception, these steps must be followed: DECLARE -> RAISE -> __________.

Group of answer choices

Reference

Identify Exception

Not in the options

Exception Handling

A

Reference

109
Q

In non-predefined exception, you must reference the ________ within a WHEN clause in the exception-handling section.

Group of answer choices

Exception name

Declared exception name

Oracle associated error#

All the options are possible

A

Declared exception name

110
Q

PL/SQL record is a composite data type, you can refer to the whole record by its name and/or to individual fields by their names.
Group of answer choices

True

False

A

True

111
Q

The given syntax in declaring a user-define record is correct.

TYPE type_name IS RECORD

(field_declaration[,field_declaration]…);

identifier type_name ;

Group of answer choices

True

False

A

True

112
Q

COMPOSITE

A

True

113
Q
  1. DECLARE
  2. CURSOR cur_emps IS
  3. SELECT employee_id, last_name, salary FROM employees WHERE department_id =30;
  4. v_empno employees.employee_id%TYPE;
  5. v_lname employees.last_name%TYPE;
  6. v_sal employees.salary%TYPE;
  7. BEGIN
  8. OPEN cur_emps;
  9. LOOP
  10. FETCH cur_emps INTO v_empno, v_lname;
  11. EXIT WHEN cur_emps%notfound;
  12. DBMS_OUTPUT.PUT_LINE( v_empno | | ‘ ‘ | | v_lname);
  13. END LOOP;
  14. END

which line number(s) contains error?

Line 2

Line 4

No error

Line 3

A

Line 3

114
Q

Given the code below:

DECLARE

 CURSOR cur_emps

                SELECT employee_id, last_name  FROM employees;

BEGIN

FOR v_emp_record IN cur_emps LOOP 

EXIT WHEN cur_emps%ROWCOUNT > 5;

DBMS_OUTPUT.PUT_LINE(v_emp_record.employee_id || ' ' || v_emp_record.last_name);

END LOOP;

END;

What step is missing in the given code?

Group of answer choices

CLOSE

FETCH

Nothing is missing

Open cursor

A

Nothing is missing

115
Q

Given the code below:

  1. DECLARE
  2. CURSOR cur_emps
  3. SELECT employee_id, last_name FROM employees;
  4. BEGIN
  5. FOR cur_emps IN v_emp_record LOOP
  6. EXIT WHEN cur_emps%ROWCOUNT > 5;
  7. DBMS_OUTPUT.PUT_LINE(v_emp_record.employee_id || ‘ ‘ || v_emp_record.last_name);
  8. END LOOP;
  9. END;

What is missing in line 2 and 3?

INTO

IS

Nothing is missing

RECORD

A

IS

116
Q

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO _____;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

What is missing in line #8

A

country_rec

117
Q

DECLARE
CURSOR country_curs(_____ countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

What is missing in line#2?

A

p_region_id

118
Q

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec _____%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

What is missing in line #4

A

country_curs

119
Q

Refer to the code below. The missing element in line 8 COUNTRY_REC.

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO _____;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

True

False

A

True

120
Q

TYPE and Records are ________ structures.

A

COMPOSITE

121
Q

A ________ allows us to declare a variable as a record based on a particular table’s structure.

A

%ROWTYPE

122
Q

Use the %ISOPEN cursor attribute before performing a fetch to test whether the cursor is open.
Group of answer choices

True

False

A

True

123
Q

Each exception handler is consists of a _____ clause, which specifies an exception name.

A

WHEN

124
Q

The term ________ in exceptions is the same as handling any error by including corresponding exception handler.

A

TRAP

125
Q

Exception handlers are code that defines the recovery actions to be performed when execution-time errors occur.
Group of answer choices

True

False

A

True

126
Q

When an exception is raised, the rest of the execution section of the PL/SQL block is not executed.
Group of answer choices

True

False

A

True

127
Q

You can use the EXCEPTION_INIT procedure to return user-defined error messages from stored subprograms.
Group of answer choices

True

False

A

False

128
Q

Pragma declaration is used in declaring non-predefined exceptions.
Group of answer choices

True

False

A

t

129
Q

The NO_DATA_FOUND is an example of:

Group of answer choices

Non-predefined exception

Predefined exception

A

Predefined exception

130
Q

The RAISE_APPLICATION_ERROR can be used in:

Group of answer choices

Declaration and Exception section

Executable and Exception section

Executable section

Exception section

A

Executable and Exception section

131
Q

The oracle error number, at the PRAGMA EXCEPTION_INIT function, starts with _____.

Group of answer choices

0

HYPEN

1

UNDERSCORE

A

HYPEN

132
Q

The given syntax in declaring a user-define record is incorrect.

TYPE type_name IS RECORD

(field_declaration[,field_declaration]…);

identifier type_name ;

Group of answer choices

True

False

A

False

133
Q

Given the code below, EMPLOYEES table must be specified at the DBMS_OUTPUT section.

DECLARE

        v_emp_record employees2%rowtype; 

BEGIN

SELECT * INTO v_emp_record FROM employees2 WHERE employee_id = 100;

DBMS_OUTPUT.PUT_LINE(‘Email for ‘ || _____________.first_name || ‘ ‘ || ____________.last_name);

END;

Group of answer choices

True

False

A

True

134
Q
  1. DECLARE
  2. CURSOR cur_emps IS
  3. SELECT employee_id, last_name, salary FROM employees WHERE department_id =30;
  4. v_empno employees.employee_id%TYPE;
  5. v_lname employees.last_name%TYPE;
  6. v_sal employees.salary%TYPE;
  7. BEGIN
  8. OPEN cur_emps;
  9. LOOP
  10. FETCH cur_emps INTO v_empno, v_lname;
  11. EXIT WHEN cur_emps%_____;
  12. DBMS_OUTPUT.PUT_LINE( v_empno | | ‘ ‘ | | v_lname);
  13. END LOOP;
  14. END;

What is missing in line#11?

Group of answer choices

FOUND

NOTFOUND

A

NOTFOUND

135
Q

Given the code below:

DECLARE

 CURSOR cur_emps

                SELECT employee_id, last_name  FROM employees;

BEGIN

FOR  cur_emps IN v_emp_record LOOP 

EXIT WHEN cur_emps%ROWCOUNT > 5;

DBMS_OUTPUT.PUT_LINE(v_emp_record.employee_id || ' ' || v_emp_record.last_name);

END LOOP;

END;

What will cause an error in the FOR section?

Group of answer choices

No error

cur_emps IN v_emp_record

Counter declaration

Remove LOOP

A

cur_emps IN v_emp_record

136
Q

Given the code below, assume that the cursor contains 20 rows. How many rows will be fetched from the cursor?

  1. DECLARE
  2. CURSOR cur_emps
  3. SELECT employee_id, last_name FROM employees;
  4. BEGIN
  5. FOR cur_emps IN v_emp_record LOOP
  6. EXIT WHEN cur_emps%ROWCOUNT > 5;
  7. DBMS_OUTPUT.PUT_LINE(v_emp_record.employee_id || ‘ ‘ || v_emp_record.last_name);
  8. END LOOP;
  9. END;

Group of answer choices

0

5

6

4

A

5

137
Q

The block below will display the country name and the area of each country in a chosen region. The region_id should be passed to the cursor as a parameter. The block is tested using region 5 (South America).

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN _______;
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

How many parameter is needed to be passed from the calling environment? _____

A

1

138
Q

You must include the FOR UPDATE clause in the cursor query so that the rows are _____ on OPEN.

A

LOCKED

139
Q

Refer to the code below. The missing element in line 9 is COUNTRY_REC.

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN _______;
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN ______%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

True

False

A
140
Q

You must include the FOR UPDATE clause in the cursor query so that the rows are locked on OPEN.
Group of answer choices

True

False

A

True

141
Q

Given the code below:

DECLARE

        v_emp_record employees%rowtype; 

BEGIN

SELECT * INTO v_emp_record FROM employees WHERE employee_id = 100;

DBMS_OUTPUT.PUT_LINE(‘Email for ‘ || _____________.first_name ||

’ ‘ || ____________.last_name);

END;

What is missing in the DBMS_OUTPUT section?

A

v_emp_record

142
Q

Given the declaration below:

DECLARE

TYPE person_dept IS _________

first_name employees.first_name%TYPE,

last_name employees.last_name%TYPE,

department_name departments.department_name%TYPE;

What is missing in the TYPE section?__________

A

RECORD

143
Q

The FETCH will populate the cursor’s active set with the result of the SELECT statement in the cursor’s definition?
Group of answer choices

True

False

A
144
Q
  1. DECLARE
  2. CURSOR cur_emps IS
  3. SELECT employee_id, last_name, salary FROM employees WHERE department_id =30;
  4. v_empno employees.employee_id%TYPE;
  5. v_lname employees.last_name%TYPE;
  6. v_sal employees.salary%TYPE;
  7. BEGIN
  8. OPEN cur_emps;
  9. LOOP
  10. FETCH cur_emps INTO v_empno, v_lname;
  11. EXIT WHEN cur_emps%NOTFOUND;
  12. DBMS_OUTPUT.PUT_LINE( v_empno | | ‘ ‘ | | v_lname);
  13. END LOOP;
  14. END;

The cursor declaration is correct.

Group of answer choices

True

False

A

t

145
Q

The exception section begins with the keyword _______.

A

EXCEPTION

146
Q

In exception section, the WHEN clause if followed by _______.

A

THEN

147
Q

Each exception handler is consists of a WHEN clause, which specifies an exception name.
Group of answer choices

True

False

A

t

148
Q

Exception section is mandatory in PL/SQL block.
Group of answer choices

True

False

A

False

149
Q

The following statements are examples of exception handler.

Entering an expiration date that has passed
Selecting more than one row into a single variablE
Receiving “no rows returned” from a select statement
Group of answer choices

True

False

A

False

150
Q

The RAISE statement can be used to raise either user-defined or predefined exception.
Group of answer choices

True

False

A
151
Q

The _______________ is used in non-predefined exception to tell the compiler to associate an exception name with a specific Oracle error

Group of answer choices

PRAGMA EXCEPTION_INIT

EXCEPTION_INIT

PRAGMA EXCEPTION INIT

EXCEPTION INIT

A

PRAGMA EXCEPTION_INIT

152
Q

The ___________ and ___________ are the two types of Oracle Server Errors.

Group of answer choices

Predefined, Non-predefined

Implicit, Explicit

A

Predefined, Non-predefined

153
Q

The RAISE statement can be used to raise either user-defined or ________ exception.

Group of answer choices

PREDEFINED

NON-PREDEFINED

A

NON-PREDEFINED

154
Q

Types and records are composite structures that can be declared anywhere that scalar variables can be declared.
Group of answer choices

True

False

A

t

155
Q

Given the code below, EMPLOYEES%ROWTYPE is missing in the declaration section to declare v_emp_record as type record of EMPLOYEES table.

DECLARE

           v_emp_record    \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_;

Group of answer choices

True

False

A

t

156
Q

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(1);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

What is the counter variable?

A

NONE

157
Q

The block below will display the country name and the area of each country in a chosen region. The region_id should be passed to the cursor as a parameter. Test the block using region 5 (South America).

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(_);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

What is missing in line#6?

A

5

158
Q

When we declare a cursor FOR UPDATE, each row is locked as we open the cursor and prevent other users from reading the rows.
Group of answer choices

True

False

A

False

159
Q

The block below will display the country name and the area of each country in a chosen region. The region_id should be passed to the cursor as a parameter. Test the block using region 5 (South America).

DECLARE
CURSOR country_curs(p_region_id countries.region_id%TYPE) IS
SELECT country_name, area FROM countries WHERE region_id = p_region_id;
country_rec country_curs%ROWTYPE;
BEGIN
OPEN country_curs(_);
LOOP
FETCH country_curs INTO country_rec;
EXIT WHEN country_curs%NOTFOUND;
DBMS_OUTPUT.PUT_LINE(‘Name: ‘ | | country_rec.country_name | | ‘ Area: ‘ | | country_rec.area);
END LOOP;
CLOSE country_curs;
END;

The missing element in in line 6 is 1.

True

False

A

False