Oracle Database Programming MCQs with Answers
Practice important Oracle Database Programming MCQs with answers and explanations.
Multiple Choice Questions
Q251: In which PL/SQL block is the cursor `c1` used to update employee salaries?
- A: Implementing Cursor -based Records –II
- B: Implementing Cursor -based Records –I
- C: Implementing User Defined Record –I
- D: Implementing User Defined Record –II
View Answer
A
Q252: In the PL/SQL block implementing User Defined Record –II, what action is taken if `emp_rec_val.ename` is 'BLAKE'?
- A: The record is inserted into the `history` table
- B: The record is updated in the `emp` table
- C: The record is deleted from the `emp` table
- D: The record is ignored
View Answer
A
Q253: What is the output of the PL/SQL block where the cursor `c1` fetches employee names with a salary less than 3000?
- A: Employee names with salaries less than 3000 are displayed
- B: Employee names with salaries more than 3000 are displayed
- C: No output is generated
- D: The program exits without displaying any results
View Answer
A
Q254: When using `FIRST` and `LAST` attributes in PL/SQL, what do they return if the table is empty?
- A: Null values
- B: First and last elements respectively
- C: The number of elements in the table
- D: The index of the first element
View Answer
A
Q255: What is a PL/SQL subprogram?
- A: A named PL/SQL block that can be invoked with a set of parameters
- B: A database table used for storing data
- C: A type of database object for storing temporary results
- D: A tool for debugging PL/SQL code
View Answer
A
Q256: What does a procedure in PL/SQL primarily do?
- A: Store data permanently
- B: Perform a specific task or action
- C: Define a new table structure
- D: Create a temporary view of data
View Answer
B
Q257: Which part of a PL/SQL procedure contains the code that performs the task?
- A: Specification
- B: Body
- C: Declaration
- D: Header
View Answer
B
Q258: What does the following PL/SQL statement do? `CREATE OR REPLACE PROCEDURE first_proc AS BEGIN dbms_output.put_line('Hello World!'); END;`
- A: Defines a procedure to output 'Hello World!'
- B: Defines a function to return 'Hello World!'
- C: Creates a table with 'Hello World!' as a value
- D: Creates a view with 'Hello World!' as its content
View Answer
A
Q259: In the syntax `CREATE OR REPLACE PROCEDURE procedure_name [(parameter_name [IN | OUT | IN OUT] type [, ...])] {IS | AS} BEGIN < procedure_body > END procedure_name;`, what does `IN` specify?
- A: A read-only parameter
- B: A parameter that can be both read and written
- C: A writable parameter
- D: A parameter that returns data to the caller
View Answer
A
Q260: What does an `OUT` parameter do in a PL/SQL procedure?
- A: Passes a value to the procedure
- B: Returns a value to the calling environment
- C: Specifies a read-only value
- D: Defines a parameter with no data type
View Answer
B