PL/SQL - Conditions (Decision Making) MCQ Questions & Answers

Conditions (Decision Making) MCQs : This section focuses on "Conditions (Decision Making)" in Pl/Sql. These Multiple Choice Questions (MCQ) should be practiced to improve the Pl/Sql skills required for various interviews (campus interview, walk-in interview, company interview), placements, entrance exams and other competitive examinations.

1. The __________ associates a condition with a sequence of statements enclosed by the keywords THEN and END IF.

A. GOTO statement
B. IF statement
C. CASE statement
D. LOOP statement

View Answer


2. What is output for the following code?

BEGIN 
   a:= 10; 
   IF( a < 20 ) THEN 
      dbms_output.put_line('a is less than 20 ' ); 
   END IF; 
   dbms_output.put_line('value of a is : ' || a); 
END;

A. Null
B. a is less than 20
C. Error
D. Exception

View Answer


3. What is output for the following code?

BEGIN
   a := 100;  
   IF( a < 20 ) THEN 
      dbms_output.put_line('a is less than 20 ' ); 
   ELSE 
      dbms_output.put_line('a is not less than 20 ' ); 
   END IF; 
END; 

A. a is less than 20
B. Error
C. a is not less than 20
D. Null

View Answer


4. Which of the following is true?

A. It's ELSIF, not ELSEIF.
B. An IF-THEN statement can have zero or one ELSE's and it must come after any ELSIF's.
C. Once an ELSIF succeeds, none of the remaining ELSIF's or ELSE's will be tested.
D. All of the above

View Answer


5. The CASE statement selects one sequence of statements to execute.

A. TRUE
B. FALSE
C. Can be true or false
D. Can not say

View Answer


6. What is output for the following code?

DECLARE 
   grade char(1) := 'A'; 
BEGIN 
   CASE grade 
      when 'A' then dbms_output.put_line('Excellent'); 
      when 'B' then dbms_output.put_line('Very good'); 
      when 'C' then dbms_output.put_line('Well done'); 
      when 'D' then dbms_output.put_line('You passed'); 
      when 'F' then dbms_output.put_line('Better try again'); 
      else dbms_output.put_line('No such grade'); 
   END CASE; 
END; 

A. Excellent
B. Very good
C. Well done
D. You passed

View Answer


7. CASE statement uses which keyword to work like IF statement?

A. INTO
B. AS
C. WHEN
D. IN

View Answer


8. What are the selectors in case of CASE statement?

A. Variable
B. Function
C. Expression
D. All of the above

View Answer


9. In which Oracle does the PL/SQL Continue Statement is supported?

A. Oracle 8g
B. Oracle 11g
C. Oracle 9g
D. Oracle 10g

View Answer


10. The searched CASE statement has no selector and the WHEN clauses of the statement contain search conditions that give Boolean values.

A. Yes
B. No
C. Can be yes or no
D. Can not say

View Answer





Discussion



* You must be logged in to add comment.