Using PL/SQL Control Structures - questions and answers

Using PL/SQL Control Structures - questions and answers


1) How many nested IF clauses can be included within an IF clause?

A) 1
B) 0
C) 15
D) Any number
View Answer / Hide Answer

ANSWER: D) Any number




2) In the PL/SQL block below, how many rows will be inserted in the messages table?

DECLARE
v_start_sales NUMBER := 2;
v_end_sales NUMBER := 100;
BEGIN
FOR i IN v_start_sales..v_end_sales LOOP
INSERT INTO messages(msgid)
VALUES v_start_sales;
END LOOP;
END;

A) 0
B) 99
C) 1
D) 100
View Answer / Hide Answer

ANSWER: B) 99




3) What is the maximum number of ELSE clauses that can be included in an IF clause that is not nested?

A) 1
B) 0
C) 15
D) Any number
View Answer / Hide Answer

ANSWER: A) 1




4) Which statements execute a sequence of statements multiple times?

A) EXIT
B) LOOP
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: B) LOOP




5) Which structure executes a sequence of statements repeatedly as long as a condition holds true?

A) Selection structure
B) Iteration structure
C) Sequence structure
D) None of the above
View Answer / Hide Answer

ANSWER: B) Iteration structure




6) Which type of cursor is automatically declared by Oracle every time an SQL statement is executed?

A) An Implicit
B) An Explicit
C) Both A & B
D) None of the above
View Answer / Hide Answer

ANSWER: A) An Implicit




7) An Explicit cursor is defined by the program for any query that returns more than one row of data.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




8) In the SQL Cursor, which attribute is TRUE when a cursor has some remaining rows to fetch, and FALSE when a cursor has no rows left to fetch?

A) %ROWCOUNT
B) %FOUND
C) %NOTFOUND
D) %ISOPEN
View Answer / Hide Answer

ANSWER: B) %FOUND




9) In PL/SQL, a warning or error condition is called an exception.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




10) To handle raised exceptions, you write separate routines called exception handlers.

A) Yes
B) No
View Answer / Hide Answer

ANSWER: A) Yes




11) For which Exception, if a SELECT statement attempts to retrieve data based on its conditions, this exception is raised when no rows satisfy the SELECT criteria?

A) TOO_MANY_ROWS
B) NO_DATA_FOUND
C) VALUE_ERROR
D) DUP_VAL_ON_INDEX
View Answer / Hide Answer

ANSWER: B) NO_DATA_FOUND




12) “NO_DATA_FOUND” and “TOO_MANY_ROWS” are the two most common errors found when executing a SELECT statement.

A) True
B) False
View Answer / Hide Answer

ANSWER: A) True




13) Oracle predefined errors are not associated with specific error codes.

A) True
B) False
View Answer / Hide Answer

ANSWER: B) False


Post your comment