Skip to main content

Oracle Database Programming MCQs with Answers

Practice important Oracle Database Programming MCQs with answers and explanations.

Chapter: 16
Q221:
What is a collection in programming?
A. A list of integers
B. A type of loop
C. A group of elements of the same type
D. A method to handle exceptions
Correct Answer: C
Chapter: 16
Q222:
What does the `BINARY_INTEGER` index type in PL/SQL tables allow?
A. Indexes to be sequential only
B. Indexes to be sparse or dense
C. Indexes to be limited to strings
D. Indexes to be numeric only
Correct Answer: B
Chapter: 16
Q223:
In a PL/SQL table, which attribute returns the number of elements in the table?
A. EXISTS
B. COUNT
C. FIRST
D. LAST
Correct Answer: B
Chapter: 16
Q224:
Which PL/SQL table attribute returns the index of the element that follows a given index?
A. PRIOR
B. NEXT
C. FIRST
D. LAST
Correct Answer: B
Chapter: 16
Q225:
What is the purpose of the `EXISTS` attribute in PL/SQL tables?
A. It checks if an element at a given index exists
B. It counts the total number of elements
C. It returns the first index
D. It deletes elements at a given index
Correct Answer: A
Chapter: 16
Q226:
What will the `DELETE(n)` attribute do in a PL/SQL table?
A. Delete all elements in the table
B. Delete the nth element only
C. Delete all elements in the range m..n
D. Delete no elements if n is null
Correct Answer: B
Chapter: 16
Q227:
What is the syntax to declare a PL/SQL table of a specific datatype with an index by `BINARY_INTEGER`?
A. TYPE table_type_name IS TABLE OF datatype [NOT NULL] INDEX BY INTEGER;
B. TYPE table_type_name IS TABLE OF datatype [NOT NULL] INDEX BY BINARY_INTEGER;
C. TYPE table_type_name IS TABLE OF datatype INDEX BY INTEGER;
D. TYPE table_type_name IS TABLE OF datatype INDEX BY BINARY_INTEGER;
Correct Answer: B
Chapter: 16
Q228:
In the `Implementing PL/SQL Table -I` example, what happens if `counter` exceeds 10?
A. The loop continues indefinitely
B. The loop exits and the program terminates
C. The loop stops executing and no further output is displayed
D. The program displays the message "Prog" continuously until stopped
Correct Answer: B
Chapter: 16
Q229:
What does the `NEXT(n)` attribute return in PL/SQL tables?
A. The index number that succeeds index n
B. The index number that precedes index n
C. The smallest index number
D. The largest index number
Correct Answer: A
Chapter: 16
Q230:
What will be the output of the `Implementing PL/SQL Table -III` example if `c3.exists(b)` returns TRUE?
A. The value at index b is displayed
B. The index b is deleted from the table
C. The value at index b is inserted into another table
D. The index b is not found in the table
Correct Answer: A
Chapter: 16
Q231:
What is the primary function of the `DELETE` attribute in PL/SQL tables?
A. To remove specific elements or all elements from the table
B. To count the number of elements in the table
C. To return the first element in the table
D. To check if an element exists at a given index
Correct Answer: A
Chapter: 16
Q232:
In the `Implementing PL/SQL Table -II` example, what is the significance of incrementing `counter` by 2?
A. It creates gaps of 2 between indices in the `c3` table
B. It ensures that all indices are consecutive
C. It sets the maximum value of indices to 2
D. It initializes the counter to 2
Correct Answer: B
Chapter: 16
Q233:
What is the purpose of the `Implementing PL/SQL Table -IV` scenario?
A. To load employee names into one PL/SQL table and copy them to another before deleting from the first table
B. To load employee names into a SQL table and update them
C. To count the number of employees in the PL/SQL table
D. To delete all entries in a PL/SQL table
Correct Answer: A
Chapter: 16
Q234:
Which attribute in PL/SQL tables is used to check if an index exists before performing operations on it?
A. EXISTS
B. COUNT
C. DELETE
D. FIRST
Correct Answer: A
Chapter: 16
Q235:
What will be the output of the `Implementing PL/SQL Table and SQL-I` example?
A. Rows are inserted into the `history` table with employee names and current dates
B. Rows are deleted from the `history` table
C. Only employee names are displayed on the screen
D. The `history` table is not modified
Correct Answer: A
Chapter: 17
Q236:
What is a record in programming?
A. A group of related data items stored in fields
B. A type of array
C. A form of a database table
D. A programming loop
Correct Answer: A
Chapter: 17
Q237:
Which of the following is NOT a type of record?
A. Table Base
B. Cursor Base
C. Column Base
D. User Defined
Correct Answer: C
Chapter: 17
Q238:
What does a table-based record in PL/SQL correspond to?
A. A list of fields in a table
B. A virtual table created by a cursor
C. A dynamic array
D. A user-defined structure
Correct Answer: A
Chapter: 17
Q239:
How does a cursor-based record differ from a table-based record?
A. It is based on a SELECT list of a cursor
B. It corresponds directly to table columns
C. It has a fixed size
D. It uses numeric indexing
Correct Answer: A
Chapter: 17
Q240:
What is the purpose of the `emp_rec` variable in the PL/SQL block?
A. To store employee data temporarily
B. To define a new table
C. To execute a SELECT query
D. To declare a cursor
Correct Answer: B

Test Your Knowledge

Take a timed quiz on Oracle Database Programming

🚀 Start Quiz Now