PL SQL Objective Questions 1

PL SQL Objective Questions 1

What is the name of the cursor written and maintained by a database user?

  1. User cursor
  2. Explicit cursor
  3. Implicit cursor
  4. User-defined cursor

Ans : 2


What is the syntax of an implicit cursor attribute ISOPEN?

  1. %ISOPEN
  2. #ISOPEN
  3. &ISOPEN
  4. ! ISOPEN

Ans : 1


What does %FOUND attribute indicate?

  1. It indicates that the cursor was found.
  2. It indicates that the number of rows that got affected.
  3. It indicates whether any rows were affected.
  4. It indicates whether any rows were not affected.

Ans : 3


When is an implicit cursor used?

  1. SELECT or DML statement is run and not associated with any cursor variable.
  2. SELECT statement is run even if the statements are associated with explicit cursor.
  3. DDL statement is run and the statements are not associated with any explicit cursor.
  4. SELECT/DML statement is run and the statements are not associated explicit cursor.

Ans : 4


Which type of cursor does an implicit and explicit cursor belong to?

  1. System cursor
  2. Session cursor
  3. Database cursor
  4. Operating System cursor

Ans : 2


Attend Free Demo and Learn   SQL SERVER ONLINE TRAINING   by Real-Time Expert


Which of the operations of a cursor checks for the validity of a SQL statement?

  1. OPEN
  2. BIND
  3. FETCH
  4. PARSE

Ans : 4


How many rows can a cursor hold?

  1. One only
  2. Zero only
  3. One or more
  4. One to ten

Ans : 3


Which of the following is not correct about Cursor ?

  1. Cursor is a named Private SQL area
  2. Cursor holds temporary results
  3. Cursor is used for retrieving multiple rows
  4. SQL uses implicit Cursors to retrieve rows

Ans : 3


Find the ODD one out of the following

  1. OPEN
  2. CLOSE
  3. INSERT
  4. FETCH

Ans : 3


What does a COMMIT statement do to a CURSOR?

  1. Open the Cursor
  2. Fetch the Cursor
  3. Close the Cursor
  4. None of the above

Ans : 4


Attend Free Demo and Learn   SQL SERVER ONLINE TRAINING   by Real-Time Expert


Which of the following statements is true about implicit cursors?

  1. Implicit cursors are used for SQL statements that are not named.
  2. Developers should use implicit cursors with great care.
  3. Implicit cursors are used in cursor for loops to handle data processing.
  4. Implicit cursors are no longer a feature in Oracle.

Ans : 1


Which of the following is not a feature of a cursor FOR loop?

  1. Record type declaration.
  2. Opening and parsing of SQL statements.
  3. Fetches records from cursor.
  4. Requires exit condition to be defined.

Ans : 2


When should a CLOSE statement be used in PL/SQL?

  1. For both implicit and explicit cursors
  2. Only for explicit cursors
  3. Only for implicit cursors
  4. Only for cursor expression

Ans : 2


What can the value of the INTO clause be while fetching data in an explicit cursor?

  1. PL/SQL scalar variables only
  2. PL/SQL variables or records
  3. Collections or records only
  4. Records only

Ans : 2


Which of the false statements about opening and closing an explicit cursor ?

  1. An explicit cursor is closed with the CLOSE statement.
  2. A cursor once closed cannot be re-opened.
  3. Open statement identifies the result set and positions the cursor before the first row
  4. Optionally arguments can be passed to the open statement to open a cursor

Ans : 2


What is the datatype of the return value of SQL%ROWCOUNT attribute?

  1. INTEGER
  2. NUMBER
  3. PLS_INTEGER
  4. BOOLEAN

Ans : 3


Attend Free Demo and Learn   SQL SERVER ONLINE TRAINING   by Real-Time Expert


When should a column fetched in an explicit cursor have an alias?

  1. An alias should never be used
  2. Always an alias should be used for columns in an explicit cursor
  3. Query includes a virtual column or an expression and that is referenced in the query
  4. The cursor is used to fetch into a record that was declared with %ROWTYPE

Ans : 3


Which of the following statements about a cursor declaration and definition is true?

  1. An explicit cursor should be declared & defined at the same time in execution block.
  2. An explicit cursor can be declared first and then defined later
  3. An explicit cursor should be declared & defined at the same time in declarationblock.
  4. Cursor declaration and definition are the same and is a single step

Ans : 2


What is the value of %ROWCOUNT   before the first row is fetched?

  1. 1
  2. Zero
  3. -1
  4. NULL

Ans : 2


Which SQL Attribute can be used to determine the exit condition of the loop ?

  1. %FOUND
  2. %ISOPEN
  3. %ROWCOUNT
  4. %NOTFOUND

Ans : 4


What is the scope of the index of the CURSOR FOR LOOP?

  1. Local to the loop
  2. Global
  3. Local to the loop and enclosing loops
  4. Block scope (in the entire Pl/SQL block)

Ans :  1


Attend Free Demo and Learn   SQL SERVER ONLINE TRAINING   by Real-Time Expert


Why is the WHERE CURRENT OF CLAUSE used in Cursors?

  1. User to easily make changes to the least recently fetched row of data.
  2. User to easily make changes to all the rows of a table.
  3. User to easily make changes to the most recently fetched row of data.
  4. User to easily make changes to the data not fetched by the recent query.

Ans : 3


What is an implicit CURSOR FOR LOOP statement?

  1. SELECT statement specified outside the CURSOR FOR LOOP statement.
  2. Cursor specified in the CURSOR FOR LOOP statement.
  3. Cursor specified in any LOOP statement.
  4. SELECT statement specified inside the CURSOR FOR LOOP statement.

Ans : 4


Read More PL/SQL Objective Questions and Answers

Click Here
Click Here
Click Here
PL/SQL Objectives 1
PL/SQL Objectives 2
PL/SQL Objectives 3
PL/SQL Objectives 4
PL/SQL Objectives 5
PL/SQL Objectives 6
PL/SQL Objectives 7
PL/SQL Objectives 8
PL/SQL Objectives 9
PL/SQL Objectives 10
PL/SQL Objectives 11
PL/SQL Objectives 12
PL/SQL Objectives 13
PL/SQL Objectives 14
PL/SQL Objectives 15

Share this post