1. What will be displayed when this block is executed?

DECLARE v_birthdate DATE; BEGIN IF v_birthdate < '01-JAN-2000' THEN DBMS_OUTPUT.PUT_LINE(' Born in the 20th century '); ELSE DBMS_OUTPUT.PUT_LINE(' Born in the 21st century '); END IF; END; Mark for Review (1) Points Born in the 20th century Born in the 21st century (*) Exception raised because no date given 2. You want to repeat a set of statements 100 times, incrementing a counter each time. What kind of PL/SQL control structure would you use? (1) Points IF...THEN...ELSE IF...THEN...ELSIF...ELSE CASE...WHEN...THEN A loop. (*) 3. What will be displayed when this block is executed? DECLARE v_bool1 BOOLEAN := NULL; v_bool2 BOOLEAN := NULL; v_char VARCHAR(10) := 'Start'; BEGIN IF (v_bool1 = v_bool2) THEN v_char:='Equal'; ELSE v_char:='Not equal'; END IF; DBMS_OUTPUT.PUT_LINE(v_char); END; Mark for Review

6.. CASE . AND statement2. Which one of the following is correct syntax for an IF statement? (1) Points IF condition THEN DO statement1. Which of the following statements are true about any of the PL/SQL conditional control structures such as IF . A basic loop is a type of control structure used to change the logical flow of statements in a PL/SQL block.Mark for Review (1) Points Equal Not equal (*) Start Nothing will be displayed.. True or False? (1) Points True (*) False 5. statement2. END IF.. and loops? (1) Points Mark for Review Mark for Review Mark for Review . IF condition THEN statement1. IF condition THEN statement1. ENDIF. statement2. 4. END IF. END IF. . (*) IF condition THEN statement1. The block will fail because you cannot compare two null values. statement2..

PUT_LINE(v_char). They determine a course of action based on conditions. Mark for Review (1) Points IF and THEN must be on the same line: IF (v_job='President') THEN .. The condition should be coded: IF (v_job := 'President') .. What will be displayed when this block is executed? DECLARE v_bool1 BOOLEAN := TRUE. DBMS_OUTPUT. (*) 7. more than once). Mark for Review (1) Points up down left (*) null 8.They allow the programmer to use logical tests to determine which statements are executed and which are not. They allow a set of statements to be executed repeatedly (i. BEGIN IF (v_bool1 AND v_bool2) THEN v_char:='down'.e. All of the above. v_bool2 BOOLEAN. END. END IF. What is wrong with the following trivial IF statement: IF (v_job='President') THEN v_salary := 10000. v_char VARCHAR(4) := 'up'. ELSE v_char:='left'.

END IF.Line A statement2. We want to execute one of three statements depending on whether the value in V_VAR is 10. Look at the following (badly written) code: age := 5. -. 20 or some other value. ELSIF age<22 THEN mature := 'teenager'. DBMS_OUTPUT. Name three types of control structures in PL/SQL.END IF. ELSE statement3.PUT_LINE(mature). (Choose three) (1) Points (Choose all correct answers) LOOP statements (*) SELECT statements EXCEPTIONS IF statements (*) CASE statements (*) 11. is missing (*) ELSE is missing 9. Mark for Review (1) Points ELSE IF v_var = 20 THEN ELSIF v_var = 20 ELSIF v_var = 20 THEN (*) IF v_var = 20 THEN 10. Mark for Review . END IF. What should be coded at Line A? IF v_var = 10 THEN statement1. ELSIF age<13 THEN mature := 'child'. IF age<30 THEN mature := 'adult'.

What will be displayed when this code is executed? Mark for Review (1) Points child teenager adult (*) adultteenagerchild .

Master your semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master your semester with Scribd & The New York Times

Cancel anytime.