Section 6
					
		1. 	The following code does not violate any constraints and will not raise an ORA-02292 error. What will happen when the code is executed?

BEGIN
    DECLARE
       e_constraint_violation EXCEPTION;
       PRAGMA EXCEPTION_INIT(e_constraint_violation, -2292);
    BEGIN
       DBMS_OUTPUT.PUT_LINE('Inner block message');
    END;
EXCEPTION
    WHEN e_constraint_violation THEN
       DBMS_OUTPUT.PUT_LINE('Outer block message');
END;
	Mark for Review 
(1) Points
					
			
	Inner block message' will be displayed.
	
			
	The code will fail because the exception is declared in the inner block but is referenced in the outer block. (*)
	
			
	Outer block message' will be displayed.
	
			
	The code will fail because line 4 should read: PRAGMA EXCEPTION_INIT(-2292, e_constraint_violation);
	
					
				
Correct		Correct
	
					
		2. 	Using nested blocks, when is it necessary to label the outer block?. 	Mark for Review 
(1) Points
					
			
	You must always label the outer block.
	
			
	You must always label both blocks.
	
			
	You must label the outer block when two variables with the same name are declared, one in each block.
	
			
	You must label the outer block when two variables with the same name are declared and you need to reference the outer block's variable within the inner block. (*)
	
			
	Block labels are just comments and are therefore recommended but never needed.
	
					
				
Correct		Correct
	
					
		3. 	Using two nested blocks, a TOO_MANY_ROWS exception is raised within the inner block. Which of the following exception handlers will successfully handle the exception? 	Mark for Review 
(1) Points
					
			
	WHEN TOO_MANY_ROWS in the inner block
	
			
	WHEN TOO_MANY_ROWS in either block
	
			
	WHEN OTHERS in either block
	
			
	WHEN OTHERS in the inner block
	
			
	All of the above (*)
	
					
				
Correct		Correct
	
					
		4. 	Examine the following code. What is the scope and visibility of the outer block's v_last_name?

DECLARE
    v_last_name VARCHAR2(20);
BEGIN
    DECLARE
       v_last_name VARCHAR2(20);
    BEGIN
       ...
    END:
    ...
END;
	Mark for Review 
(1) Points
					
			
	It is in scope and visible in both blocks.
	
			
	It is in scope and visible in the outer block only.
	
			
	It is in scope in both blocks, but visible only in the outer block. (*)
	
			
	It is visible in both blocks, but in scope only in the outer block.
	
					
				
Correct		Correct
	
					
		5. 	Which of the following will display the value 'Smith'? 	Mark for Review 
(1) Points
					
			
	<<outer>>
DECLARE
    v_name VARCHAR2(10) := 'Smith';
BEGIN
    DECLARE
       v_name VARCHAR2(10) := 'Jones';
    BEGIN
       DBMS_OUTPUT.PUT_LINE(v_name);
    END;
END;

	
			
	<<outer>>
DECLARE
    v_name VARCHAR2(10) := 'Smith';
BEGIN
    DECLARE
       v_name VARCHAR2(10) := 'Jones';
    BEGIN
       DBMS_OUTPUT.PUT_LINE(<<outer>>.v_name);
    END;
END;

	
			
	<<outer>>
DECLARE
    v_name VARCHAR2(10) := 'Smith';
BEGIN
    DECLARE
       v_name VARCHAR2(10) := 'Jones';
    BEGIN
       DBMS_OUTPUT.PUT_LINE(outer.v_name);
    END;
END;

(*)
	
			
	<<outer>>
DECLARE
    v_name VARCHAR2(10) := 'Smith';
BEGIN
    <<inner>>
    DECLARE
       v_name VARCHAR2(10) := 'Jones';
    BEGIN
       DBMS_OUTPUT.PUT_LINE(v_name);
    END;
END;

	
					
				
Correct		Correct
	
					
		6. 	Examine the following code which shows three levels of nested block. What is the scope of the variable v_middle_var?

DECLARE -- outer block
    v_outer_var NUMBER;
BEGIN
    DECLARE -- middle block
       v_middle_var NUMBER;
    BEGIN
       DECLARE -- inner block
          v_inner_var NUMBER;
       BEGIN
          ...
       END;
    END;
END;
	Mark for Review 
(1) Points
					
			
	All three blocks
	
			
	Middle and outer blocks only
	
			
	Middle and inner blocks only (*)
	
			
	Middle block only
	
			
	None of the above
	
					
				
Correct		Correct
	
					
		7. 	Which of the following will successfully return a user-defined error message? 	Mark for Review 
(1) Points
					
			
	RAISE_APPLICATION_ERROR('Error Raised',-22001);
	
			
	RAISE_APPLICATION_ERROR(-20257,'Error raised'); (*)
	
			
	RAISE_APPLICATION_ERROR(-22001,'Error Raised');
	
			
	RAISE_APPLICATION_ERROR('Error Raised',-20257);
	
					
				
Correct		Correct
	
					
		8. 	There are no employees in department_id 99. What output will be displayed when the following code is executed?

DECLARE
    v_count NUMBER;
BEGIN
    SELECT COUNT(*) INTO v_count
       FROM employees WHERE department_id = 99;
    IF v_count = 0 THEN
       RAISE NO_DATA_FOUND;
       DBMS_OUTPUT.PUT_LINE('No employees found');
    END IF;
EXCEPTION
    WHEN NO_DATA_FOUND THEN
       DBMS_OUTPUT.PUT_LINE('Department 99 is empty');
END;
	Mark for Review 
(1) Points
					
			
	No employees found
	
			
	No employees found Department 99 is empty
	
			
	Department 99 is empty (*)
	
			
	The block will fail because you cannot explicitly RAISE a predefined Oracle Server error such as NO_DATA_FOUND
	
					
				
Correct		Correct
	
					
		9. 	There are no employees in department 99. What message or messages will be displayed when the following code is executed?

DECLARE
    e_my_excep EXCEPTION;
BEGIN
    BEGIN
       UPDATE employees SET salary = 10000
          WHERE department_id = 99;
       IF SQL%ROWCOUNT = 0 THEN
          RAISE e_my_excep;
       END IF;
    EXCEPTION
       WHEN e_my_excep THEN
          DBMS_OUTPUT.PUT_LINE('Message 1');
          RAISE e_my_excep;
          DBMS_OUTPUT.PUT_LINE('Message 2');
    END;
    DBMS_OUTPUT.PUT_LINE('Message 3');
EXCEPTION
    WHEN e_my_excep THEN
       DBMS_OUTPUT.PUT_LINE('Message 4');
END;
	Mark for Review 
(1) Points
					
			
	Message 1
Message 3

	
			
	Message 1
Message 2

	
			
	Message 1
Message 3
Message 4

	
			
	Message 1
Message 4

(*)
	
					
				
Correct		Correct
	
					
		10. 	User-defined exceptions must be declared explicitly by the programmer, but then are raised automatically by the Oracle Server. True or False? 	Mark for Review 
(1) Points
					
			
	True
	
			
	False (*)
	
					
				
Correct		Correct 
11. 	Which of the following best describes a PL/SQL exception? 	Mark for Review 
(1) Points
					
			
	A user enters an invalid password while trying to log on to the database.
	
			
	An error occurs during execution which disrupts the normal operation of the program. (*)
	
			
	A DML statement does not modify any rows.
	
			
	The programmer makes a spelling mistake while writiing the PL/SQL code.
	
					
				
Correct		Correct
	
					
		12. 	Which of the following are good practice guidelines for exception handling? (Choose three.) 	Mark for Review 
(1) Points
					
			(Choose all correct answers)	
					
			
	Test your code with different combinations of data to see what potential errors can happen. (*)
	
			
	Use an exception handler whenever there is any possibility of an error occurring. (*)
	
			
	Include a WHEN OTHERS handler as the first handler in the exception section.
	
			
	Allow exceptions to propagate back to the calling environment.
	
			
	Handle specific named exceptions where possible, instead of relying on WHEN OTHERS. (*)
	
					
				
Correct		Correct
	
					
		13. 	Which of these exceptions can be handled by an EXCEPTION section in a PL/SQL block? 	Mark for Review 
(1) Points
					
			
	A SELECT statement returns no rows
	
			
	A SELECT statement returns more than one row
	
			
	Any other kind of exception that can occur within the block
	
			
	All of the above (*)
	
			
	None of the above
	
					
				
Correct		Correct
	
					
		14. 	Which of the following EXCEPTION sections are constructed correctly? (Choose two.) 	Mark for Review 
(1) Points
					
			(Choose all correct answers)	
					
			
	EXCEPTION
    WHEN NO_DATA_FOUND THEN statement_1;
    WHEN OTHERS THEN statement_2;
END;

(*)
	
			
	EXCEPTION
    WHEN OTHERS THEN statement_2;
    WHEN NO_DATA_FOUND THEN statement_1;
END;

	
			
	EXCEPTION
    WHEN NO_DATA_FOUND THEN statement_1;
    WHEN NO_DATA_FOUND THEN statement_2;
    WHEN OTHERS THEN statement_3;
END;

	
			
	EXCEPTION
    WHEN OTHERS THEN statement_1;
END;

(*)
	
					
				
Correct		Correct
	
					
		15. 	Which of the following best describes a user-defined exception? 	Mark for Review 
(1) Points
					
			
	A predefined Oracle Server error such as NO_DATA_FOUND
	
			
	A non-predefined Oracle Server error such as ORA-01400
	
			
	An error which is not automatically raised by the Oracle server (*)
	
			
	Any error which has an Oracle error number of the form ORA-nnnnn
	
					
				
Correct		Correct
	
					
		16. 	Which kinds of exceptions are raised implicitly (i.e., automatically)? (Choose two.) 	Mark for Review 
(1) Points
					
			(Choose all correct answers)	
					
			
	Predefined Oracle Server errors such as NO_DATA_FOUND (*)
	
			
	User-defined errors
	
			
	All errors
	
			
	Non-predefined Oracle Server errors such as ORA-01400 (*)
	
					
				
Correct		Correct
	
					
		17. 	Examine the followiing code. Which exception handlers would successfully trap the exception which will be raised when this code is executed? (Choose two.)

DECLARE
    CURSOR emp_curs IS SELECT * FROM employees;
    v_emp_rec emp_curs%ROWTYPE;
BEGIN
    FETCH emp_curs INTO v_emp_rec;
    OPEN emp_curs;
    CLOSE emp_curs;
EXCEPTION ...
END;
	Mark for Review 
(1) Points
					
			(Choose all correct answers)	
					
			
	WHEN CURSOR_NOT_OPEN
	
			
	WHEN INVALID_CURSOR (*)
	
			
	WHEN OTHERS (*)
	
			
	WHEN NO_DATA_FOUND
	
			
	WHEN INVALID_FETCH
	
					
				
Incorrect		Incorrect. Refer to Section 6.
	
					
		18. 	The following exception handler will successfully insert the Oracle error number and error message into a log table whenever an Oracle Server error occurs. True or False?

EXCEPTION
    WHEN OTHERS THEN
       INSERT INTO err_log_table (num_col, char_col)
          VALUES (SQLCODE, SQLERRM);
END;

(Assume that err_log_table has been created with suitable columns and datatypes.)
	Mark for Review 
(1) Points
					
			
	True
	
			
	False (*)
	
					
				
Correct		Correct
	
					
		19. 	Examine the following code fragment. At Line A, you want to raise an exception if the fetched salary value is greater than 30000. How can you do this?

DECLARE
    v_salary employees.salary%TYPE;
BEGIN
    SELECT salary INTO v_salary FROM employees
       WHERE employee_id = 100;
    IF v_salary > 30000 THEN
       -- Line A
    END IF;
...
	Mark for Review 
(1) Points
					
			
	Test for WHEN VALUE_TOO_HIGH in the exception section.
	
			
	Use RAISE_APPLICATION_ERROR to raise an exception explicitly. (*)
	
			
	Test for WHEN OTHERS in the exception section, because WHEN OTHERS traps all exceptions.
	
			
	Define an EXCEPTION variable and associate it with an Oracle Server error number using PRAGMA EXCEPTION_INIT.
	
					
				
Correct		Correct
	
					
		20. 	Which of the following best describes a predefined Oracle Server error? 	Mark for Review 
(1) Points
					
			
	Has a standard Oracle error number but must be named by the PL/SQL programmer
	
			
	Is not raised automatically but must be declared and raised explicitly by the PL/SQL programmer
	
			
	Has a standard Oracle error number and a standard name which can be referenced in the EXCEPTION section (*)
	
			
	Is associated with an Oracle error number using PRAGMA EXCEPTION_INIT
	
					
				
Correct		Correct 
21. 	Which of the following is NOT correct coding for a procedure parameter? 	Mark for Review 
(1) Points
					
			
	(p_param IN VARCHAR2)
	
			
	(p_param VARCHAR2)
	
			
	(p_param VARCHAR2(50)) (*)
	
			
	(p_param employees.last_name%TYPE)
	
			
	(p_param IN OUT VARCHAR2)
	
					
				
Correct		Correct
	
					
		22. 	You have created the following procedure:
CREATE OR REPLACE PROCEDURE double_it
(p_param IN OUT NUMBER)
IS
BEGIN
p_param := p_param * 2;
END;
Which of the following anonymous blocks invokes this procedure successfully? 	Mark for Review 
(1) Points
					
			
	BEGIN
EXECUTE double_it(20);
END;
	
			
	BEGIN
SELECT double_it(20)
FROM DUAL;
END;
	
			
	DECLARE
v_result NUMBER(6);
BEGIN
v_result := double_it(20);
END;
	
			
	DECLARE
v_result NUMBER(6) := 20;
BEGIN
double_it(v_result);
END; (*)
	
			
	BEGIN
double_it(20);
END;
	
					
				
Correct		Correct
	
					
		23. 	Which of the following statements about actual parameters is NOT true? 	Mark for Review 
(1) Points
					
			
	An actual parameter is declared in the calling environment, not in the called procedure
	
			
	An actual parameter must be the name of a variable (*)
	
			
	An actual parameter can have a Boolean datatype
	
			
	The datatypes of an actual parameter and its formal parameter must be compatible
	
			
	An actual parameter can have a TIMESTAMP datatype
	
					
				
Correct		Correct
	
					
		24. 	Examine the following procedure:
CREATE OR REPLACE PROCEDURE smallproc
(p_param IN NUMBER)
IS
BEGIN ....
The procedure is invoked by:
DECLARE
v_param NUMBER := 20;
BEGIN
smallproc(v_param);
END;
Which of the following statements is true? 	Mark for Review 
(1) Points
					
			
	p_param is a parameter and v_param is an argument
	
			
	p_param is a formal parameter and 20 is an actual parameter
	
			
	p_param is a formal parameter and v_param is an actual parameter (*)
	
			
	p_param and v_param are both formal parameters, while 20 is an actual parameter
	
			
	p_param is an actual parameter and v_param is a formal parameter
	
					
				
Correct		Correct
	
					
		25. 	You want to create a procedure named SOMEPROC which accepts a single parameter named SOMEPARM. The parameter can be up to 100 characters long. Which of the following is correct syntax to do this? 	Mark for Review 
(1) Points
					
			
	CREATE PROCEDURE someproc
    (someparm varchar2)
IS
BEGIN ...
(*)
	
			
	CREATE PROCEDURE someproc
    (someparm varchar2(100) )
IS
BEGIN...
	
			
	CREATE PROCEDURE someproc
IS
    (someparm VARCHAR2)
BEGIN...
	
			
	CREATE PROCEDURE someproc
    someparm varchar2(100);
IS
    BEGIN...

	
			
	CREATE PROCEDURE someproc
    (someparm 100)
IS
BEGIN ...
	
					
				
Incorrect		Incorrect. Refer to Section 7.
	
					
		26. 	You have created procedure MYPROC with a single parameter PARM1 NUMBER. Now you want to add a second parameter to the procedure. Which of the following will change the procedure successfully? 	Mark for Review 
(1) Points
					
			
	ALTER PROCEDURE myproc ADD (parm2 NUMBER);
	
			
	The procedure cannot be modified. Once a procedure has been created, the number of parameters cannot be changed.
	
			
	CREATE OR REPLACE PROCEDURE someproc
(parm1 NUMBER, parm2 NUMBER);
(You do not need to repeat the detailed code of the procedure, only the header)
	
			
	REPLACE PROCEDURE someproc
(parm1 NUMBER, parm2 NUMBER)
IS
BEGIN ...
	
			
	CREATE OR REPLACE PROCEDURE MYPROC
(parm1 NUMBER, parm2 NUMBER)
IS
BEGIN ... (*)
	
					
				
Correct		Correct
	
					
		27. 	Suppose you set up a parameter with an explicit IN mode. What is true about that parameter? 	Mark for Review 
(1) Points
					
			
	It must have a DEFAULT value.
	
			
	It cannot have a DEFAULT value.
	
			
	It acts like a constant (its value cannot be changed inside the subprogram). (*)
	
			
	It must be the same type as the matching OUT parameter.
	
			
	It inherits its type from the matching OUT parameter.
	
					
				
Correct		Correct
	
					
		28. 	The following procedure has been created:

CREATE OR REPLACE PROCEDURE myproc
(A IN NUMBER := 20,
B IN NUMBER,
C IN NUMBER DEFAULT 30)
IS .....
Which of the following will invoke the procedure correctly?
	Mark for Review 
(1) Points
					
			
	myproc(40);
	
			
	myproc(10, B => 30, 50);
	
			
	myproc(C => 25);
	
			
	All of the above
	
			
	None of the above (*)
	
					
				
Incorrect		Incorrect. Refer to Section 7.
	
					
		29. 	Procedure SOMEPROC has five parameters named A, B, C, D, E in that order. The procedure was called as follows:

SOMEPROC(10,20,D=>50);

How was parameter D referenced?
	Mark for Review 
(1) Points
					
			
	Positionally
	
			
	Named (*)
	
			
	A combination of positionally and named
	
			
	A combination of named and defaulted
	
			
	Defaulted
	
					
				
Correct		Correct
	
					
		30. 	Which parameter mode is the default? 	Mark for Review 
(1) Points
					
			
	IN (*)
	
			
	OUT
	
			
	NUMBER
	
			
	VARIABLE
	
			
	CONSTANT
	
					
				
Correct		Correct 
31. 	A programmer wants to create a PL/SQL procedure named EMP_PROC. What will happen when the following code is executed?

CREATE OR REPLACE PROCEDURE emp_proc IS
    v_salary employees.salary%TYPE;
BEGIN
    SELECT salary INTO v_salary FROM employees
       WHERE employee_id = 999;
    DBMS_OUTPUT.PUT_LINE('The salary is: ' || v_salary);
END;

	Mark for Review 
(1) Points
					
			
	The statement will raise a NO_DATA_FOUND exception because employee_id 999 does not exist.
	
			
	The statement will fail because the last line of code should be END emp_proc;
	
			
	The statement will fail because you cannot declare variables such as v_salary inside a procedure.
	
			
	The procedure will be created successfully. (*)
	
			
	The statement will fail because the procedure does not have any parameters.
	
					
				
Incorrect		Incorrect. Refer to Section 7.
	
					
		32. 	Which of the following are benefits of using PL/SQL subprograms rather than anonymous blocks? (Choose three.) 	Mark for Review 
(1) Points
					
			(Choose all correct answers)	
					
			
	Easier to write
	
			
	Better data security (*)
	
			
	Easier code maintenance (*)
	
			
	Faster performance (*)
	
			
	Do not need to declare variables
	
					
				
Correct		Correct
	
					
		33. 	Which of the following are characteristics of PL/SQL subprograms but not of anonymous PL/SQL blocks? (Choose three.) 	Mark for Review 
(1) Points
					
			(Choose all correct answers)	
					
			
	Can take parameters (*)
	
			
	Are stored in the database (*)
	
			
	Can begin with the keyword DECLARE
	
			
	Are named (*)
	
			
	Are compiled every time they are executed
	
					
				
Correct		Correct
	
					
		34. 	Which of the following are characteristics of PL/SQL stored procedures? (Choose three.) 	Mark for Review 
(1) Points
					
			(Choose all correct answers)	
					
			
	They are named PL/SQL blocks (*)
	
			
	They must return exactly one value to the calling environment.
	
			
	They can have an exception section. (*)
	
			
	They can be invoked from inside a SQL statement.
	
			
	They can accept parameters. (*)
	
					
				
Correct		Correct
	
					
		35. 	A PL/SQL stored procedure can accept one or more input parameters and can return one or more output values to the calling environment. True or False? 	Mark for Review 
(1) Points
					
			
	True (*)
	
			
	False
	
					
				
Correct		Correct
	
					
		36. 	One PL./SQL subprogram can be invoked from within many applications. True or False? 	Mark for Review 
(1) Points
					
			
	True (*)
	
			
	False
	
					
				
Correct		Correct
	
					
					
	Section 8
					
		37. 	Which of the following are NOT allowed in a function which is used inside a SQL statement which updates the EMPLOYEES table? (Choose two). 	Mark for Review 
(1) Points
					
			(Choose all correct answers)	
					
			
	SELECT .... FROM departments ....;
	
			
	COMMIT; (*)
	
			
	A RETURN statement.
	
			
	DDL statements such as CREATE or ALTER. (*)
	
			
	A WHEN OTHERS exception handler.
	
					
				
Correct		Correct
	
					
		38. 	In which DML statements can user-defined functions be used? 	Mark for Review 
(1) Points
					
			
	INSERT and UPDATE, but not DELETE.
	
			
	INSERT only.
	
			
	All DML statements. (*)
	
			
	UPDATE only
	
			
	DELETE only
	
					
				
Correct		Correct
	
					
		39. 	What is one of the advantages of using user-defined functions in a SQL statement? 	Mark for Review 
(1) Points
					
			
	They automate repetitive formulas which otherwise you would have to type in full every time you used them. (*)
	
			
	They execute faster than system-defined functions such as UPPER and LOWER.
	
			
	They allow you to execute DML from inside a SELECT statement.
	
			
	They allow you to use functions which return a BOOLEAN.
	
			
	They are stored on your local PC, not in the database.
	
					
				
Correct		Correct
	
					
		40. 	User REYHAN creates the following procedure: CREATE PROCEDURE proc1 AUTHID CURRENT_USER IS v_count NUMBER; BEGIN SELECT COUNT(*) INTO v_count FROM tom.employees; END; User BILL wants to execute this procedure. What privileges will BILL need? 	Mark for Review 
(1) Points
					
			
	EXECUTE on REYHAN.PROC1 and SELECT on TOM.EMPLOYEES (*)
	
			
	EXECUTE on REYHAN.PROC1
	
			
	SELECT on TOM.EMPLOYEES
	
			
	BILL needs no privileges
	
			
	None of the above. The procedure will fail to compile because REYHAN does not have SELECT privilege on TOM.EMPLOYEES.
	
					
				
Correct		Correct 
41. 	How do you specify that you want a procedure MYPROCA to use Invoker's Rights? 	Mark for Review 
(1) Points
					
			
	CREATE OR REPLACE PROCEDURE myproca
AUTHID CURRENT_USER IS...

(*)
	
			
	Invoker's Rights are the default, therefore no extra code is needed.
	
			
	GRANT INVOKER TO myprocA;

	
			
	ALTER PROCEDURE myproca TO INVOKER;

	
			
	CREATE OR REPLACE PROCEDURE myproca
AUTHID OWNER IS...

	
					
				
Correct		Correct
	
					
		42. 	The following code shows the dependencies between three procedures:

CREATE PROCEDURE parent
IS BEGIN
    child1;
    child2;
END parent;
You now try to execute:

DROP PROCEDURE child2;
What happens?
	Mark for Review 
(1) Points
					
			
	You cannot drop CHILD2 because PARENT is dependent on it.
	
			
	CHILD2 is dropped successfully. PARENT and CHILD1 are both marked INVALID.
	
			
	The database automatically drops PARENT as well.
	
			
	CHILD2 is dropped successfully. PARENT is marked INVALID. CHILD1 is still valid. (*)
	
			
	The database automatically drops CHILD1 as well.
	
					
				
Correct		Correct
	
					
		43. 	Examine the following code (the code of CHILD2 is not shown):

CREATE PROCEDURE child1
IS v_salary employees.salary%TYPE;
BEGIN
SELECT salary INTO v_salary FROM employees
WHERE employee_id = 9999;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END child1;
CREATE PROCEDURE parent

IS BEGIN
child1;
child2;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END parent;
Employee_id 9999 does not exist. What happens when PARENT is executed?
	Mark for Review 
(1) Points
					
			
	CHILD1 handles the exception successfully and ends. PARENT continues to execute and invokes CHILD2. (*)
	
			
	CHILD1 ends abruptly, PARENT handles the exception successfully and ends. CHILD2 does not execute.
	
			
	CHILD1 ends abruptly, then PARENT also ends abruptly with an unhandled exception.
	
			
	PARENT handles the exception, then CHILD1 resumes execution.
	
			
	PARENT fails to compile because you cannot have the same exception handler in two separate subprograms.
	
					
				
Correct		Correct
	
					
		44. 	Examine the following code: CREATE PROCEDURE parent
IS BEGIN
    child1;
    child2;
EXCEPTION
    WHEN NO_DATA_FOUND THEN NULL;
END parent;

Neither CHILD1 nor CHILD2 has an exception handler.
When PARENT is invoked, CHILD1 raises a NO_DATA_FOUND exception. What happens next?
	Mark for Review 
(1) Points
					
			
	PARENT handles the exception, then CHILD1 continues to execute.
	
			
	CHILD1 ends abruptly. PARENT handles the exception and then ends. CHILD2 does not execute. (*)
	
			
	CHILD1 ends abruptly, PARENT handles the exception, then CHILD2 executes.
	
			
	CHILD1 ends abruptly, PARENT also ends abruptly and returns an unhandled exception.
	
			
	PARENT does not compile because you cannot use NULL; in an exception handler.
	
					
				
Correct		Correct
	
					
		45. 	In a SELECT statement, where can a function NOT be used? 	Mark for Review 
(1) Points
					
			
	In a GROUP BY or HAVING clause.
	
			
	A function can be used anywhere in a SELECT statement. (*)
	
			
	In a WHERE clause.
	
			
	In the column list (SELECT) clause.
	
			
	In an ORDER BY clause.
	
					
				
Correct		Correct
	
					
		46. 	Examine the following code:

CREATE OR REPLACE FUNCTION add_func
(p_param1 NUMBER, p_param2 NUMBER)
RETURN NUMBER
IS
BEGIN
RETURN (p_param1 + p_param2);
END;
What will be displayed when the following SQL statement is executed?
SELECT add_func(6, add_func(3,8)) FROM dual;
	Mark for Review 
(1) Points
					
			
	23
	
			
	11
	
			
	66
	
			
	17 (*)
	
			
	An error message will be displayed because you cannot nest user-defined functions.
	
					
				
Correct		Correct
	
					
		47. 	Why will this function not compile correctly?

CREATE FUNCTION bad_one
IS BEGIN
    RETURN NULL;
END bad_one;
	Mark for Review 
(1) Points
					
			
	You cannot RETURN a NULL.
	
			
	You must declare the type of the RETURN before the IS. (*)
	
			
	You must have at least one IN parameter.
	
			
	You must code CREATE OR REPLACE, not CREATE.
	
			
	The body of the function must contain at least one executable statement (as well as RETURN).
	
					
				
Correct		Correct
	
					
		48. 	A function named MYFUNC has been created. This function accepts one IN parameter of datatype VARCHAR2 and returns a NUMBER.
You want to invoke the function within the following anonymous block:

DECLARE
v_var1 NUMBER(6,2);
BEGIN
-- Line A
END;
What could be coded at Liine A?
	Mark for Review 
(1) Points
					
			
	myfunc('Crocodile') := v_var1;
	
			
	myfunc(v_var1) := 'Crocodile';
	
			
	myfunc(v_var1, 'Crocodile');
	
			
	v_var1 := myfunc('Crocodile'); (*)
	
			
	myfunc('Crocodile', v_var1);
	
					
				
Correct		Correct
	
					
		49. 	Consider the following function:

CREATE FUNCTION ADD_EM
    (a NUMBER := 1,
    b NUMBER := 2 )
    RETURN NUMBER
IS BEGIN
    RETURN (a+b);
END ADD_EM;

Which one of the following blocks will NOT work correctly?
	Mark for Review 
(1) Points
					
			
	DECLARE
    x NUMBER;
BEGIN
    x:= add_em(b=4);
END;

(*)
	
			
	DECLARE
    x NUMBER;
BEGIN
    x:= add_em(4);
END;

	
			
	DECLARE
    x NUMBER;
BEGIN
    x:= add_em(4,5);
END;

	
			
	DECLARE
    x NUMBER;
BEGIN
    x:= add_em;
END;

	
			
	None of them will work.

	
					
				
Incorrect		Incorrect. Refer to Section 8.
	
					
		50. 	A function must have at least one IN parameter, and must return exactly one value. 	Mark for Review 
(1) Points
					
			
	True
	
			
	False (*)
	
					
				
Correct		Correct 