Uploaded by florlandrum8558

Oracle 1Z0-149 Exam Questions & Answers

advertisement
Oracle
1Z0-149
Oracle Database 19c: Program with PL/SQL
QUESTION & ANSWERS
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 1
The collection method COUNT
Option A : Returns the last (largest) index numbers in a collection that uses integer subscripts.
Option B : Returns the number of elements that a collection currently contains.
Option C : Checks the Maximum Size of a Collection
Option D : None of the above.
Correct Answer: B
QUESTION: 2
Which of the following is true about database transactions?
Option A : The SQL statements that constitute a transaction can collectively be either committed, i.e.,
made permanent to the database or rolled back (undone) from the database
Option B : A transaction has a beginning and an end.
Option C : None of the above.
Option D : Both A and B.
Correct Answer: D
QUESTION: 3
If left out, which of the following would cause an infinite loop to occur in a simple loop?
Option A : LOOP
Option B : END LOOP
Option C : IF-THEN
Option D : EXIT
Correct Answer: B
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 4
Select incorrect variable declarations
Option A : foo_number varchar2(10);
Option B : foo_text number(10);
Option C : foo_char char(1) := 'Y';
Option D : foo_time date;
Option E : foo_text varchar2(10) := 'hello world';
Correct Answer: A
Explanation/Reference:
The length of string 'hello world' (11) exceeds declared variable length of 10.
QUESTION: 5
When modifying procedure code, the procedure must be re-executed to validate and store it in the database.
True or False?
Option A : True
Option B : False
Correct Answer: A
QUESTION: 6
Which kind of parameters cannot have a DEFAULT value?
Option A : OUT
Option B : IN
Option C : CONSTANT
Option D : R(ead)
Option E : W(rite)
https://www.dumps4expert.com/1Z0-149-exam-dumps
Correct Answer: A
QUESTION: 7
Which of the following is not true about labeling PL/SQL loops?
Option A : PL/SQL loops can be labeled.
Option B : The label should be enclosed by angle brackets (< and >).
Option C : The label name appears at the beginning of the LOOP statement.
Option D : The label name can also appear at the end of the LOOP statement or with an EXIT statement.
Correct Answer: B
QUESTION: 8
Subprograms and anonymous blocks can be called by other applications. True or False?
Option A : True
Option B : False
Correct Answer: B
QUESTION: 9
What is the statement to remove a procedure from a database?
Option A : ALTER PROCEDURE
Option B : DROP PROCEDURE
Option C : DELETE PROCEDURE
Option D : TRUNCATE procedure.
Correct Answer: B
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 10
In which parameter mode Formal parameter acts like an initialized variable?
Option A : IN
Option B : OUT
Option C : IN OUT
Option D : None of the above
Correct Answer: C
QUESTION: 11
Which of the following is not true about the Constructors?
Option A : These are functions that return a new object as its value.
Option B : Every object has a system defined constructor method.
Option C : The name of the constructor is same as the object type.
Option D : None of the above.
Correct Answer: D
QUESTION: 12
Subprograms are named PL/SQL blocks that can be called with a set of parameters.
Option A : True
Option B : False
Option C : Depends upon
Option D : None of the above
Correct Answer: A
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 13
Which of the following is true about PL/SQL nested tables?
Option A : Nested tables are like one-dimensional arrays with arbitrary number of elements.
Option B : Unlike arrays a nested table doesn’t have declared number of elements. The size of a nested
table can increase dynamically.
Option C : Initially a nested array has consecutive subscripts or dense, but it can become sparse when
elements are deleted from it.
Option D : All of the above.
Correct Answer: D
QUESTION: 14
PL/SQL is a completely portable, ??? transaction processing language.
Option A : Low-performance
Option B : High-performance
Option C : Both 1 & 2
Option D : None of the above
Correct Answer: B
QUESTION: 15
What can the value of the INTO clause be while fetching data in an explicit cursor?
Option A : PL/SQL scalar variables only
Option B : PL/SQL variables or records
Option C : Collections or records only
Option D : Records only
Correct Answer: B
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 16
In which of the following scenarios would you recommend using associative arrays?
Option A : When you want to retrieve an entire row from a table and perform calculations
Option B : When you know the number of elements in advance and the elements are usually accessed
sequentially
Option C : When you want to create a separate lookup table with multiple entries for each row of the main
table, and access it through join queries
Option D : When you want to create a relatively small lookup table, where the collection can be
constructed on memory each time a subprogram is invoked
Correct Answer: D
Explanation/Reference:
https://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#LNPLS99930
“An associative array is appropriate for:
A relatively small lookup table, which can be constructed in memory each time you invoke the subprogram or initialize the
package that declares it”
QUESTION: 17
Which system events can be used to create triggers that fire both at database and schema
levels? (Choose all that apply)
Option A : AFTER LOGON
Option B : AFTER STARTUP
Option C : BEFORE SHUTDOWN
Option D : AFTER SERVERERROR
Correct Answer: A,D
Explanation/Reference:
AFTER LOGON and AFTER SERVERERROR doesn’t have any level restrictions as triggers below.
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/create_trigger.htm#LNPLS2064
https://www.dumps4expert.com/1Z0-149-exam-dumps
AFTER STARTUP
Causes the database to fire the trigger whenever the database is opened. This event is valid only with DATABASE, not with
SCHEMA.
BEFORE SHUTDOWN
Causes the database to fire the trigger whenever an instance of the database is shut down. This event is valid only with
DATABASE, not with SCHEMA
QUESTION: 18
View the Exhibit to examine the PLSQL block.
Which statement is true about the output of the PL/SQL block?
Option A : It executes and the Output is emprec.deptname: .
Option B : It executes and the Output is emprec.deptname: Sales.
Option C : It produces an error because NULL is assigned to the emprec.empid field in the record
Option D : It produces an error because the CHECK constraint is violated while assigning a value to the
emprec.deptid field in the record.
Correct Answer: A
QUESTION: 19
Which two blocks of code execute successfully?
https://www.dumps4expert.com/1Z0-149-exam-dumps
Option A : DECLARE SUBTYPE new_one IS BINARY_INTERGER RANGE 0..9;
my_val new_one;
BEGIN my_val :=0;
END;
Option B : DECLARE SUBTYPE new_string IS VARCHAR2 (5) NOT NULL; my_str_new_string;
BEGIN my_str := abc;
END;
Option C :
DECLARE SUBTYPE new_one IS NUMBER (2, 1);
my_val new_one;
BEGIN my_val :=12.5;
END;
Option D : DECLARE SUBTYPE new_one IS INTEGER RANGE 1..10 NOT NULL;
my_val new_one;
BEGIN my_val :=2;
END;
Option E : DECLARE SUBTYPE new_one IS NUMBER (1, 0);
my_val new_one;
BEGIN my_val := -1
Correct Answer: A
Explanation/Reference:
B : PLS-00218: a variable declared NOT NULL must have an initialization assignment
C : ORA-06502: PL/SQL: numeric or value error: number precision too large
D : PLS-00218: a variable declared NOT NULL must have an initialization assignment
QUESTION: 20
Consider a function totalEmp () which takes a number as an input parameter and returns the total number of
employees who have a salary higher than that parameter.
Examine this PL/SQL package AS –
https://www.dumps4expert.com/1Z0-149-exam-dumps
Which two definitions of totalEmp () result in an implicit conversion by Oracle Database on executing this
PL/SQL block?
Option A :
Option B :
Option C :
Option D :
Correct Answer: B,C
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 21
Examine this code (all compiled into schema HR):
Execute this code:
SET SERVEROUTPUT ON
EXEC test_pkg.do_stuff –
What is the correct output?
Option A :
https://www.dumps4expert.com/1Z0-149-exam-dumps
Option B :
Option C :
Option D :
Option E :
Correct Answer: C
QUESTION: 22
User SCOTT has been granted CREATE ANY TRIGGER AND ALTER ANY TABLE by the DBA. HR is an existing
schema in the database.
SCOTT creates the following trigger:
SCOTT does not grant the execute privilege on this trigger to any other users.
For which user(s) would this trigger fire by default when they drop an object in the hr schema?
Option A : Only HR
https://www.dumps4expert.com/1Z0-149-exam-dumps
Option B : SCOTT and HR
Option C : Only SCOTT
Option D : SCOTT, HR, and SYS
Correct Answer: A
Explanation/Reference:
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/lnpls/plsql-triggers.html#GUID-6CF3A208-0BE7-45FF-928CA755526933D0
9.5.1 SCHEMA Triggers
A SCHEMA trigger is created on a schema and fires whenever the user who owns it is the current user and initiates the
triggering event.
QUESTION: 23
View the Exhibit to examine the PL/SQL block.
Which statement is true about the execution of the PL/SQL block?
Option A : It executes successfully and gives the desired output.
Option B : It does not execute because the definition of type population is indexed by VARCHAR2.
Option C : It executes, and the string keys of an associative array are not stored in creation order, but in
sorted order.
Option D : It does not execute because the value that is once assigned to the element of the associative
array cannot be changed.
https://www.dumps4expert.com/1Z0-149-exam-dumps
Correct Answer: C
Explanation/Reference:
http://docs.oracle.com/cd/E11882_01/appdev.112/e25519/composites.htm#LNPLS005
QUESTION: 24
View the Exhibit and examine the structure of the customer table.
You create the following trigger to ensure that customers belonging to category "A" or "B"
in the customer table can have a credit limit of more than 8000.
https://www.dumps4expert.com/1Z0-149-exam-dumps
What is the outcome?
Option A : The trigger is fired, a message is displayed, and the update is successful
Option B : The trigger is fired and a message is displayed, but the update is rolled back.
Option C : The trigger is not fired because the when clause should be used to specify the condition,
however, the update is successful.
Option D : The trigger is not fired because column names must be specified with the update event to
identify which columns must be changed to cause the trigger to fire, however, the update is successful.
Correct Answer: A
QUESTION: 25
Which statement is true about the DBMS_PARALLEL_EXECUTE package?
Option A : DBMS_PARALLEL_EXECUTE is a SYS-owned package and can be accessed only by a user with
DBA privileges.
Option B : To execute chunks in parallel, users must have CREATE JOB system privilege
Option C : No specific system privileges are required to create or run parallel execution tasks
Option D : Only DBAs can create or run parallel execution tasks.
Option E : Users with CREATE TASK privilege can create or run parallel execution tasks.
Correct Answer: B
Explanation/Reference:
https://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_parallel_ex.htm#ARPLS67331
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 26
Option A : Line 5 should be replaced with: DBMS_LOB.CREATETEMPORARY (pdatabuf (1), TRUE,
DBMS_LOB.CALL);
Option B : Line 5 should be replaced with: DBMS_LOB.CREATETEMPORARY (pdatabuf (1), FALSE,
DBMS_LOB.SESSION);
Option C : Rewrite the block as:
Option D : pdatabuf (1) := NULL; should be added after line 4.
Option E : Line 5 should be replaced with:
DBMS_LOB.CREATETEMPORARY (pdatabuf, TRUE, DBMS_LOB.SESSION);
Correct Answer: C,D
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 27
Which PRAGMA statement may enable associated PL/SQL functions to run more efficiently when called from
SQL?
Option A : PRAGMA SERIALLY_REUSABLE;
Option B : PRAGMA UDF;
Option C : PRAGMA INLINE (‘< function_name >’, ‘YES’);
Option D : PRAGMA AUTONOMOUS_TRANSACTION;
Correct Answer: B
Explanation/Reference:
The UDF pragma tells the compiler that the PL/SQL unit is a user defined function that is used primarily in SQL statements,
which might improve its performance.
https://mwidlake.wordpress.com/2015/11/04/pragma-udf-speeding-up-your-plsql-functions-called-from-sql/
QUESTION: 28
View the Exhibit to examine the PL/SQL code.
Identify the correct output for the code.
https://www.dumps4expert.com/1Z0-149-exam-dumps
Option A : King 17-JUN-87 1500
Option B : King 17-JUN-87 24000
Option C : King current sysdate 1500
Option D : King current sysdate 24000
Correct Answer: C
QUESTION: 29
Examine the following DECLARE section of PL/SQL block:
Which line in the above declaration would generate an error?
Option A : Line 2
Option B : Line 3
Option C : Line 4
Option D : Line 5
Option E : Line 6
Correct Answer: A
Explanation/Reference:
ERROR at line 2:
ORA-06550: line 2, column 12:
PLS-00215: String length constraints must be in range (1 .. 32767)
QUESTION: 30
View the Exhibit and examine the structure of the EMP table.
https://www.dumps4expert.com/1Z0-149-exam-dumps
Examine the code of the packages that you have created.
You issue the following command:
SQL> DROP PACKAGE manage_emp;
What is the outcome?
Option A : It drops both the MANAGE_EMP AND EMP__DET packages because of the cascading effect.
Option B : It drops the MANAGE_EMP package and invalidates only the body for the EMP_DET package.
Option C : It returns an error and does not drop the MAMAGE_EMP package because of the cascading
effect.
Option D : It drops the MANAGE_EMP package and invalidates both the specification and body for the
EMP_DET package.
https://www.dumps4expert.com/1Z0-149-exam-dumps
Correct Answer: B
QUESTION: 31
Which data dictionary view contains the list of procedures and functions defined within package specification
that you can execute?
Option A : ALL_SOURCE
Option B : ALL_DEPENDENCIES
Option C : ALL_OBJECTS
Option D : ALL_PROCEDURES
Option E : ALL_PLSQL_OBJECT_SETTINGS
Correct Answer: D
QUESTION: 32
Examine this PL/SQL function:
What happens when the function is created with PLSQL_WARNINGS set to ENABLE: ALL?
Option A : There are no compilation warnings or errors.
Option B : It fails compilation.
Option C : An information compilation warning is generated.
Option D : A performance compilation warning is generated.
Option E : A severe compilation warning is generated.
https://www.dumps4expert.com/1Z0-149-exam-dumps
Correct Answer: C
Explanation/Reference:
http://psoug.org/reference/plsql_warnings.html
QUESTION: 33
Which of the following is true about PL/SQL index-by tables?
Option A : It is a set of key-value pairs.
Option B : Each key is unique and is used to locate the corresponding value.
Option C : The key can be either an integer or a string.
Option D : All of the above.
Correct Answer: D
QUESTION: 34
Which three SQL statements, embedded in PL/SQL, typically benefit from using variables declared
with%ROWTYPE? (Choose three.)
Option A : CREATE
Option B : DROP
Option C : UPDATE
Option D : SELECT
Option E : DELETE
Option F : ALTER
Option G : INSERT
Correct Answer: A,C,D
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 35
Which is true about EXIT and CONTINUE statements?
Option A : They can be used in any type of loop.
Option B : They must have a WHEN condition.
Option C : They have the same effect on the execution of a loop.
Option D : They must use labels.
Correct Answer: A
QUESTION: 36
SERVEROUTPUT is enabled.Which is the correct method to use a PACKAGED CONSTANT in SELECT
statements?
Option A :
Option B :
Option C :
https://www.dumps4expert.com/1Z0-149-exam-dumps
Option D :
Correct Answer: D
QUESTION: 37
Which is true about counter variables in a FOR loop?
Option A : It must explicitly be declared.
Option B : It can be modified in the body of the loop.
Option C : It cannot be NULL.
Option D : It is accessible outside the body of the loop.
Correct Answer: C
https://www.dumps4expert.com/1Z0-149-exam-dumps
QUESTION: 38
For which three SYSTEM EVENTS can triggers be created? (Choose three.)
Option A : DDL
Option B : AFTER AUDIT
Option C : BEFORE ANALYZE
Option D : SHUTDOWN
Option E : SERVERERROR
Option F : STARTUP
Option G : BEFORE GRANT
Correct Answer: A,D
QUESTION: 39
Which two are valid MODIFIER values for the PLSQL_WARNINGS parameter? (Choose two.)
Option A : DISABLE
Option B : ENABLE
Option C : ERROR
Option D : ALL
Option E : SEVERE
Correct Answer: A,D
https://www.dumps4expert.com/1Z0-149-exam-dumps
Download